/// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(Model.Outlay_Model model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Stale_Outlay set ");
            strSql.Append("EmpName=@EmpName,");
            strSql.Append("Party=@Party,");
            strSql.Append("B=@B,");
            strSql.Append("DemoName=@DemoName,");
            strSql.Append("Type=@Type,");
            strSql.Append("ContractNo=@ContractNo,");
            strSql.Append("Outlayetime=@Outlayetime,");
            strSql.Append("OperPerson=@OperPerson,");
            strSql.Append("Money=@Money,");
            strSql.Append("Remark=@Remark");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",          SqlDbType.Int,         4),
                new SqlParameter("@EmpName",     SqlDbType.NVarChar,   50),
                new SqlParameter("@Party",       SqlDbType.NVarChar,  100),
                new SqlParameter("@B",           SqlDbType.NVarChar,  100),
                new SqlParameter("@DemoName",    SqlDbType.NVarChar,  100),
                new SqlParameter("@Type",        SqlDbType.NVarChar,   50),
                new SqlParameter("@ContractNo",  SqlDbType.NVarChar,  100),
                new SqlParameter("@Outlayetime", SqlDbType.DateTime),
                new SqlParameter("@OperPerson",  SqlDbType.NVarChar,   50),
                new SqlParameter("@Money",       SqlDbType.Decimal,     9),
                new SqlParameter("@Remark",      SqlDbType.NVarChar, 200)
            };
            parameters[0].Value  = model.ID;
            parameters[1].Value  = model.EmpName;
            parameters[2].Value  = model.Party;
            parameters[3].Value  = model.B;
            parameters[4].Value  = model.DemoName;
            parameters[5].Value  = model.Type;
            parameters[6].Value  = model.ContractNo;
            parameters[7].Value  = model.Outlayetime;
            parameters[8].Value  = model.OperPerson;
            parameters[9].Value  = model.Money;
            parameters[10].Value = model.Remark;

            return(DbHelperSQL.ExecuteCommand(strSql.ToString(), parameters));
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Outlay_Model GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,EmpName,Party,B,DemoName,Type,ContractNo,Outlayetime,OperPerson,Money,Remark from Stale_Outlay ");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            Model.Outlay_Model model = new Model.Outlay_Model();
            DataTable          dt    = DbHelperSQL.GetDateSet(strSql.ToString(), parameters);

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(dt.Rows[0]["ID"].ToString());
                }
                model.EmpName    = dt.Rows[0]["EmpName"].ToString();
                model.Party      = dt.Rows[0]["Party"].ToString();
                model.B          = dt.Rows[0]["B"].ToString();
                model.DemoName   = dt.Rows[0]["DemoName"].ToString();
                model.Type       = dt.Rows[0]["Type"].ToString();
                model.ContractNo = dt.Rows[0]["ContractNo"].ToString();
                if (dt.Rows[0]["Outlayetime"].ToString() != "")
                {
                    model.Outlayetime = DateTime.Parse(dt.Rows[0]["Outlayetime"].ToString());
                }
                model.OperPerson = dt.Rows[0]["OperPerson"].ToString();
                if (dt.Rows[0]["Money"].ToString() != "")
                {
                    model.Money = decimal.Parse(dt.Rows[0]["Money"].ToString());
                }
                model.Remark = dt.Rows[0]["Remark"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.Outlay_Model model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Stale_Outlay(");
            strSql.Append("EmpName,Party,B,DemoName,Type,ContractNo,Outlayetime,OperPerson,Money,Remark)");
            strSql.Append(" values (");
            strSql.Append("'" + model.EmpName + "',");
            strSql.Append("'" + model.Party + "',");
            strSql.Append("'" + model.B + "',");
            strSql.Append("'" + model.DemoName + "',");
            strSql.Append("'" + model.Type + "',");
            strSql.Append("'" + model.ContractNo + "',");
            strSql.Append("'" + model.Outlayetime + "',");
            strSql.Append("'" + model.OperPerson + "',");
            strSql.Append("" + model.Money + ",");
            strSql.Append("'" + model.Remark + "'");
            strSql.Append(")");
            strSql.Append(";select @@IDENTITY");

            return(DbHelperSQL.ExecuteCommand(strSql.ToString()));
        }
Esempio n. 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(Model.Outlay_Model model)
 {
     return(dal.Update(model));
 }
Esempio n. 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Model.Outlay_Model model)
 {
     return(dal.Add(model));
 }