Пример #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MyERP.Model.SYS_SYSCS model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SYS_SYSCS(");
            strSql.Append("COMPANY_CODE,COMPANY_NAME,FullName,Address,Phone,Email,Fax,SHDCNT,ITEM_CODE_LENGTH,Billasstock,MAYLH,ServiceTelphone,CREATE_NAME,CREATE_DATE,REMARK)");
            strSql.Append(" values (");
            strSql.Append("@COMPANY_CODE,@COMPANY_NAME,@FullName,@Address,@Phone,@Email,@Fax,@SHDCNT,@ITEM_CODE_LENGTH,@Billasstock,@MAYLH,@ServiceTelphone,@CREATE_NAME,@CREATE_DATE,@REMARK)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@COMPANY_CODE",     SqlDbType.VarChar,   50),
                new SqlParameter("@COMPANY_NAME",     SqlDbType.VarChar,   50),
                new SqlParameter("@FullName",         SqlDbType.NVarChar,  80),
                new SqlParameter("@Address",          SqlDbType.VarChar,  200),
                new SqlParameter("@Phone",            SqlDbType.NVarChar,  50),
                new SqlParameter("@Email",            SqlDbType.NVarChar,  50),
                new SqlParameter("@Fax",              SqlDbType.NVarChar,  50),
                new SqlParameter("@SHDCNT",           SqlDbType.Int,        4),
                new SqlParameter("@ITEM_CODE_LENGTH", SqlDbType.VarChar,   50),
                new SqlParameter("@Billasstock",      SqlDbType.Bit,        1),
                new SqlParameter("@MAYLH",            SqlDbType.NVarChar,   1),
                new SqlParameter("@ServiceTelphone",  SqlDbType.VarChar,   50),
                new SqlParameter("@CREATE_NAME",      SqlDbType.NVarChar,  50),
                new SqlParameter("@CREATE_DATE",      SqlDbType.NVarChar,  50),
                new SqlParameter("@REMARK",           SqlDbType.NVarChar, 50)
            };
            parameters[0].Value  = model.COMPANY_CODE;
            parameters[1].Value  = model.COMPANY_NAME;
            parameters[2].Value  = model.FullName;
            parameters[3].Value  = model.Address;
            parameters[4].Value  = model.Phone;
            parameters[5].Value  = model.Email;
            parameters[6].Value  = model.Fax;
            parameters[7].Value  = model.SHDCNT;
            parameters[8].Value  = model.ITEM_CODE_LENGTH;
            parameters[9].Value  = model.Billasstock;
            parameters[10].Value = model.MAYLH;
            parameters[11].Value = model.ServiceTelphone;
            parameters[12].Value = model.CREATE_NAME;
            parameters[13].Value = model.CREATE_DATE;
            parameters[14].Value = model.REMARK;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
 private void ShowInfo()
 {
     MyERP.BLL.SYS_SYSCS   bll   = new MyERP.BLL.SYS_SYSCS();
     MyERP.Model.SYS_SYSCS model = bll.GetModel();
     this.lblCOMPANY_CODE.Text     = model.COMPANY_CODE;
     this.lblCOMPANY_NAME.Text     = model.COMPANY_NAME;
     this.lblFullName.Text         = model.FullName;
     this.lblAddress.Text          = model.Address;
     this.lblPhone.Text            = model.Phone;
     this.lblEmail.Text            = model.Email;
     this.lblFax.Text              = model.Fax;
     this.lblSHDCNT.Text           = model.SHDCNT.ToString();
     this.lblITEM_CODE_LENGTH.Text = model.ITEM_CODE_LENGTH;
     this.lblBillasstock.Text      = model.Billasstock?"是":"否";
     this.lblMAYLH.Text            = model.MAYLH;
     this.lblServiceTelphone.Text  = model.ServiceTelphone;
     this.lblCREATE_NAME.Text      = model.CREATE_NAME;
     this.lblCREATE_DATE.Text      = model.CREATE_DATE;
     this.lblREMARK.Text           = model.REMARK;
 }
Пример #3
0
 private void ShowInfo()
 {
     MyERP.BLL.SYS_SYSCS   bll   = new MyERP.BLL.SYS_SYSCS();
     MyERP.Model.SYS_SYSCS model = bll.GetModel();
     this.txtCOMPANY_CODE.Text     = model.COMPANY_CODE;
     this.txtCOMPANY_NAME.Text     = model.COMPANY_NAME;
     this.txtFullName.Text         = model.FullName;
     this.txtAddress.Text          = model.Address;
     this.txtPhone.Text            = model.Phone;
     this.txtEmail.Text            = model.Email;
     this.txtFax.Text              = model.Fax;
     this.txtSHDCNT.Text           = model.SHDCNT.ToString();
     this.txtITEM_CODE_LENGTH.Text = model.ITEM_CODE_LENGTH;
     this.chkBillasstock.Checked   = model.Billasstock;
     this.txtMAYLH.Text            = model.MAYLH;
     this.txtServiceTelphone.Text  = model.ServiceTelphone;
     this.txtCREATE_NAME.Text      = model.CREATE_NAME;
     this.txtCREATE_DATE.Text      = model.CREATE_DATE;
     this.txtREMARK.Text           = model.REMARK;
 }
Пример #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MyERP.Model.SYS_SYSCS GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 COMPANY_CODE,COMPANY_NAME,FullName,Address,Phone,Email,Fax,SHDCNT,ITEM_CODE_LENGTH,Billasstock,MAYLH,ServiceTelphone,CREATE_NAME,CREATE_DATE,REMARK from SYS_SYSCS ");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
            };

            MyERP.Model.SYS_SYSCS model = new MyERP.Model.SYS_SYSCS();
            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
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtCOMPANY_CODE.Text.Trim().Length == 0)
            {
                strErr += "COMPANY_CODE不能为空!\\n";
            }
            if (this.txtCOMPANY_NAME.Text.Trim().Length == 0)
            {
                strErr += "COMPANY_NAME不能为空!\\n";
            }
            if (this.txtFullName.Text.Trim().Length == 0)
            {
                strErr += "FullName不能为空!\\n";
            }
            if (this.txtAddress.Text.Trim().Length == 0)
            {
                strErr += "Address不能为空!\\n";
            }
            if (this.txtPhone.Text.Trim().Length == 0)
            {
                strErr += "Phone不能为空!\\n";
            }
            if (this.txtEmail.Text.Trim().Length == 0)
            {
                strErr += "Email不能为空!\\n";
            }
            if (this.txtFax.Text.Trim().Length == 0)
            {
                strErr += "Fax不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtSHDCNT.Text))
            {
                strErr += "SHDCNT格式错误!\\n";
            }
            if (this.txtITEM_CODE_LENGTH.Text.Trim().Length == 0)
            {
                strErr += "ITEM_CODE_LENGTH不能为空!\\n";
            }
            if (this.txtMAYLH.Text.Trim().Length == 0)
            {
                strErr += "MAYLH不能为空!\\n";
            }
            if (this.txtServiceTelphone.Text.Trim().Length == 0)
            {
                strErr += "ServiceTelphone不能为空!\\n";
            }
            if (this.txtCREATE_NAME.Text.Trim().Length == 0)
            {
                strErr += "CREATE_NAME不能为空!\\n";
            }
            if (this.txtCREATE_DATE.Text.Trim().Length == 0)
            {
                strErr += "CREATE_DATE不能为空!\\n";
            }
            if (this.txtREMARK.Text.Trim().Length == 0)
            {
                strErr += "REMARK不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string COMPANY_CODE     = this.txtCOMPANY_CODE.Text;
            string COMPANY_NAME     = this.txtCOMPANY_NAME.Text;
            string FullName         = this.txtFullName.Text;
            string Address          = this.txtAddress.Text;
            string Phone            = this.txtPhone.Text;
            string Email            = this.txtEmail.Text;
            string Fax              = this.txtFax.Text;
            int    SHDCNT           = int.Parse(this.txtSHDCNT.Text);
            string ITEM_CODE_LENGTH = this.txtITEM_CODE_LENGTH.Text;
            bool   Billasstock      = this.chkBillasstock.Checked;
            string MAYLH            = this.txtMAYLH.Text;
            string ServiceTelphone  = this.txtServiceTelphone.Text;
            string CREATE_NAME      = this.txtCREATE_NAME.Text;
            string CREATE_DATE      = this.txtCREATE_DATE.Text;
            string REMARK           = this.txtREMARK.Text;

            MyERP.Model.SYS_SYSCS model = new MyERP.Model.SYS_SYSCS();
            model.COMPANY_CODE     = COMPANY_CODE;
            model.COMPANY_NAME     = COMPANY_NAME;
            model.FullName         = FullName;
            model.Address          = Address;
            model.Phone            = Phone;
            model.Email            = Email;
            model.Fax              = Fax;
            model.SHDCNT           = SHDCNT;
            model.ITEM_CODE_LENGTH = ITEM_CODE_LENGTH;
            model.Billasstock      = Billasstock;
            model.MAYLH            = MAYLH;
            model.ServiceTelphone  = ServiceTelphone;
            model.CREATE_NAME      = CREATE_NAME;
            model.CREATE_DATE      = CREATE_DATE;
            model.REMARK           = REMARK;

            MyERP.BLL.SYS_SYSCS bll = new MyERP.BLL.SYS_SYSCS();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Пример #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MyERP.Model.SYS_SYSCS model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SYS_SYSCS set ");
            strSql.Append("COMPANY_CODE=@COMPANY_CODE,");
            strSql.Append("COMPANY_NAME=@COMPANY_NAME,");
            strSql.Append("FullName=@FullName,");
            strSql.Append("Address=@Address,");
            strSql.Append("Phone=@Phone,");
            strSql.Append("Email=@Email,");
            strSql.Append("Fax=@Fax,");
            strSql.Append("SHDCNT=@SHDCNT,");
            strSql.Append("ITEM_CODE_LENGTH=@ITEM_CODE_LENGTH,");
            strSql.Append("Billasstock=@Billasstock,");
            strSql.Append("MAYLH=@MAYLH,");
            strSql.Append("ServiceTelphone=@ServiceTelphone,");
            strSql.Append("CREATE_NAME=@CREATE_NAME,");
            strSql.Append("CREATE_DATE=@CREATE_DATE,");
            strSql.Append("REMARK=@REMARK");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@COMPANY_CODE",     SqlDbType.VarChar,   50),
                new SqlParameter("@COMPANY_NAME",     SqlDbType.VarChar,   50),
                new SqlParameter("@FullName",         SqlDbType.NVarChar,  80),
                new SqlParameter("@Address",          SqlDbType.VarChar,  200),
                new SqlParameter("@Phone",            SqlDbType.NVarChar,  50),
                new SqlParameter("@Email",            SqlDbType.NVarChar,  50),
                new SqlParameter("@Fax",              SqlDbType.NVarChar,  50),
                new SqlParameter("@SHDCNT",           SqlDbType.Int,        4),
                new SqlParameter("@ITEM_CODE_LENGTH", SqlDbType.VarChar,   50),
                new SqlParameter("@Billasstock",      SqlDbType.Bit,        1),
                new SqlParameter("@MAYLH",            SqlDbType.NVarChar,   1),
                new SqlParameter("@ServiceTelphone",  SqlDbType.VarChar,   50),
                new SqlParameter("@CREATE_NAME",      SqlDbType.NVarChar,  50),
                new SqlParameter("@CREATE_DATE",      SqlDbType.NVarChar,  50),
                new SqlParameter("@REMARK",           SqlDbType.NVarChar, 50)
            };
            parameters[0].Value  = model.COMPANY_CODE;
            parameters[1].Value  = model.COMPANY_NAME;
            parameters[2].Value  = model.FullName;
            parameters[3].Value  = model.Address;
            parameters[4].Value  = model.Phone;
            parameters[5].Value  = model.Email;
            parameters[6].Value  = model.Fax;
            parameters[7].Value  = model.SHDCNT;
            parameters[8].Value  = model.ITEM_CODE_LENGTH;
            parameters[9].Value  = model.Billasstock;
            parameters[10].Value = model.MAYLH;
            parameters[11].Value = model.ServiceTelphone;
            parameters[12].Value = model.CREATE_NAME;
            parameters[13].Value = model.CREATE_DATE;
            parameters[14].Value = model.REMARK;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #7
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MyERP.Model.SYS_SYSCS DataRowToModel(DataRow row)
 {
     MyERP.Model.SYS_SYSCS model = new MyERP.Model.SYS_SYSCS();
     if (row != null)
     {
         if (row["COMPANY_CODE"] != null)
         {
             model.COMPANY_CODE = row["COMPANY_CODE"].ToString();
         }
         if (row["COMPANY_NAME"] != null)
         {
             model.COMPANY_NAME = row["COMPANY_NAME"].ToString();
         }
         if (row["FullName"] != null)
         {
             model.FullName = row["FullName"].ToString();
         }
         if (row["Address"] != null)
         {
             model.Address = row["Address"].ToString();
         }
         if (row["Phone"] != null)
         {
             model.Phone = row["Phone"].ToString();
         }
         if (row["Email"] != null)
         {
             model.Email = row["Email"].ToString();
         }
         if (row["Fax"] != null)
         {
             model.Fax = row["Fax"].ToString();
         }
         if (row["SHDCNT"] != null && row["SHDCNT"].ToString() != "")
         {
             model.SHDCNT = int.Parse(row["SHDCNT"].ToString());
         }
         if (row["ITEM_CODE_LENGTH"] != null)
         {
             model.ITEM_CODE_LENGTH = row["ITEM_CODE_LENGTH"].ToString();
         }
         if (row["Billasstock"] != null && row["Billasstock"].ToString() != "")
         {
             if ((row["Billasstock"].ToString() == "1") || (row["Billasstock"].ToString().ToLower() == "true"))
             {
                 model.Billasstock = true;
             }
             else
             {
                 model.Billasstock = false;
             }
         }
         if (row["MAYLH"] != null)
         {
             model.MAYLH = row["MAYLH"].ToString();
         }
         if (row["ServiceTelphone"] != null)
         {
             model.ServiceTelphone = row["ServiceTelphone"].ToString();
         }
         if (row["CREATE_NAME"] != null)
         {
             model.CREATE_NAME = row["CREATE_NAME"].ToString();
         }
         if (row["CREATE_DATE"] != null)
         {
             model.CREATE_DATE = row["CREATE_DATE"].ToString();
         }
         if (row["REMARK"] != null)
         {
             model.REMARK = row["REMARK"].ToString();
         }
     }
     return(model);
 }