protected void btnUpdate_Click(object sender, EventArgs e) { if (this.FormCheck()) { try { string QuoteNo = this.lblQuoteNo.Text; string GuestName = this.txtGuestName.Text; string GuestNo = this.lblGuestNo.Text; DateTime QuoteDate = DateTime.Now; string ResultGuestName = this.txtResultGuestName.Text; string ResultGuestNo = this.txtResultGuestNo.Text; string PayStyle = this.txtPayStyle.Text; string GuestNameToInv = this.txtGuestNameToInv.Text; string ContactPerToInv = this.txtContactPerToInv.Text; string telToInv = this.lbltelToInv.Text; string AddressToInv = this.txtAddressToInv.Text; string InvoHeader = this.txtInvoHeader.Text; string InvContactPer = this.txtInvContactPer.Text; string InvAddress = this.txtInvAddress.Text; string InvTel = this.txtInvTel.Text; string NaShuiPer = this.lblNaShuiPer.Text; string brandNo = this.lblbrandNo.Text; string AddressTofa = this.txtAddressTofa.Text; string BuessName = this.txtBuessName.Text; string BuessEmail = this.txtBuessEmail.Text; string ComTel = this.txtComTel.Text; string ComChuanZhen = this.txtComChuanZhen.Text; string ComBusTel = this.txtComBusTel.Text; string ComName = this.txtComName.Text; string NaShuiNo = this.txtNaShuiNo.Text; string ComBrand = this.txtComBrand.Text; VAN_OA.Model.EFrom.tb_QuotePrice model = new VAN_OA.Model.EFrom.tb_QuotePrice(); model.QuoteNo = QuoteNo; model.GuestName = GuestName; model.GuestNo = GuestNo; model.QuoteDate = QuoteDate; model.ResultGuestName = ResultGuestName; model.ResultGuestNo = ResultGuestNo; model.PayStyle = PayStyle; model.GuestNameToInv = GuestNameToInv; model.ContactPerToInv = ContactPerToInv; model.telToInv = telToInv; model.AddressToInv = AddressToInv; model.InvoHeader = InvoHeader; model.InvContactPer = InvContactPer; model.InvAddress = InvAddress; model.InvTel = InvTel; model.NaShuiPer = NaShuiPer; model.brandNo = brandNo; model.AddressTofa = AddressTofa; model.BuessName = BuessName; model.BuessEmail = BuessEmail; model.ComTel = ComTel; model.ComChuanZhen = ComChuanZhen; model.ComBusTel = ComBusTel; model.ComName = ComName; model.NaShuiNo = NaShuiNo; model.ComBrand = ComBrand; model.Address = lblZhanghao.Text; model.ZLBZ = txtZLBZ.Text; model.YSBJ = txtYSBJ.Text; model.FWBXDJ = txtFWBXDJ.Text; model.JFQ = txtJFQ.Text; model.Remark = txtRemark.Text; model.Id = Convert.ToInt32(base.Request["Id"]); model.IsYH = cbYH.Checked; if (cbYH.Checked) { model.LastYH = Convert.ToDecimal(txtResultYH.Text); } if (rbtnType3.Checked) { model.LaborCost = Convert.ToDecimal(txtLaborCost.Text); model.EngineeringTax = Convert.ToDecimal(txtEngineeringTax.Text); model.LIlv = Convert.ToDecimal(txtXX.Text); model.QPType = 3; } if (rbtnType2.Checked) { model.QPType = 2; } if (rbtnType1.Checked) { model.QPType = 1; } model.IsBrand = cbIsBrand.Checked; model.IsProduct = cbIsProduct.Checked; model.IsRemark = cbRemark.Checked; model.IsGaiZhang = cbIsGaiZhang.Checked; model.IsShuiYin = cbIsShuiYin.Checked; List <tb_QuotePrice_InvDetails> invDetails = Session["DataInvDetails"] as List <tb_QuotePrice_InvDetails>; string InvDetailsIds = ""; if (ViewState["InvDetailsIds"] != null) { InvDetailsIds = ViewState["InvDetailsIds"].ToString(); } VAN_OA.Dal.ReportForms.TB_GuestTrackService guestTrackSer = new VAN_OA.Dal.ReportForms.TB_GuestTrackService(); List <VAN_OA.Model.ReportForms.TB_GuestTrack> guestTrackLists = guestTrackSer.GetGuestListToQuery(string.Format(" and GuestId='{0}'", lblGuestNo.Text)); if (guestTrackLists.Count > 0) { TB_GuestTrack guest = guestTrackLists[0]; //|| txtAE.Text != model.AEName || txtINSIDE.Text != model.INSIDEName if (txtGuestName.Text != guest.GuestName) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('客户信息不存在请重新填写!');</script>"); return; } if (guest.AEName != txtBuessName.Text) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('AE必须和申请人一样!');</script>"); return; } model.GuestId = guest.Id; } else { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('客户信息不存在请重新填写!');</script>"); return; } if (this.QuotePriSer.updateTran(model, invDetails, InvDetailsIds)) { string url = System.Web.HttpContext.Current.Request.MapPath("PDFConverter/") + lblQuoteNo.Text + ".pdf"; url = url.Replace(@"EFrom\", @"ReportForms\"); if (System.IO.File.Exists(url)) { try { System.IO.File.Delete(url); } catch (Exception) { } } url = System.Web.HttpContext.Current.Request.MapPath("PDFConverter/") + lblQuoteNo.Text + ".doc"; url = url.Replace(@"EFrom\", @"ReportForms\"); if (System.IO.File.Exists(url)) { try { System.IO.File.Delete(url); } catch (Exception) { } } url = System.Web.HttpContext.Current.Request.MapPath("PDFConverter/") + lblQuoteNo.Text + "-word.rar"; url = url.Replace(@"EFrom\", @"ReportForms\"); if (System.IO.File.Exists(url)) { try { System.IO.File.Delete(url); } catch (Exception) { } } url = System.Web.HttpContext.Current.Request.MapPath("PDFConverter/") + lblQuoteNo.Text + "-pdf.rar"; url = url.Replace(@"EFrom\", @"ReportForms\"); if (System.IO.File.Exists(url)) { try { System.IO.File.Delete(url); } catch (Exception) { } } base.Response.Redirect(Session["POUrl"].ToString() + "?QuoteNo=" + model.QuoteNo); } else { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('修改失败!');</script>"); } } catch (Exception ex) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('" + ex.Message + "!');</script>"); } } }
protected void btnAdd_Click(object sender, EventArgs e) { if (this.FormCheck()) { try { string QuoteNo = this.lblQuoteNo.Text; string GuestName = txtGuestName.Text; string GuestNo = this.lblGuestNo.Text; DateTime QuoteDate = DateTime.Now; string ResultGuestName = this.txtResultGuestName.Text; string ResultGuestNo = this.txtResultGuestNo.Text; string PayStyle = this.txtPayStyle.Text; string GuestNameToInv = this.txtGuestNameToInv.Text; string ContactPerToInv = this.txtContactPerToInv.Text; string telToInv = this.lbltelToInv.Text; string AddressToInv = this.txtAddressToInv.Text; string InvoHeader = this.txtInvoHeader.Text; string InvContactPer = this.txtInvContactPer.Text; string InvAddress = this.txtInvAddress.Text; string InvTel = this.txtInvTel.Text; string NaShuiPer = this.lblNaShuiPer.Text; string brandNo = this.lblbrandNo.Text; string AddressTofa = this.txtAddressTofa.Text; string BuessName = this.txtBuessName.Text; string BuessEmail = this.txtBuessEmail.Text; string ComTel = this.txtComTel.Text; string ComChuanZhen = this.txtComChuanZhen.Text; string ComBusTel = this.txtComBusTel.Text; string ComName = this.txtComName.Text; string NaShuiNo = this.txtNaShuiNo.Text; string ComBrand = this.txtComBrand.Text; VAN_OA.Model.EFrom.tb_QuotePrice model = new VAN_OA.Model.EFrom.tb_QuotePrice(); model.QuoteNo = QuoteNo; model.GuestName = GuestName; model.GuestNo = GuestNo; model.QuoteDate = QuoteDate; model.ResultGuestName = ResultGuestName; model.ResultGuestNo = ResultGuestNo; model.PayStyle = PayStyle; model.GuestNameToInv = GuestNameToInv; model.ContactPerToInv = ContactPerToInv; model.telToInv = telToInv; model.AddressToInv = AddressToInv; model.InvoHeader = InvoHeader; model.InvContactPer = InvContactPer; model.InvAddress = InvAddress; model.InvTel = InvTel; model.NaShuiPer = NaShuiPer; model.brandNo = brandNo; model.AddressTofa = AddressTofa; model.BuessName = BuessName; model.BuessEmail = BuessEmail; model.ComTel = ComTel; model.ComChuanZhen = ComChuanZhen; model.ComBusTel = ComBusTel; model.ComName = ComName; model.NaShuiNo = NaShuiNo; model.ComBrand = ComBrand; model.CreateTime = DateTime.Now; model.CreateUser = Convert.ToInt32(Session["currentUserId"]); model.ComBrand = ComBrand; model.Address = lblZhanghao.Text; model.ZLBZ = txtZLBZ.Text; model.YSBJ = txtYSBJ.Text; model.FWBXDJ = txtFWBXDJ.Text; model.JFQ = txtJFQ.Text; model.Remark = txtRemark.Text; model.IsYH = cbYH.Checked; if (cbYH.Checked) { model.LastYH = Convert.ToDecimal(txtResultYH.Text); } List <tb_QuotePrice_InvDetails> invDetails = Session["DataInvDetails"] as List <tb_QuotePrice_InvDetails>; if (rbtnType3.Checked) { model.LaborCost = Convert.ToDecimal(txtLaborCost.Text); model.EngineeringTax = Convert.ToDecimal(txtEngineeringTax.Text); model.LIlv = Convert.ToDecimal(txtXX.Text); model.QPType = 3; //YY=设备材料价格+人工费 txtRenGJS.Text = (invDetails.Sum(t => t.Total) + Convert.ToDecimal(txtLaborCost.Text)).ToString(); } if (rbtnType2.Checked) { model.QPType = 2; } if (rbtnType1.Checked) { model.QPType = 1; } model.IsBrand = cbIsBrand.Checked; model.IsProduct = cbIsProduct.Checked; model.IsRemark = cbRemark.Checked; model.IsGaiZhang = cbIsGaiZhang.Checked; model.IsShuiYin = cbIsShuiYin.Checked; VAN_OA.Dal.ReportForms.TB_GuestTrackService guestTrackSer = new VAN_OA.Dal.ReportForms.TB_GuestTrackService(); List <VAN_OA.Model.ReportForms.TB_GuestTrack> guestTrackLists = guestTrackSer.GetGuestListToQuery(string.Format(" and GuestId='{0}'", lblGuestNo.Text)); if (guestTrackLists.Count > 0) { TB_GuestTrack guest = guestTrackLists[0]; //|| txtAE.Text != model.AEName || txtINSIDE.Text != model.INSIDEName if (txtGuestName.Text != guest.GuestName) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('客户信息不存在请重新填写!');</script>"); return; } if (guest.AEName != txtBuessName.Text) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('AE必须和申请人一样!');</script>"); return; } model.GuestId = guest.Id; } else { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('客户信息不存在请重新填写!');</script>"); return; } if (this.QuotePriSer.addTran(model, invDetails) > 0) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('添加成功!');</script>"); base.Response.Redirect(Session["POUrl"].ToString() + "?QuoteNo=" + model.QuoteNo); } else { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('添加失败!');</script>"); } } catch (Exception ex) { base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('" + ex.Message + "!');</script>"); } } }