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

            strSql.Append("update Stale_Income set ");
            strSql.Append("Party=@Party,");
            strSql.Append("B=@B,");
            strSql.Append("DemoName=@DemoName,");
            strSql.Append("Money=@Money,");
            strSql.Append("DemoCost=@DemoCost,");
            strSql.Append("ContractNo=@ContractNo,");
            strSql.Append("Incometime=@Incometime,");
            strSql.Append("EmpName=@EmpName,");
            strSql.Append("Deductap=@Deductap,");
            strSql.Append("OperPerson=@OperPerson,");
            strSql.Append("IsBank=@IsBank,");
            strSql.Append("InvoiceMoney=@InvoiceMoney,");
            strSql.Append("BreakMoney=@BreakMoney,");
            strSql.Append("Remark=@Remark");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",           SqlDbType.Int,         4),
                new SqlParameter("@Party",        SqlDbType.NVarChar,  100),
                new SqlParameter("@B",            SqlDbType.NVarChar,  100),
                new SqlParameter("@DemoName",     SqlDbType.NVarChar,  100),
                new SqlParameter("@Money",        SqlDbType.Decimal,     9),
                new SqlParameter("@DemoCost",     SqlDbType.Decimal,     9),
                new SqlParameter("@ContractNo",   SqlDbType.NVarChar,  100),
                new SqlParameter("@Incometime",   SqlDbType.DateTime),
                new SqlParameter("@EmpName",      SqlDbType.NVarChar,   50),
                new SqlParameter("@Deductap",     SqlDbType.Decimal,     9),
                new SqlParameter("@OperPerson",   SqlDbType.NVarChar,   50),
                new SqlParameter("@IsBank",       SqlDbType.NVarChar,   50),
                new SqlParameter("@InvoiceMoney", SqlDbType.Decimal,     9),
                new SqlParameter("@BreakMoney",   SqlDbType.Decimal,     9),
                new SqlParameter("@Remark",       SqlDbType.NVarChar, 200)
            };
            parameters[0].Value  = model.ID;
            parameters[1].Value  = model.Party;
            parameters[2].Value  = model.B;
            parameters[3].Value  = model.DemoName;
            parameters[4].Value  = model.Money;
            parameters[5].Value  = model.DemoCost;
            parameters[6].Value  = model.ContractNo;
            parameters[7].Value  = model.Incometime;
            parameters[8].Value  = model.EmpName;
            parameters[9].Value  = model.Deductap;
            parameters[10].Value = model.OperPerson;
            parameters[11].Value = model.IsBank;
            parameters[12].Value = model.InvoiceMoney;
            parameters[13].Value = model.BreakMoney;
            parameters[14].Value = model.Remark;

            return(DbHelperSQL.ExecuteCommand(strSql.ToString(), parameters));
        }
Beispiel #2
0
        private Model.Income_Model ReaderBind(SqlDataReader datareader)
        {
            Model.Income_Model model = new Model.Income_Model();
            object             ojb;

            ojb = datareader["ID"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ID = (int)ojb;
            }
            model.Party    = datareader["Party"].ToString();
            model.B        = datareader["B"].ToString();
            model.DemoName = datareader["DemoName"].ToString();
            ojb            = datareader["Money"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Money = (decimal)ojb;
            }
            ojb = datareader["DemoCost"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.DemoCost = (decimal)ojb;
            }
            model.ContractNo = datareader["ContractNo"].ToString();
            ojb = datareader["Incometime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Incometime = (DateTime)ojb;
            }
            model.EmpName = datareader["EmpName"].ToString();
            ojb           = datareader["Deductap"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Deductap = (decimal)ojb;
            }
            model.OperPerson = datareader["OperPerson"].ToString();
            model.IsBank     = datareader["IsBank"].ToString();
            ojb = datareader["InvoiceMoney"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.InvoiceMoney = (decimal)ojb;
            }
            ojb = datareader["BreakMoney"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.BreakMoney = (decimal)ojb;
            }
            model.Remark = datareader["Remark"].ToString();
            model.Type   = datareader["Type"].ToString();
            return(model);
        }
