protected void btnChangeStatus_Click(object sender, EventArgs e) { SurveyDAL dal = new SurveyDAL(); var survey = dal.GetSurveyById(SVId); AddFollowUp(followUpControl, survey.Status, Utility.GetSelectedText(ddlSurveyStatus)); survey.Status = Utility.GetSelectedText(ddlSurveyStatus); dal.Save(); SetFocus(btnChangeStatus); }
protected void btnUpload_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(fileUploadSurveyImg.FileName)) { string serverFilePath = string.Empty; Utility.UploadFile(fileUploadSurveyImg, "SurveyImage", SourceNo, ref serverFilePath); SurveyDAL dal = new SurveyDAL(); var survey = dal.GetSurveyById(SVId); survey.SurveyImageName = Utility.GetFileName(fileUploadSurveyImg); survey.SurveyImagePath = serverFilePath; dal.Save(); imgSurveyData.ImageUrl = Page.ResolveUrl(serverFilePath); imgSurveyData.AlternateText = Utility.GetFileName(fileUploadSurveyImg); } SetFocus(sender); }
protected void btnSave_Click(object sender, EventArgs e) { string svNo = SVNo; SurveyDAL dal = new SurveyDAL(); var survey = dal.GetSurveyById(SVId); if (!string.IsNullOrEmpty(txtExpectedSurveyDate.Text)) { survey.ExpectedSurveyDate = DateTime.Parse(txtExpectedSurveyDate.Text); } //update survey survey.EnqOrdMan = Utility.GetSelectedText(ddlEnqOrdMan); survey.OnSiteContactName = txtOnsiteContactName.Text; survey.OnSiteContactPhone = txtOnsiteContactPhone.Text; survey.SurveyIntro = txtSurveyIntro.Text; AddFollowUp(followUpControl, survey.Status, Utility.GetSelectedText(ddlSurveyStatus)); survey.Status = Utility.GetSelectedText(ddlSurveyStatus); survey.SurveyMan = Utility.GetSelectedText(ddlSurveyMan); //goods StringBuilder sb = new StringBuilder(); for (int i = 0; i < chklToos.Items.Count; i++) { if (chklToos.Items[i].Selected) { sb.Append(chklToos.Items[i].Text).Append("|"); } } survey.GoodsBring = sb.ToString(); survey.CustomerCompanyName = customerInfoControl.CompanyName; survey.CustomerContactName = customerInfoControl.ContactName; survey.CustomerAddress = customerInfoControl.Address; survey.CustomerEmail = customerInfoControl.Email; survey.CustomerQQ = customerInfoControl.QQ; survey.CustomerPhone1 = customerInfoControl.Phone1; survey.CustomerPhone2 = customerInfoControl.Phone2; survey.CustomerOthers = customerInfoControl.Other; dal.Save(); //save new customer customerInfoControl.Save(); this.SetFocus(sender); }
protected void btnCreateSurvey_Click(object sender, EventArgs e) { //get no SeedDAL sdal = new SeedDAL(); string no = sdal.GetNoByTableName(SysConst.TableSurvey, SysConst.SuffixSuvey); //get enqordman string enqOrdMan = string.Empty; string companyName = string.Empty; string contact = string.Empty; string address = string.Empty; string email = string.Empty; string qq = string.Empty; string phone1 = string.Empty; string phone2 = string.Empty; string other = string.Empty; string surveyIntro = string.Empty; string enqNo = string.Empty; List <LineItem> items = new List <LineItem>(); int sourceId = -1; if (string.Equals(SourceType, SysConst.SourceTypeEnquiry, StringComparison.OrdinalIgnoreCase)) { EnquiryDAL enqDAL = new EnquiryDAL(); var enq = enqDAL.GetEnquiryByNo(SourceNo); enqOrdMan = enq.EnqMan; companyName = enq.CustomerCompanyName; contact = enq.CustomerContactName; address = enq.CustomerAddress; email = enq.CustomerEmail; qq = enq.CustomerQQ; phone1 = enq.CustomerPhone1; phone2 = enq.CustomerPhone2; other = enq.CustomerOthers; surveyIntro = enq.SurveyIntro; enqNo = SourceNo; sourceId = enq.Enquiry_Id; //update enq status enq.Status = "申请测量"; enqDAL.Save(); } if (string.Equals(SourceType, SysConst.SourceTypeSalesOrder, StringComparison.OrdinalIgnoreCase)) { OrderDAL soDAL = new OrderDAL(); var so = soDAL.GetOrderByNo(SourceNo); enqOrdMan = so.OrderMan; companyName = so.CustomerCompanyName; contact = so.CustomerContactName; address = so.CustomerAddress; email = so.CustomerEmail; qq = so.CustomerQQ; phone1 = so.CustomerPhone1; phone2 = so.CustomerPhone2; other = so.CustomerOthers; surveyIntro = so.SurveyIntro; enqNo = so.EnqNo; sourceId = so.Order_Id; //update ord status so.Status = "申请测量"; soDAL.Save(); } //new refine SurveyDAL dal = new SurveyDAL(); Survey survey = new Survey() { Survey_No = no, Status = FirstStatusConsts.Survey, EnqOrdMan = enqOrdMan, SourceType = SourceType, SourceNo = SourceNo, CreatedDate = DateTime.Now, CreatedAt = DateTime.Now, CreatedBy = SMSContext.Current.User.UserName, CustomerCompanyName = companyName, CustomerContactName = contact, CustomerAddress = address, CustomerEmail = email, CustomerQQ = qq, CustomerPhone1 = phone1, CustomerPhone2 = phone2, CustomerOthers = other, SurveyIntro = surveyIntro, EnqNo = enqNo }; dal.AddSurvey(survey); dal.Save(); LineItemDAL lDAL = new LineItemDAL(); items = lDAL.GetLineItemsBySource(sourceId, SourceType); foreach (var item in items) { LineItem target = new LineItem() { Intro = item.Intro, Name = item.Name, OriginNo = item.OriginNo, Project = item.Project, Quantity = item.Quantity, Remark = item.Remark, SourceId = survey.Survey_Id, SourceType = SysConst.SourceTypeSurvey, Spec = item.Spec, Unit = item.Unit, UnitPrice = item.UnitPrice }; lDAL.AddLineItem(target); } lDAL.Save(); int svid = survey.Survey_Id; string svno = survey.Survey_No; string url = Page.ResolveUrl(string.Format("~/SurveyForm.aspx?svid={0}&svno={1}&sourcetype={2}&sourceno={3}", svid, svno, SourceType, SourceNo)); string script = string.Format("<script>window.open('{0}')</script>", url); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "createsuvey", script); BindControl(); SetFocus(btnCreateSurvey); }