예제 #1
0
파일: Show.aspx.cs 프로젝트: radtek/EicMcp
 private void ShowInfo(decimal ID_Key)
 {
     Maticsoft.BLL.tb_PrintRecord   bll   = new Maticsoft.BLL.tb_PrintRecord();
     Maticsoft.Model.tb_PrintRecord model = bll.GetModel(ID_Key);
     this.lblSN.Text         = model.SN;
     this.lblStaff.Text      = model.Staff;
     this.lblDataTime.Text   = model.DataTime;
     this.lblLabellMode.Text = model.LabellMode;
     this.lblBatchNo.Text    = model.BatchNo;
     this.lblOrderID.Text    = model.OrderID;
     this.lblID_Key.Text     = model.ID_Key.ToString();
 }
예제 #2
0
파일: Add.aspx.cs 프로젝트: radtek/EicMcp
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtSN.Text.Trim().Length == 0)
            {
                strErr += "SN不能为空!\\n";
            }
            if (this.txtStaff.Text.Trim().Length == 0)
            {
                strErr += "Staff不能为空!\\n";
            }
            if (this.txtDataTime.Text.Trim().Length == 0)
            {
                strErr += "DataTime不能为空!\\n";
            }
            if (this.txtLabellMode.Text.Trim().Length == 0)
            {
                strErr += "LabellMode不能为空!\\n";
            }
            if (this.txtBatchNo.Text.Trim().Length == 0)
            {
                strErr += "BatchNo不能为空!\\n";
            }
            if (this.txtOrderID.Text.Trim().Length == 0)
            {
                strErr += "OrderID不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string SN         = this.txtSN.Text;
            string Staff      = this.txtStaff.Text;
            string DataTime   = this.txtDataTime.Text;
            string LabellMode = this.txtLabellMode.Text;
            string BatchNo    = this.txtBatchNo.Text;
            string OrderID    = this.txtOrderID.Text;

            Maticsoft.Model.tb_PrintRecord model = new Maticsoft.Model.tb_PrintRecord();
            model.SN         = SN;
            model.Staff      = Staff;
            model.DataTime   = DataTime;
            model.LabellMode = LabellMode;
            model.BatchNo    = BatchNo;
            model.OrderID    = OrderID;

            Maticsoft.BLL.tb_PrintRecord bll = new Maticsoft.BLL.tb_PrintRecord();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
예제 #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.tb_PrintRecord model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_PrintRecord set ");
            strSql.Append("Staff=@Staff,");
            strSql.Append("DataTime=@DataTime,");
            strSql.Append("LabellMode=@LabellMode,");
            strSql.Append("BatchNo=@BatchNo,");
            strSql.Append("OrderID=@OrderID");
            strSql.Append(" where ID_Key=@ID_Key");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Staff",      SqlDbType.VarChar, 20),
                new SqlParameter("@DataTime",   SqlDbType.VarChar, 30),
                new SqlParameter("@LabellMode", SqlDbType.VarChar, 30),
                new SqlParameter("@BatchNo",    SqlDbType.VarChar, 30),
                new SqlParameter("@OrderID",    SqlDbType.VarChar, 30),
                new SqlParameter("@SN",         SqlDbType.VarChar, 20),
                new SqlParameter("@ID_Key",     SqlDbType.Decimal, 9)
            };
            parameters[0].Value = model.Staff;
            parameters[1].Value = model.DataTime;
            parameters[2].Value = model.LabellMode;
            parameters[3].Value = model.BatchNo;
            parameters[4].Value = model.OrderID;
            parameters[5].Value = model.SN;
            parameters[6].Value = model.ID_Key;

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

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

            strSql.Append("insert into tb_PrintRecord(");
            strSql.Append("SN,Staff,DataTime,LabellMode,BatchNo,OrderID)");
            strSql.Append(" values (");
            strSql.Append("@SN,@Staff,@DataTime,@LabellMode,@BatchNo,@OrderID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SN",         SqlDbType.VarChar, 20),
                new SqlParameter("@Staff",      SqlDbType.VarChar, 20),
                new SqlParameter("@DataTime",   SqlDbType.VarChar, 30),
                new SqlParameter("@LabellMode", SqlDbType.VarChar, 30),
                new SqlParameter("@BatchNo",    SqlDbType.VarChar, 30),
                new SqlParameter("@OrderID",    SqlDbType.VarChar, 30)
            };
            parameters[0].Value = model.SN;
            parameters[1].Value = model.Staff;
            parameters[2].Value = model.DataTime;
            parameters[3].Value = model.LabellMode;
            parameters[4].Value = model.BatchNo;
            parameters[5].Value = model.OrderID;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToDecimal(obj));
            }
        }
예제 #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.tb_PrintRecord DataRowToModel(DataRow row)
 {
     Maticsoft.Model.tb_PrintRecord model = new Maticsoft.Model.tb_PrintRecord();
     if (row != null)
     {
         if (row["SN"] != null)
         {
             model.SN = row["SN"].ToString();
         }
         if (row["Staff"] != null)
         {
             model.Staff = row["Staff"].ToString();
         }
         if (row["DataTime"] != null)
         {
             model.DataTime = row["DataTime"].ToString();
         }
         if (row["LabellMode"] != null)
         {
             model.LabellMode = row["LabellMode"].ToString();
         }
         if (row["BatchNo"] != null)
         {
             model.BatchNo = row["BatchNo"].ToString();
         }
         if (row["OrderID"] != null)
         {
             model.OrderID = row["OrderID"].ToString();
         }
         if (row["ID_Key"] != null && row["ID_Key"].ToString() != "")
         {
             model.ID_Key = decimal.Parse(row["ID_Key"].ToString());
         }
     }
     return(model);
 }
예제 #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.tb_PrintRecord GetModel(decimal ID_Key)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 SN,Staff,DataTime,LabellMode,BatchNo,OrderID,ID_Key from tb_PrintRecord ");
            strSql.Append(" where ID_Key=@ID_Key");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID_Key", SqlDbType.Decimal)
            };
            parameters[0].Value = ID_Key;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }