protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { #region 是否有删除功能 if (Session["currentUserId"] != null) { VAN_OA.Dal.TB_AdminDeleteService deleteSer = new VAN_OA.Dal.TB_AdminDeleteService(); if (deleteSer.CheckIsExistByUserId(Convert.ToInt32(Session["currentUserId"])) == false) { gvList.Columns[2].Visible = false; } } #endregion Dal.ReportForms.TB_GuestTrackService guestSer = new VAN_OA.Dal.ReportForms.TB_GuestTrackService(); List <Model.ReportForms.TB_GuestTrack> guestList = guestSer.GetGuestList(""); guestList.Insert(0, new VAN_OA.Model.ReportForms.TB_GuestTrack()); ddlGuestName.DataValueField = "GuestName"; ddlGuestName.DataTextField = "GuestName"; ddlGuestName.DataSource = guestList; ddlGuestName.DataBind(); List <tb_QuotePrice> quotePriceList = new List <tb_QuotePrice>(); this.gvList.DataSource = quotePriceList; this.gvList.DataBind(); } }
protected void txtGuestName_SelectedIndexChanged(object sender, EventArgs e) { Dal.ReportForms.TB_GuestTrackService guestSer = new VAN_OA.Dal.ReportForms.TB_GuestTrackService(); List <VAN_OA.Model.ReportForms.TB_GuestTrack> guestList = guestSer.GetListArray(string.Format(" GuestName='{0}'", txtGuestName.Text)); if (guestList.Count > 0) { lblGuestNo.Text = guestList[0].GuestId.ToString(); txtResultGuestNo.Text = guestList[0].GuestId.ToString(); txtContactPerToInv.Text = guestList[0].LikeMan; lbltelToInv.Text = guestList[0].Phone; txtAddressToInv.Text = guestList[0].GuestAddress; txtAddressTofa.Text = guestList[0].GuestAddress; } }
private void TextChange() { VAN_OA.Dal.ReportForms.TB_GuestTrackService guestTrackSer = new VAN_OA.Dal.ReportForms.TB_GuestTrackService(); StringBuilder strSql = new StringBuilder(); int month = DateTime.Now.Month; int year = DateTime.Now.Year; if (1 <= month && month <= 3) { strSql.Append(string.Format(" and QuartNo='1' and YearNo='{0}' ", year)); } else if (4 <= month && month <= 6) { strSql.Append(string.Format(" and QuartNo='2' and YearNo='{0}' ", year)); } else if (7 <= month && month <= 9) { strSql.Append(string.Format(" and QuartNo='3' and YearNo='{0}' ", year)); } else if (10 <= month && month <= 12) { strSql.Append(string.Format(" and QuartNo='4' and YearNo='{0}' ", year)); } List <VAN_OA.Model.ReportForms.TB_GuestTrack> guestTrackLists = guestTrackSer.GetListArray(string.Format(" GuestName= '{0}' " + strSql.ToString(), txtGuestName.Text)); if (guestTrackLists.Count > 0) { var obj = guestTrackLists[0]; lblGuestNo.Text = obj.GuestId; txtContactPerToInv.Text = obj.LikeMan; //联系人 lbltelToInv.Text = obj.Phone; //电话 txtGuestNameToInv.Text = obj.FoxOrEmail; //传真 txtAddressToInv.Text = obj.GuestAddress; //地址 txtInvoHeader.Text = obj.GuestName; //发票抬头 txtInvAddress.Text = obj.GuestAddress; //注册地址=地址 txtInvTel.Text = obj.Phone; //注册电话=电话 lblNaShuiPer.Text = obj.GuestShui; //社会统一信用代码=税号 lblbrandNo.Text = obj.GuestBrandNo; //开户行帐号 txtAddressTofa.Text = obj.GuestAddress; //发票邮寄地址=地址 //txtComBusTel.Text = obj.Phone; //联系人及电话=电话 txtInvContactPer.Text = obj.LikeMan + "," + obj.Phone; //联系人 txtResultGuestName.Text = obj.GuestName; //最终联系人 } }
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>"); } } }
//private string storefolder = @"D:\PDFConverter\"; protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { try { converter = new RemoteConverter(); if (Request["type"] != "word") { try { //try to get the remoting-object if (!converter.WordIsAvailable()) { lblMess.Text = "Word 2007 not available on server!"; return; } } catch { //Remoteserver not available lblMess.Text = "PDFConverter is not running!"; return; } } if (Session["PDFId"] != null) { #region 获取URL名称 tb_QuotePriceService QuotePriSer = new tb_QuotePriceService(); VAN_OA.Model.EFrom.tb_QuotePrice model = QuotePriSer.GetModel(Convert.ToInt32(Session["PDFId"])); //文件名由 “苏州万邦电脑系统有限公司”(报价AE所属单位全称)+“-”+“20161018“(第一次生成的日期)+“天华网络”(客户简称)+“-”+“报价单” VAN_OA.Dal.ReportForms.TB_GuestTrackService guestTrackSer = new VAN_OA.Dal.ReportForms.TB_GuestTrackService(); var simpGuestName = guestTrackSer.GetGuestSimpName(string.Format(" and GuestName='{0}'", model.GuestName)); #endregion string wordUrl = System.Web.HttpContext.Current.Request.MapPath("PDFConverter/"); string otherName = model.ComName + "-" + model.CreateTime.ToString("yyyyMMdd") + "-" + simpGuestName + "" + "-报价单" + model.QuoteNo.Substring(12); string urlName = wordUrl + otherName; try { if (File.Exists(urlName + ".pdf")) { File.Delete(urlName + ".pdf"); } } catch (Exception) { } try { if (File.Exists(urlName + ".doc")) { File.Delete(urlName + ".doc"); } } catch (Exception) { } var modelPath = System.Web.HttpContext.Current.Request.MapPath("WordModel/"); if (model.ComName != "苏州万邦电脑系统有限公司") { modelPath += model.ComName + @"/"; } string modelWordUrl = modelPath + "QP.doc"; if (Request["type"] != "word") { if (model.IsShuiYin && model.IsGaiZhang)//QP2 { modelWordUrl = modelPath + "QP1.doc"; } if (model.IsGaiZhang == false && model.IsShuiYin)//QP1 { modelWordUrl = modelPath + "QP2.doc"; } if (model.IsGaiZhang && model.IsShuiYin == false)//QP1 { modelWordUrl = modelPath + "QP3.doc"; } } string QPNO = ""; string GuidNO = ""; //string url = @"D:\Project\万邦OA\FLY\ReportForms\PDFConverter\201702080285-01-word\201702080285-01.doc"; // string url = converter.PrintPDF(Convert.ToInt32(Session["PDFId"]), out QPNO, out GuidNO, modelWordUrl, wordUrl); if (url != "" && Request["type"] != "word") { //convertPDF(url, QPNO, GuidNO); string sourcefile = url; string outputfile = url.Replace(".doc", ".pdf"); //call the converter method converter.convert(sourcefile, outputfile); urlName += ".pdf"; if (File.Exists(outputfile)) { File.Copy(outputfile, urlName); } List <string> listFJ = new List <string>(); //保存附件路径 List <string> listFJName = new List <string>(); //保存附件名字 listFJ.Add(outputfile); listFJ.Add(urlName); listFJName.Add(GuidNO + ".pdf"); listFJName.Add(otherName + ".pdf"); string time = GuidNO + "-pdf"; var path = Server.MapPath("PDFConverter/" + time + ".rar"); ZipFileMain(listFJ.ToArray(), listFJName.ToArray(), path, 9);//压缩文件 //DownloadFile(Server.UrlEncode(time + ".rar"), path);//下载文件 try { File.Delete(url); } catch (Exception) { } // foreach (var fj in listFJ) { try { File.Delete(fj);//删除已下载文件 } catch (Exception) { } } convertWord(path, listFJ); } else { //创建另一个文件 string guidUrl = wordUrl + GuidNO + ".doc"; urlName += ".doc"; if (File.Exists(guidUrl)) { File.Copy(guidUrl, urlName, true); } List <string> listFJ = new List <string>(); //保存附件路径 List <string> listFJName = new List <string>(); //保存附件名字 listFJ.Add(url); listFJ.Add(urlName); listFJName.Add(GuidNO + ".doc"); listFJName.Add(otherName + ".doc"); string time = GuidNO + "-word"; var path = Server.MapPath("PDFConverter/" + time + ".rar"); ZipFileMain(listFJ.ToArray(), listFJName.ToArray(), path, 9);//压缩文件 //DownloadFile(Server.UrlEncode(time + ".zip"), path);//下载文件 foreach (var fj in listFJ) { try { File.Delete(fj);//删除已下载文件 } catch (Exception) { } } convertWord(path, listFJ); } } } catch (Exception ex) { if (converter == null) { lblMess.Text += "conver -null"; } if (Session["PDFId"] == null) { lblMess.Text += "pdfid-null"; } lblMess.Text += "A:" + ex.ToString() + "111"; ServiceAppSetting.LoggerHander.Invoke(ex.ToString(), "Error"); } } }