基于WF的报销单流转审批业务3(浅析)

项目名:BLL(业务逻辑),还是采用李天平的代码生成器来做,因为主要体现工作流的整体思路,所以采用代码生成器来做比较简化,呵呵:

 

BLBXDan
using System;
using System.Data;
using System.Collections.Generic;
using Model;

namespace BLL
{
    
public class BLBXDan
    {
        
private readonly DAL.DLBXDan dal = new DAL.DLBXDan();
        
#region  成员方法
        
/// <summary>
        
/// 是否存在该记录
        
/// </summary>
        public bool Exists(int BXID)
        {
            
return dal.Exists(BXID);
        }

        
/// <summary>
        
/// 增加一条数据
        
/// </summary>
        public int Add(Model.BXDan model)
        {
            
return dal.Add(model);
        }

        
/// <summary>
        
/// 更新一条数据
        
/// </summary>
        public void Update(Model.BXDan model)
        {
            dal.Update(model);
        }

        
/// <summary>
        
/// 删除一条数据
        
/// </summary>
        public void Delete(int BXID)
        {

            dal.Delete(BXID);
        }

        
/// <summary>
        
/// 得到一个对象实体
        
/// </summary>
        public Model.BXDan GetModel(int BXID)
        {

            
return dal.GetModel(BXID);
        }

        
/// <summary>
        
/// 获得数据列表
        
/// </summary>
        public DataSet GetList(string strWhere)
        {
            
return dal.GetList(strWhere);
        }
        
/// <summary>
        
/// 获得数据列表
        
/// </summary>
        public List<Model.BXDan> GetModelList(string strWhere)
        {
            DataSet ds 
= dal.GetList(strWhere);
            List
<Model.BXDan> modelList = new List<Model.BXDan>();
            
int rowsCount = ds.Tables[0].Rows.Count;
            
if (rowsCount > 0)
            {
                Model.BXDan model;
                
for (int n = 0; n < rowsCount; n++)
                {
                    model 
= new Model.BXDan();
                    
if (ds.Tables[0].Rows[n]["BXID"].ToString() != "")
                    {
                        model.BXID 
= int.Parse(ds.Tables[0].Rows[n]["BXID"].ToString());
                    }
                    model.BXName 
= ds.Tables[0].Rows[n]["BXName"].ToString();
                    model.BXNeiRong 
= ds.Tables[0].Rows[n]["BXNeiRong"].ToString();
                    model.BXJin 
= ds.Tables[0].Rows[n]["BXJin"].ToString();
                    model.SPYiJianCW 
= ds.Tables[0].Rows[n]["SPYiJianCW"].ToString();
                    model.SPYiJianJL 
= ds.Tables[0].Rows[n]["SPYiJianJL"].ToString();
                    model.SPYiJianCN 
= ds.Tables[0].Rows[n]["SPYiJianCN"].ToString();
                    
if (ds.Tables[0].Rows[n]["stated"].ToString() != "")
                    {
                        model.stated 
= int.Parse(ds.Tables[0].Rows[n]["stated"].ToString());
                    }
                    model.BXGID 
= ds.Tables[0].Rows[n]["BXGID"].ToString();
                    modelList.Add(model);
                }
            }
            
return modelList;
        }

        
/// <summary>
        
/// 获得数据列表
        
/// </summary>
        public DataSet GetAllList()
        {
            
return GetList("");
        }

        
/// <summary>
        
/// 获得数据列表
        
/// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        
//{
        
//return dal.GetList(PageSize,PageIndex,strWhere);
        
//}

        
#endregion  成员方法
    }
}

 

项目名:DAL(数据访问),还是生成的:

 

DLBXDan
using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;

namespace DAL
{
    
public class DLBXDan
    {
        
#region  成员方法
        
/// <summary>
        
/// 是否存在该记录
        
/// </summary>
        public bool Exists(int BXID)
        {
            StringBuilder strSql 
= new StringBuilder();
            strSql.Append(
"select count(1) from BXDan");
            strSql.Append(
" where BXID=@BXID ");
            SqlParameter[] parameters 
= {
                    
new SqlParameter("@BXID", SqlDbType.Int,4)};
            parameters[
0].Value = BXID;

            
return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        
/// <summary>
        
/// 增加一条数据
        
/// </summary>
        public int Add(Model.BXDan model)
        {
            StringBuilder strSql 
= new StringBuilder();
            strSql.Append(
"insert into BXDan(");
            strSql.Append(
"BXName,BXNeiRong,BXJin,SPYiJianCW,SPYiJianJL,SPYiJianCN,stated,BXGID)");
            strSql.Append(
" values (");
            strSql.Append(
"@BXName,@BXNeiRong,@BXJin,@SPYiJianCW,@SPYiJianJL,@SPYiJianCN,@stated,@BXGID)");
            strSql.Append(
";select @@IDENTITY");
            SqlParameter[] parameters 
= {
                    
new SqlParameter("@BXName", SqlDbType.VarChar,5000),
                    
new SqlParameter("@BXNeiRong", SqlDbType.VarChar,5000),
                    
new SqlParameter("@BXJin", SqlDbType.VarChar,5000),
                    
new SqlParameter("@SPYiJianCW", SqlDbType.VarChar,5000),
                    
new SqlParameter("@SPYiJianJL", SqlDbType.VarChar,5000),
                    
new SqlParameter("@SPYiJianCN", SqlDbType.VarChar,5000),
                    
new SqlParameter("@stated", SqlDbType.Int,4),
                    
new SqlParameter("@BXGID", SqlDbType.VarChar,5000)};
            parameters[
0].Value = model.BXName;
            parameters[
1].Value = model.BXNeiRong;
            parameters[
2].Value = model.BXJin;
            parameters[
3].Value = model.SPYiJianCW;
            parameters[
4].Value = model.SPYiJianJL;
            parameters[
5].Value = model.SPYiJianCN;
            parameters[
6].Value = model.stated;
            parameters[
7].Value = model.BXGID;

            
object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            
if (obj == null)
            {
                
return 1;
            }
            
else
            {
                
return Convert.ToInt32(obj);
            }
        }
        
/// <summary>
        
/// 更新一条数据
        
/// </summary>
        public void Update(Model.BXDan model)
        {
            StringBuilder strSql 
= new StringBuilder();
            strSql.Append(
"update BXDan set ");
            strSql.Append(
"BXName=@BXName,");
            strSql.Append(
"BXNeiRong=@BXNeiRong,");
            strSql.Append(
"BXJin=@BXJin,");
            strSql.Append(
"SPYiJianCW=@SPYiJianCW,");
            strSql.Append(
"SPYiJianJL=@SPYiJianJL,");
            strSql.Append(
"SPYiJianCN=@SPYiJianCN,");
            strSql.Append(
"stated=@stated,");
            strSql.Append(
"BXGID=@BXGID");
            strSql.Append(
" where BXID=@BXID ");
            SqlParameter[] parameters 
= {
                    
new SqlParameter("@BXID", SqlDbType.Int,4),
                    
new SqlParameter("@BXName", SqlDbType.VarChar,5000),
                    
new SqlParameter("@BXNeiRong", SqlDbType.VarChar,5000),
                    
new SqlParameter("@BXJin", SqlDbType.VarChar,5000),
                    
new SqlParameter("@SPYiJianCW", SqlDbType.VarChar,5000),
                    
new SqlParameter("@SPYiJianJL", SqlDbType.VarChar,5000),
                    
new SqlParameter("@SPYiJianCN", SqlDbType.VarChar,5000),
                    
new SqlParameter("@stated", SqlDbType.Int,4),
                    
new SqlParameter("@BXGID", SqlDbType.VarChar,5000)};
            parameters[
0].Value = model.BXID;
            parameters[
1].Value = model.BXName;
            parameters[
2].Value = model.BXNeiRong;
            parameters[
3].Value = model.BXJin;
            parameters[
4].Value = model.SPYiJianCW;
            parameters[
5].Value = model.SPYiJianJL;
            parameters[
6].Value = model.SPYiJianCN;
            parameters[
7].Value = model.stated;
            parameters[
8].Value = model.BXGID;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }

        
/// <summary>
        
/// 删除一条数据
        
/// </summary>
        public void Delete(int BXID)
        {

            StringBuilder strSql 
= new StringBuilder();
            strSql.Append(
"delete BXDan ");
            strSql.Append(
" where BXID=@BXID ");
            SqlParameter[] parameters 
= {
                    
new SqlParameter("@BXID", SqlDbType.Int,4)};
            parameters[
0].Value = BXID;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }


        
/// <summary>
        
/// 得到一个对象实体
        
/// </summary>
        public Model.BXDan GetModel(int BXID)
        {

            StringBuilder strSql 
= new StringBuilder();
            strSql.Append(
"select  top 1 BXID,BXName,BXNeiRong,BXJin,SPYiJianCW,SPYiJianJL,SPYiJianCN,stated,BXGID from BXDan ");
            strSql.Append(
" where BXID=@BXID ");
            SqlParameter[] parameters 
= {
                    
new SqlParameter("@BXID", SqlDbType.Int,4)};
            parameters[
0].Value = BXID;

            Model.BXDan model 
= new Model.BXDan();
            DataSet ds 
= DbHelperSQL.Query(strSql.ToString(), parameters);
            
if (ds.Tables[0].Rows.Count > 0)
            {
                
if (ds.Tables[0].Rows[0]["BXID"].ToString() != "")
                {
                    model.BXID 
= int.Parse(ds.Tables[0].Rows[0]["BXID"].ToString());
                }
                model.BXName 
= ds.Tables[0].Rows[0]["BXName"].ToString();
                model.BXNeiRong 
= ds.Tables[0].Rows[0]["BXNeiRong"].ToString();
                model.BXJin 
= ds.Tables[0].Rows[0]["BXJin"].ToString();
                model.SPYiJianCW 
= ds.Tables[0].Rows[0]["SPYiJianCW"].ToString();
                model.SPYiJianJL 
= ds.Tables[0].Rows[0]["SPYiJianJL"].ToString();
                model.SPYiJianCN 
= ds.Tables[0].Rows[0]["SPYiJianCN"].ToString();
                
if (ds.Tables[0].Rows[0]["stated"].ToString() != "")
                {
                    model.stated 
= int.Parse(ds.Tables[0].Rows[0]["stated"].ToString());
                }
                model.BXGID 
= ds.Tables[0].Rows[0]["BXGID"].ToString();
                
return model;
            }
            
else
            {
                
return null;
            }
        }

        
/// <summary>
        
/// 获得数据列表
        
/// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql 
= new StringBuilder();
            strSql.Append(
"select BXID,BXName,BXNeiRong,BXJin,SPYiJianCW,SPYiJianJL,SPYiJianCN,stated,BXGID ");
            strSql.Append(
" FROM BXDan ");
            
if (strWhere.Trim() != "")
            {
                strSql.Append(
" where " + strWhere);
            }
            
return DbHelperSQL.Query(strSql.ToString());
        }

        
/*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@tblName", SqlDbType.VarChar, 255),
                    new SqlParameter("@fldName", SqlDbType.VarChar, 255),
                    new SqlParameter("@PageSize", SqlDbType.Int),
                    new SqlParameter("@PageIndex", SqlDbType.Int),
                    new SqlParameter("@IsReCount", SqlDbType.Bit),
                    new SqlParameter("@OrderType", SqlDbType.Bit),
                    new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
                    };
            parameters[0].Value = "BXDan";
            parameters[1].Value = "ID";
            parameters[2].Value = PageSize;
            parameters[3].Value = PageIndex;
            parameters[4].Value = 0;
            parameters[5].Value = 0;
            parameters[6].Value = strWhere;    
            return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
        }
*/

        
#endregion  成员方法
    }
}

 