Beispiel #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.Income_Model model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Stale_Income(");
            strSql.Append("Party,B,DemoName,Money,DemoCost,ContractNo,Incometime,EmpName,Deductap,OperPerson,IsBank,InvoiceMoney,BreakMoney,Remark,Type)");
            strSql.Append(" values (");
            strSql.Append("@Party,@B,@DemoName,@Money,@DemoCost,@ContractNo,@Incometime,@EmpName,@Deductap,@OperPerson,@IsBank,@InvoiceMoney,@BreakMoney,@Remark,@Type)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Party",        SqlDbType.NVarChar,  100),
                new SqlParameter("@B",            SqlDbType.NVarChar,  100),
                new SqlParameter("@DemoName",     SqlDbType.NVarChar,  100),
                new SqlParameter("@Money",        SqlDbType.Decimal,     9),
                new SqlParameter("@DemoCost",     SqlDbType.Decimal,     9),
                new SqlParameter("@ContractNo",   SqlDbType.NVarChar,  100),
                new SqlParameter("@Incometime",   SqlDbType.DateTime),
                new SqlParameter("@EmpName",      SqlDbType.NVarChar,   50),
                new SqlParameter("@Deductap",     SqlDbType.Decimal,     9),
                new SqlParameter("@OperPerson",   SqlDbType.NVarChar,   50),
                new SqlParameter("@IsBank",       SqlDbType.NVarChar,   50),
                new SqlParameter("@InvoiceMoney", SqlDbType.Decimal,     9),
                new SqlParameter("@BreakMoney",   SqlDbType.Decimal,     9),
                new SqlParameter("@Remark",       SqlDbType.NVarChar,  200),
                new SqlParameter("@Type",         SqlDbType.NVarChar, 50)
            };
            parameters[0].Value  = model.Party;
            parameters[1].Value  = model.B;
            parameters[2].Value  = model.DemoName;
            parameters[3].Value  = model.Money;
            parameters[4].Value  = model.DemoCost;
            parameters[5].Value  = model.ContractNo;
            parameters[6].Value  = model.Incometime;
            parameters[7].Value  = model.EmpName;
            parameters[8].Value  = model.Deductap;
            parameters[9].Value  = model.OperPerson;
            parameters[10].Value = model.IsBank;
            parameters[11].Value = model.InvoiceMoney;
            parameters[12].Value = model.BreakMoney;
            parameters[13].Value = model.Remark;
            parameters[14].Value = model.Type;

            return(DbHelperSQL.ExecuteCommand(strSql.ToString(), parameters));
        }
Beispiel #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(Model.Income_Model model)
 {
     return(dal.Update(model));
 }
Beispiel #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Model.Income_Model model)
 {
     return(dal.Add(model));
 }
Beispiel #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Income_Model GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

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

            Model.Income_Model model = new Model.Income_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.Party    = dt.Rows[0]["Party"].ToString();
                model.B        = dt.Rows[0]["B"].ToString();
                model.DemoName = dt.Rows[0]["DemoName"].ToString();
                if (dt.Rows[0]["Money"].ToString() != "")
                {
                    model.Money = decimal.Parse(dt.Rows[0]["Money"].ToString());
                }
                if (dt.Rows[0]["DemoCost"].ToString() != "")
                {
                    model.DemoCost = decimal.Parse(dt.Rows[0]["DemoCost"].ToString());
                }
                model.ContractNo = dt.Rows[0]["ContractNo"].ToString();
                if (dt.Rows[0]["Incometime"].ToString() != "")
                {
                    model.Incometime = DateTime.Parse(dt.Rows[0]["Incometime"].ToString());
                }
                model.EmpName = dt.Rows[0]["EmpName"].ToString();
                if (dt.Rows[0]["Deductap"].ToString() != "")
                {
                    model.Deductap = decimal.Parse(dt.Rows[0]["Deductap"].ToString());
                }
                model.OperPerson = dt.Rows[0]["OperPerson"].ToString();
                model.IsBank     = dt.Rows[0]["IsBank"].ToString();
                if (dt.Rows[0]["InvoiceMoney"].ToString() != "")
                {
                    model.InvoiceMoney = decimal.Parse(dt.Rows[0]["InvoiceMoney"].ToString());
                }
                if (dt.Rows[0]["BreakMoney"].ToString() != "")
                {
                    model.BreakMoney = decimal.Parse(dt.Rows[0]["BreakMoney"].ToString());
                }
                model.Remark = dt.Rows[0]["Remark"].ToString();
                model.Type   = dt.Rows[0]["Type"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }