コード例 #1
0
 private void ShowInfo(int id)
 {
     Jium.BLL.consumer   bll   = new Jium.BLL.consumer();
     Jium.Model.consumer model = bll.GetModel(id);
     //this.lblid.Text=model.id.ToString();
     this.lblcname.Text   = model.cname;
     this.lblccode.Text   = model.ccode;
     this.lblcphone.Text  = model.cphone;
     this.lblcemail.Text  = model.cemail;
     this.lblclevel.Text  = model.clevel;
     this.lblcsum.Text    = model.csum.ToString();
     this.lblcsex.Text    = model.csex.ToString();
     this.lblcremark.Text = model.cremark;
     this.lblcss1.Text    = model.css1;
     //this.lblcss2.Text=model.css2;
     //this.lblcss3.Text=model.css3;
     //this.lblcss4.Text=model.css4;
     //this.lblcss5.Text=model.css5;
     //this.lblcsd1.Text=model.csd1.ToString();
     //this.lblcsd2.Text=model.csd2.ToString();
     //this.lblcsd3.Text=model.csd3.ToString();
     //this.lblcsd4.Text=model.csd4.ToString();
     //this.lblcsd5.Text=model.csd5.ToString();
     //this.lblcsdc1.Text=model.csdc1.ToString();
     //this.lblcsdc2.Text=model.csdc2.ToString();
     //this.lblcsdc3.Text=model.csdc3.ToString();
     //this.lblcsdc4.Text=model.csdc4.ToString();
     //this.lblcsdc5.Text=model.csdc5.ToString();
 }
コード例 #2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtcname.Text.Trim().Length == 0)
            {
                strErr += "cname不能为空!\\n";
            }
            if (this.txtccode.Text.Trim().Length == 0)
            {
                strErr += "ccode不能为空!\\n";
            }
            if (this.txtcphone.Text.Trim().Length == 0)
            {
                strErr += "cphone不能为空!\\n";
            }
            //if (this.txtcemail.Text.Trim().Length == 0)
            //{
            //    strErr += "cemail不能为空!\\n";
            //}
            if (this.txtclevel.Text.Trim().Length == 0)
            {
                strErr += "clevel不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtcsum.Text) && !PageValidate.IsDecimal(txtcsum.Text))
            {
                strErr += "csum格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtcsex.Text))
            {
                strErr += "csex格式错误!\\n";
            }
            if (this.txtcremark.Text.Trim().Length == 0)
            {
                strErr += "cremark不能为空!\\n";
            }

            /*
             *          if(this.txtcss1.Text.Trim().Length==0)
             *          {
             *                  strErr+="css1不能为空!\\n";
             *          }
             *          if(this.txtcss2.Text.Trim().Length==0)
             *          {
             *                  strErr+="css2不能为空!\\n";
             *          }
             *          if(this.txtcss3.Text.Trim().Length==0)
             *          {
             *                  strErr+="css3不能为空!\\n";
             *          }
             *          if(this.txtcss4.Text.Trim().Length==0)
             *          {
             *                  strErr+="css4不能为空!\\n";
             *          }
             *          if(this.txtcss5.Text.Trim().Length==0)
             *          {
             *                  strErr+="css5不能为空!\\n";
             *          }
             *          if(!PageValidate.IsNumber(txtcsd1.Text))
             *          {
             *                  strErr+="csd1格式错误!\\n";
             *          }
             *          if(!PageValidate.IsNumber(txtcsd2.Text))
             *          {
             *                  strErr+="csd2格式错误!\\n";
             *          }
             *          if(!PageValidate.IsNumber(txtcsd3.Text))
             *          {
             *                  strErr+="csd3格式错误!\\n";
             *          }
             *          if(!PageValidate.IsNumber(txtcsd4.Text))
             *          {
             *                  strErr+="csd4格式错误!\\n";
             *          }
             *          if(!PageValidate.IsNumber(txtcsd5.Text))
             *          {
             *                  strErr+="csd5格式错误!\\n";
             *          }
             *          if(!PageValidate.IsDecimal(txtcsdc1.Text))
             *          {
             *                  strErr+="csdc1格式错误!\\n";
             *          }
             *          if(!PageValidate.IsDecimal(txtcsdc2.Text))
             *          {
             *                  strErr+="csdc2格式错误!\\n";
             *          }
             *          if(!PageValidate.IsDecimal(txtcsdc3.Text))
             *          {
             *                  strErr+="csdc3格式错误!\\n";
             *          }
             *          if(!PageValidate.IsDecimal(txtcsdc4.Text))
             *          {
             *                  strErr+="csdc4格式错误!\\n";
             *          }
             *          if(!PageValidate.IsDecimal(txtcsdc5.Text))
             *          {
             *                  strErr+="csdc5格式错误!\\n";
             *          }
             */

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int     id      = int.Parse(this.lblid.Text);
            string  cname   = this.txtcname.Text;
            string  ccode   = this.txtccode.Text;
            string  cphone  = this.txtcphone.Text;
            string  cemail  = this.txtcemail.Text;
            string  clevel  = this.txtclevel.Text;
            decimal csum    = decimal.Parse(this.txtcsum.Text);
            int     csex    = int.Parse(this.txtcsex.Text);
            string  cremark = this.txtcremark.Text;

            //string css1=this.txtcss1.Text;
            //string css2=this.txtcss2.Text;
            //string css3=this.txtcss3.Text;
            //string css4=this.txtcss4.Text;
            //string css5=this.txtcss5.Text;
            //int csd1=int.Parse(this.txtcsd1.Text);
            //int csd2=int.Parse(this.txtcsd2.Text);
            //int csd3=int.Parse(this.txtcsd3.Text);
            //int csd4=int.Parse(this.txtcsd4.Text);
            //int csd5=int.Parse(this.txtcsd5.Text);
            //decimal csdc1=decimal.Parse(this.txtcsdc1.Text);
            //decimal csdc2=decimal.Parse(this.txtcsdc2.Text);
            //decimal csdc3=decimal.Parse(this.txtcsdc3.Text);
            //decimal csdc4=decimal.Parse(this.txtcsdc4.Text);
            //decimal csdc5=decimal.Parse(this.txtcsdc5.Text);

            Jium.BLL.consumer   bll   = new Jium.BLL.consumer();
            Jium.Model.consumer model = bll.GetModel(id);
            if (model == null)
            {
                Maticsoft.Common.MessageBox.Show(this, "顾客 ID 错误");
                return;
            }
            //model.id=id;
            model.cname   = cname;
            model.ccode   = ccode;
            model.cphone  = cphone;
            model.cemail  = cemail;
            model.clevel  = clevel;
            model.csum    = csum;
            model.csex    = csex;
            model.cremark = cremark;
            model.css1    = DateTime.Now.ToString("yyyyMMddHHmmss");
            //model.css2=css2;
            //model.css3=css3;
            //model.css4=css4;
            //model.css5=css5;
            //model.csd1=csd1;
            //model.csd2=csd2;
            //model.csd3=csd3;
            //model.csd4=csd4;
            //model.csd5=csd5;
            //model.csdc1=csdc1;
            //model.csdc2=csdc2;
            //model.csdc3=csdc3;
            //model.csdc4=csdc4;
            //model.csdc5=csdc5;

            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }