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.Model.consumer model = new Jium.Model.consumer(); 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=css1; //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; Jium.BLL.consumer bll = new Jium.BLL.consumer(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
protected void btnConfirmSale_Click(object sender, EventArgs e) { try { //#warning 代码生成警告:请检查确认真实主键的名称和类型是否正确 string orderid = DateTime.Now.ToString("yyyyMMddHHmmss"); var lstModel = new List <Jium.Model.piorecord>(); for (int i = 0; i < gridViewBuy.Rows.Count; i++) { var model = new Jium.Model.piorecord(); model.pcode = gridViewBuy.Rows[i].Cells[0].Text; model.pios3 = gridViewBuy.Rows[i].Cells[1].Text; model.psaleprice = decimal.Parse(gridViewBuy.Rows[i].Cells[3].Text); model.pcnt = int.Parse(gridViewBuy.Rows[i].Cells[5].Text); model.pzekou = decimal.Parse(gridViewBuy.Rows[i].Cells[6].Text); model.psalerid = 0; model.ptype = (int)PRODUCT_IO_TYPE.SALE;; model.ptime = orderid; model.pguestid = int.Parse(txtCcode.Text); var txtNum = gridViewBuy.Rows[i].Cells[4].Text.Trim(); model.piod1 = string.IsNullOrWhiteSpace(txtNum.Replace(" ", "")) ? 0 : int.Parse(gridViewBuy.Rows[i].Cells[4].Text); //服务 model.pios4 = gridViewBuy.Rows[i].Cells[2].Text.Replace(" ", ""); //单位 model.piod5 = 5; //model.pios5 = cells[i, 0].StringValue.Trim();//系列 model.pios1 = "销售"; lstModel.Add(model); } ERR_CODE iRes = ERR_CODE.SUCCESS; ///事务回滚机制??? var bllCustomeService = new Jium.BLL.consumerservice(); foreach (var model in lstModel) { if (!Ctrl.piorecord.AddPiorecord(model)) { iRes = ERR_CODE.FAIL; break; } if (model.piod1 > 0)//add service for guset { var consumerservice = new Jium.Model.consumerservice(); consumerservice.ccode = model.pguestid.ToString(); consumerservice.csnum = model.piod1 ?? 0; consumerservice.cstype = model.pios3; consumerservice.csleft = model.piod1 ?? 0; consumerservice.csiostatus = 0; consumerservice.cstime0 = orderid; consumerservice.csd5 = "5"; bllCustomeService.Add(consumerservice); } } //update guest info var consumerBll = new Jium.BLL.consumer(); var lstConsumer = consumerBll.GetModelList(string.Format("ccode='{0}' and csd5=5", txtCcode.Text.Trim())); if (lstConsumer.Count == 0) { ///error ///return; } lstConsumer[0].css1 = orderid; lstConsumer[0].csum += decimal.Parse(txtSumReal.Text); lstConsumer[0].clevel = Jium.BLL.consumer.getLevelByConsume(lstConsumer[0].csum).ToString();//get from csum consumerBll.Update(lstConsumer[0]); Maticsoft.Common.MessageBox.ShowAndRedirects(this, "操作完成!", "/default.aspx"); } catch (Exception ex) { Maticsoft.Common.MessageBox.Show(this, "系统错误:" + ex.Message); return; } }