项目名:Model(数据实体),^_^

 

BXDan
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Model
{
    
/// <summary>
    
/// 实体类BXDan 。(属性说明自动提取数据库字段的描述信息)
    
/// </summary>
    public class BXDan
    {
        
public BXDan()
        { }
        
#region Model
        
private int _bxid;
        
private string _bxname;
        
private string _bxneirong;
        
private string _bxjin;
        
private string _spyijiancw;
        
private string _spyijianjl;
        
private string _spyijiancn;
        
private int _stated;
        
private string _bxgid;
        
/// <summary>
        
/// 
        
/// </summary>
        public int BXID
        {
            
set { _bxid = value; }
            
get { return _bxid; }
        }
        
/// <summary>
        
/// 
        
/// </summary>
        public string BXName
        {
            
set { _bxname = value; }
            
get { return _bxname; }
        }
        
/// <summary>
        
/// 
        
/// </summary>
        public string BXNeiRong
        {
            
set { _bxneirong = value; }
            
get { return _bxneirong; }
        }
        
/// <summary>
        
/// 
        
/// </summary>
        public string BXJin
        {
            
set { _bxjin = value; }
            
get { return _bxjin; }
        }
        
/// <summary>
        
/// 
        
/// </summary>
        public string SPYiJianCW
        {
            
set { _spyijiancw = value; }
            
get { return _spyijiancw; }
        }
        
/// <summary>
        
/// 
        
/// </summary>
        public string SPYiJianJL
        {
            
set { _spyijianjl = value; }
            
get { return _spyijianjl; }
        }
        
/// <summary>
        
/// 
        
/// </summary>
        public string SPYiJianCN
        {
            
set { _spyijiancn = value; }
            
get { return _spyijiancn; }
        }
        
/// <summary>
        
/// 0报销者,1财务,2经理,3出纳
        
/// </summary>
        public int stated
        {
            
set { _stated = value; }
            
get { return _stated; }
        }
        
/// <summary>
        
/// 
        
/// </summary>
        public string BXGID
        {
            
set { _bxgid = value; }
            
get { return _bxgid; }
        }
        
#endregion Model

    }
}

 

 

基于WF的报销单流转审批业务1(浅析)
基于WF的报销单流转审批业务2(浅析)
基于WF的报销单流转审批业务4(浅析)
基于WF的报销单流转审批业务5(浅析)
基于WF的报销单流转审批业务6(浅析)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值