예제 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BookShop.Model.ShipSheet model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ShipSheet set ");
            strSql.Append("shipDate=@shipDate,");
            strSql.Append("companyNo=@companyNo,");
            strSql.Append("invoiceNo=@invoiceNo");
            strSql.Append(" where shipNo=@shipNo and orderNo=@orderNo ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@shipDate",  SqlDbType.DateTime),
                new SqlParameter("@companyNo", SqlDbType.Char,      12),
                new SqlParameter("@invoiceNo", SqlDbType.NChar,     10),
                new SqlParameter("@shipNo",    SqlDbType.Char,      12),
                new SqlParameter("@orderNo",   SqlDbType.Char, 15)
            };
            parameters[0].Value = model.shipDate;
            parameters[1].Value = model.companyNo;
            parameters[2].Value = model.invoiceNo;
            parameters[3].Value = model.shipNo;
            parameters[4].Value = model.orderNo;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(BookShop.Model.ShipSheet model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ShipSheet(");
            strSql.Append("shipNo,orderNo,shipDate,companyNo,invoiceNo)");
            strSql.Append(" values (");
            strSql.Append("@shipNo,@orderNo,@shipDate,@companyNo,@invoiceNo)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@shipNo",    SqlDbType.Char,      12),
                new SqlParameter("@orderNo",   SqlDbType.Char,      15),
                new SqlParameter("@shipDate",  SqlDbType.DateTime),
                new SqlParameter("@companyNo", SqlDbType.Char,      12),
                new SqlParameter("@invoiceNo", SqlDbType.NChar, 10)
            };
            parameters[0].Value = model.shipNo;
            parameters[1].Value = model.orderNo;
            parameters[2].Value = model.shipDate;
            parameters[3].Value = model.companyNo;
            parameters[4].Value = model.invoiceNo;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public BookShop.Model.ShipSheet DataRowToModel(DataRow row)
 {
     BookShop.Model.ShipSheet model = new BookShop.Model.ShipSheet();
     if (row != null)
     {
         if (row["shipNo"] != null)
         {
             model.shipNo = row["shipNo"].ToString();
         }
         if (row["orderNo"] != null)
         {
             model.orderNo = row["orderNo"].ToString();
         }
         if (row["shipDate"] != null && row["shipDate"].ToString() != "")
         {
             model.shipDate = DateTime.Parse(row["shipDate"].ToString());
         }
         if (row["companyNo"] != null)
         {
             model.companyNo = row["companyNo"].ToString();
         }
         if (row["invoiceNo"] != null)
         {
             model.invoiceNo = row["invoiceNo"].ToString();
         }
     }
     return(model);
 }
예제 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BookShop.Model.ShipSheet GetModel(string shipNo, string orderNo)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 shipNo,orderNo,shipDate,companyNo,invoiceNo from ShipSheet ");
            strSql.Append(" where shipNo=@shipNo and orderNo=@orderNo ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@shipNo",  SqlDbType.Char, 12),
                new SqlParameter("@orderNo", SqlDbType.Char, 15)
            };
            parameters[0].Value = shipNo;
            parameters[1].Value = orderNo;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #5
0
 private void ShowInfo(string shipNo, string orderNo)
 {
     BookShop.BLL.ShipSheet   bll   = new BookShop.BLL.ShipSheet();
     BookShop.Model.ShipSheet model = bll.GetModel(shipNo, orderNo);
     this.lblshipNo.Text    = model.shipNo;
     this.lblorderNo.Text   = model.orderNo;
     this.lblshipDate.Text  = model.shipDate.ToString();
     this.lblcompanyNo.Text = model.companyNo;
     this.lblinvoiceNo.Text = model.invoiceNo;
 }
예제 #6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtshipNo.Text.Trim().Length == 0)
            {
                strErr += "shipNo不能为空!\\n";
            }
            if (this.txtorderNo.Text.Trim().Length == 0)
            {
                strErr += "orderNo不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtshipDate.Text))
            {
                strErr += "shipDate格式错误!\\n";
            }
            if (this.txtcompanyNo.Text.Trim().Length == 0)
            {
                strErr += "companyNo不能为空!\\n";
            }
            if (this.txtinvoiceNo.Text.Trim().Length == 0)
            {
                strErr += "invoiceNo不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string   shipNo    = this.txtshipNo.Text;
            string   orderNo   = this.txtorderNo.Text;
            DateTime shipDate  = DateTime.Parse(this.txtshipDate.Text);
            string   companyNo = this.txtcompanyNo.Text;
            string   invoiceNo = this.txtinvoiceNo.Text;

            BookShop.Model.ShipSheet model = new BookShop.Model.ShipSheet();
            model.shipNo    = shipNo;
            model.orderNo   = orderNo;
            model.shipDate  = shipDate;
            model.companyNo = companyNo;
            model.invoiceNo = invoiceNo;

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