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

            strSql.Append("update InvoiceDistributeLog set ");
            strSql.Append("BatchId=@BatchId,");
            strSql.Append("InCode=@InCode,");
            strSql.Append("StartNum=@StartNum,");
            strSql.Append("EndNum=@EndNum,");
            strSql.Append("OperatorID=@OperatorID,");
            strSql.Append("AssignDate=@AssignDate,");
            strSql.Append("AssignOperator=@AssignOperator,");
            strSql.Append("State=@State,");
            strSql.Append("Remark=@Remark");
            strSql.Append(" where DisId=@DisId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BatchId",        SqlDbType.Int,         4),
                new SqlParameter("@InCode",         SqlDbType.VarChar,    50),
                new SqlParameter("@StartNum",       SqlDbType.VarChar,    50),
                new SqlParameter("@EndNum",         SqlDbType.VarChar,    50),
                new SqlParameter("@OperatorID",     SqlDbType.Int,         4),
                new SqlParameter("@AssignDate",     SqlDbType.DateTime),
                new SqlParameter("@AssignOperator", SqlDbType.VarChar,    50),
                new SqlParameter("@State",          SqlDbType.Int,         4),
                new SqlParameter("@Remark",         SqlDbType.VarChar,   200),
                new SqlParameter("@DisId",          SqlDbType.Int, 4)
            };
            parameters[0].Value = model.BatchId;
            parameters[1].Value = model.InCode;
            parameters[2].Value = model.StartNum;
            parameters[3].Value = model.EndNum;
            parameters[4].Value = model.OperatorID;
            parameters[5].Value = model.AssignDate;
            parameters[6].Value = model.AssignOperator;
            parameters[7].Value = model.State;
            parameters[8].Value = model.Remark;
            parameters[9].Value = model.DisId;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
 private void ShowInfo(int DisId)
 {
     WebDemo.BLL.WebDemo.InvoiceDistributeLog   bll   = new WebDemo.BLL.WebDemo.InvoiceDistributeLog();
     WebDemo.Model.WebDemo.InvoiceDistributeLog model = bll.GetModel(DisId);
     this.lblDisId.Text          = model.DisId.ToString();
     this.lblBatchId.Text        = model.BatchId.ToString();
     this.lblInCode.Text         = model.InCode;
     this.lblStartNum.Text       = model.StartNum;
     this.lblEndNum.Text         = model.EndNum;
     this.lblOperatorID.Text     = model.OperatorID.ToString();
     this.lblAssignDate.Text     = model.AssignDate.ToString();
     this.lblAssignOperator.Text = model.AssignOperator;
     this.lblState.Text          = model.State.ToString();
     this.lblRemark.Text         = model.Remark;
 }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WebDemo.Model.WebDemo.InvoiceDistributeLog DataRowToModel(DataRow row)
 {
     WebDemo.Model.WebDemo.InvoiceDistributeLog model = new WebDemo.Model.WebDemo.InvoiceDistributeLog();
     if (row != null)
     {
         if (row["DisId"] != null && row["DisId"].ToString() != "")
         {
             model.DisId = int.Parse(row["DisId"].ToString());
         }
         if (row["BatchId"] != null && row["BatchId"].ToString() != "")
         {
             model.BatchId = int.Parse(row["BatchId"].ToString());
         }
         if (row["InCode"] != null)
         {
             model.InCode = row["InCode"].ToString();
         }
         if (row["StartNum"] != null)
         {
             model.StartNum = row["StartNum"].ToString();
         }
         if (row["EndNum"] != null)
         {
             model.EndNum = row["EndNum"].ToString();
         }
         if (row["OperatorID"] != null && row["OperatorID"].ToString() != "")
         {
             model.OperatorID = int.Parse(row["OperatorID"].ToString());
         }
         if (row["AssignDate"] != null && row["AssignDate"].ToString() != "")
         {
             model.AssignDate = DateTime.Parse(row["AssignDate"].ToString());
         }
         if (row["AssignOperator"] != null)
         {
             model.AssignOperator = row["AssignOperator"].ToString();
         }
         if (row["State"] != null && row["State"].ToString() != "")
         {
             model.State = int.Parse(row["State"].ToString());
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
     }
     return(model);
 }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WebDemo.Model.WebDemo.InvoiceDistributeLog model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into InvoiceDistributeLog(");
            strSql.Append("BatchId,InCode,StartNum,EndNum,OperatorID,AssignDate,AssignOperator,State,Remark)");
            strSql.Append(" values (");
            strSql.Append("@BatchId,@InCode,@StartNum,@EndNum,@OperatorID,@AssignDate,@AssignOperator,@State,@Remark)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BatchId",        SqlDbType.Int,        4),
                new SqlParameter("@InCode",         SqlDbType.VarChar,   50),
                new SqlParameter("@StartNum",       SqlDbType.VarChar,   50),
                new SqlParameter("@EndNum",         SqlDbType.VarChar,   50),
                new SqlParameter("@OperatorID",     SqlDbType.Int,        4),
                new SqlParameter("@AssignDate",     SqlDbType.DateTime),
                new SqlParameter("@AssignOperator", SqlDbType.VarChar,   50),
                new SqlParameter("@State",          SqlDbType.Int,        4),
                new SqlParameter("@Remark",         SqlDbType.VarChar, 200)
            };
            parameters[0].Value = model.BatchId;
            parameters[1].Value = model.InCode;
            parameters[2].Value = model.StartNum;
            parameters[3].Value = model.EndNum;
            parameters[4].Value = model.OperatorID;
            parameters[5].Value = model.AssignDate;
            parameters[6].Value = model.AssignOperator;
            parameters[7].Value = model.State;
            parameters[8].Value = model.Remark;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WebDemo.Model.WebDemo.InvoiceDistributeLog GetModel(int DisId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 DisId,BatchId,InCode,StartNum,EndNum,OperatorID,AssignDate,AssignOperator,State,Remark from InvoiceDistributeLog ");
            strSql.Append(" where DisId=@DisId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DisId", SqlDbType.Int, 4)
            };
            parameters[0].Value = DisId;

            WebDemo.Model.WebDemo.InvoiceDistributeLog model = new WebDemo.Model.WebDemo.InvoiceDistributeLog();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemple #6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtBatchId.Text))
            {
                strErr += "BatchId格式错误!\\n";
            }
            if (this.txtInCode.Text.Trim().Length == 0)
            {
                strErr += "InCode不能为空!\\n";
            }
            if (this.txtStartNum.Text.Trim().Length == 0)
            {
                strErr += "StartNum不能为空!\\n";
            }
            if (this.txtEndNum.Text.Trim().Length == 0)
            {
                strErr += "EndNum不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtOperatorID.Text))
            {
                strErr += "OperatorID格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtAssignDate.Text))
            {
                strErr += "AssignDate格式错误!\\n";
            }
            if (this.txtAssignOperator.Text.Trim().Length == 0)
            {
                strErr += "AssignOperator不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtState.Text))
            {
                strErr += "State格式错误!\\n";
            }
            if (this.txtRemark.Text.Trim().Length == 0)
            {
                strErr += "Remark不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      BatchId        = int.Parse(this.txtBatchId.Text);
            string   InCode         = this.txtInCode.Text;
            string   StartNum       = this.txtStartNum.Text;
            string   EndNum         = this.txtEndNum.Text;
            int      OperatorID     = int.Parse(this.txtOperatorID.Text);
            DateTime AssignDate     = DateTime.Parse(this.txtAssignDate.Text);
            string   AssignOperator = this.txtAssignOperator.Text;
            int      State          = int.Parse(this.txtState.Text);
            string   Remark         = this.txtRemark.Text;

            WebDemo.Model.WebDemo.InvoiceDistributeLog model = new WebDemo.Model.WebDemo.InvoiceDistributeLog();
            model.BatchId        = BatchId;
            model.InCode         = InCode;
            model.StartNum       = StartNum;
            model.EndNum         = EndNum;
            model.OperatorID     = OperatorID;
            model.AssignDate     = AssignDate;
            model.AssignOperator = AssignOperator;
            model.State          = State;
            model.Remark         = Remark;

            WebDemo.BLL.WebDemo.InvoiceDistributeLog bll = new WebDemo.BLL.WebDemo.InvoiceDistributeLog();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }