protected void btnSave_Click(object sender, EventArgs e)
        {
            string     enqNo = EnqNo;
            EnquiryDAL dal   = new EnquiryDAL();
            var        enq   = dal.GetEnquiryByNo(enqNo);

            if (!string.IsNullOrEmpty(txtBeginDate.Text))
            {
                enq.ExpectedBeginDate = DateTime.Parse(txtBeginDate.Text);
            }
            if (!string.IsNullOrEmpty(txtEndDate.Text))
            {
                enq.ExpectedEndDate = DateTime.Parse(txtEndDate.Text);
            }
            //update enq
            enq.TimeLimitRemark            = txtTimeLimitRemark.Text;
            enq.EnqMan                     = Utility.GetSelectedText(ddlEnqMan);;
            enq.Remark                     = txtRemark.Text;
            enq.Summary                    = txtEnqSummary.Text;
            enq.CustomerCompanyName        = customerInfoControl.CompanyName;
            enq.CustomerContactName        = customerInfoControl.ContactName;
            enq.CustomerAddress            = customerInfoControl.Address;
            enq.CustomerEmail              = customerInfoControl.Email;
            enq.CustomerQQ                 = customerInfoControl.QQ;
            enq.CustomerPhone1             = customerInfoControl.Phone1;
            enq.CustomerPhone2             = customerInfoControl.Phone2;
            enq.CustomerOthers             = customerInfoControl.Other;
            enq.EnquiryImgPath             = enquiryImageControl.ImagePath;
            enq.IsSampleProvidedToCustomer = SampleControl1.IsSampleProvidedToCustomer;
            enq.IsCustomerProvideSample    = SampleControl1.IsSampleFromCustomer;
            enq.IsCustomerProvideImage     = customerDrawingControl.IsCustomerProvideImage;
            enq.IsSurveyNeeded             = SurveyEditControl1.IsSurveyNeed;
            if (SurveyEditControl1.IsSurveyNeed)
            {
                enq.SurveyType  = SurveyEditControl1.SurveyType;
                enq.SurveyIntro = SurveyEditControl1.SurveyIntro;
            }
            enq.IsCADRefinementNeeded = CADEditControl1.IsCADRefinementNeeded;
            if (CADEditControl1.IsCADRefinementNeeded)
            {
                enq.CADRefinementIntro            = CADEditControl1.RefineIntro;
                enq.IsCADNeedCustomerConfirmation = CADEditControl1.IsCustomerCADConfirmationNeeded;
            }
            enq.DeliveryType      = DeliveryEditControl1.DeliveryType;
            enq.DeliveryIntro     = DeliveryEditControl1.DeliveryIntro;
            enq.DeliveryToAddress = DeliveryEditControl1.DeliveryToAddress;

            enq.IsInstallProvided = InstallEditControl1.IsInstallProvided;
            if (InstallEditControl1.IsInstallProvided)
            {
                enq.InstallType  = InstallEditControl1.InstallType;
                enq.InstallIntro = InstallEditControl1.InstallIntro;
            }
            AddFollowUp(followUpControl, enq.Status, Utility.GetSelectedText(ddlEnquiryStatus));
            enq.Status = ddlEnquiryStatus.SelectedItem.Text;
            dal.Save();
            //save new customer
            customerInfoControl.Save();
            this.SetFocus(sender);
        }
        public void btnChangeStatus_OnClick(object sender, EventArgs e)
        {
            int        enqId = int.Parse(GetQueryStringValue("enqid"));
            EnquiryDAL dal   = new EnquiryDAL();
            var        enq   = dal.GetEnquiryById(enqId);

            AddFollowUp(followUpControl, enq.Status, Utility.GetSelectedText(ddlEnquiryStatus));
            enq.Status = this.ddlEnquiryStatus.SelectedItem.Text;
            dal.Save();
            SetFocus(sender);
        }
示例#3
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            string serverFilePath = string.Empty;

            Utility.UploadFile(fileUploadEnqImg, "EnquiryImage", SourceNo, ref serverFilePath);
            ImagePath = serverFilePath;

            EnquiryDAL dal = new EnquiryDAL();
            var        enq = dal.GetEnquiryById(EnquiryId);

            enq.EnquiryImgPath = serverFilePath;
            dal.Save();
            BindControl();
        }
 protected void btnUpdateEnqNo_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtEnqNo.Text))
     {
         EnquiryDAL dal   = new EnquiryDAL();
         Enquiry    enq   = dal.GetEnquiryById(EnqId);
         var        dbEnq = dal.GetEnquiryByNo(txtEnqNo.Text);
         if (dbEnq != null && dbEnq.Enquiry_Id != EnqId)
         {
             ClientScript.RegisterClientScriptBlock(this.GetType(), "updateno", "<script>alert('已经有相同咨询单号!');</script>");
         }
         else
         {
             enq.Enquiry_No = txtEnqNo.Text;
             dal.Save();
         }
     }
 }
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            SeedDAL sdal = new SeedDAL();
            string  no   = sdal.GetNoByTableName(SysConst.TableNameEnquiry, SysConst.SuffixEnquiry);
            Enquiry item = new Enquiry()
            {
                Enquiry_No  = no,
                Status      = FirstStatusConsts.Enquiry,
                CreatedAt   = DateTime.Now,
                CreatedDate = DateTime.Now,
                CreatedBy   = SMSContext.Current.User.UserName
            };
            EnquiryDAL dal = new EnquiryDAL();

            dal.AddEnquiry(item);
            dal.Save();
            int    enqId = item.Enquiry_Id;
            string enqNo = item.Enquiry_No;

            Utility.AddDefault(item.Enquiry_No, SysConst.SourceTypeEnquiry, FooterConsts.Enquiry);
            string script = string.Format("<script>window.open('enquiryform.aspx?enqid={0}&enqno={1}')</script>", enqId, enqNo);

            ClientScript.RegisterClientScriptBlock(this.GetType(), "createenq", script);
        }
示例#6
0
        protected void btnCreateQuotation_Click(object sender, EventArgs e)
        {
            //get no
            SeedDAL sdal = new SeedDAL();
            string  no   = sdal.GetNoByTableName(SysConst.TableNameQuotation, SysConst.SuffixQuotation);
            //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;
            bool            isSampleToCustomer      = false;
            bool            isSampleFromCustomer    = false;
            bool            isCustomerProvideImg    = false;
            bool            isSurveyNeed            = false;
            string          surveyType              = string.Empty;
            string          surveyIntro             = string.Empty;
            bool            isCADRefineNeeded       = false;
            string          refineIntro             = string.Empty;
            bool            isCustomerConfirmNeeded = false;
            string          deliveryType            = string.Empty;
            string          deliveryIntro           = string.Empty;
            string          deliveryAdd             = string.Empty;
            bool            isInstallProvided       = false;
            string          installType             = string.Empty;
            string          insallIntro             = string.Empty;
            string          enqNo                   = string.Empty;
            List <LineItem> items                   = new List <LineItem>();
            int             sourceId                = -1;

            if (string.Equals(SourceType, SysConst.SourceTypeSalesOrder, StringComparison.OrdinalIgnoreCase))
            {
                OrderDAL soDAL = new OrderDAL();
                var      so    = soDAL.GetOrderByNo(SourceNo);
                so.Status = "申请报价";
                soDAL.Save();
                OnQuotationCreated(so.Status, EventArgs.Empty);
                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;
                isSampleToCustomer      = so.IsSampleProvidedToCustomer;
                isSampleFromCustomer    = so.IsCustomerProvideSample;
                isCustomerProvideImg    = so.IsCustomerProvideImage;
                isSurveyNeed            = so.IsSurveyNeeded;
                surveyType              = so.SurveyType;
                surveyIntro             = so.SurveyIntro;
                isCADRefineNeeded       = so.IsCADRefinementNeeded;
                refineIntro             = so.CADRefinementIntro;
                isCustomerConfirmNeeded = so.IsCADNeedCustomerConfirmation;
                deliveryType            = so.DeliveryType;
                deliveryIntro           = so.DeliveryIntro;
                deliveryAdd             = so.DeliveryToAddress;
                isInstallProvided       = so.IsInstallProvided;
                installType             = string.IsNullOrEmpty(so.InstallType) ?string.Empty : so.InstallType;
                insallIntro             = so.InstallIntro;
                enqNo                   = so.EnqNo;
                sourceId                = so.Order_Id;
            }
            else 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;
                isSampleToCustomer      = enq.IsSampleProvidedToCustomer;
                isSampleFromCustomer    = enq.IsCustomerProvideSample;
                isCustomerProvideImg    = enq.IsCustomerProvideImage;
                isSurveyNeed            = enq.IsSurveyNeeded;
                surveyType              = enq.SurveyType;
                surveyIntro             = enq.SurveyIntro;
                isCADRefineNeeded       = enq.IsCADRefinementNeeded;
                refineIntro             = enq.CADRefinementIntro;
                isCustomerConfirmNeeded = enq.IsCADNeedCustomerConfirmation;
                deliveryType            = enq.DeliveryType;
                deliveryIntro           = enq.DeliveryIntro;
                deliveryAdd             = enq.DeliveryToAddress;
                isInstallProvided       = enq.IsInstallProvided;
                installType             = string.IsNullOrEmpty(enq.InstallType) ? string.Empty : enq.InstallType;
                insallIntro             = enq.InstallIntro;
                enqNo                   = SourceNo;
                sourceId                = enq.Enquiry_Id;
                //update enq status
                enq.Status = "申请报价";
                enqDAL.Save();
            }

            //new quote
            QuotationDAL dal   = new QuotationDAL();
            Quotation    quote = new Quotation()
            {
                Quotation_No                  = no,
                Status                        = FirstStatusConsts.Quotation,
                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,
                IsSampleProvidedToCustomer    = isSampleToCustomer,
                IsCustomerProvideSample       = isSampleFromCustomer,
                IsCustomerProvideImage        = isCustomerProvideImg,
                IsSurveyNeeded                = isSurveyNeed,
                SurveyType                    = surveyType,
                SurveyIntro                   = surveyIntro,
                IsCADRefinementNeeded         = isCADRefineNeeded,
                CADRefinementIntro            = refineIntro,
                IsCADNeedCustomerConfirmation = isCustomerConfirmNeeded,
                DeliveryType                  = deliveryType,
                DeliveryIntro                 = deliveryIntro,
                DeliveryToAddress             = deliveryAdd,
                IsInstallProvided             = isInstallProvided,
                InstallType                   = installType,
                InstallIntro                  = insallIntro,
                EnqNo = enqNo
            };

            dal.AddQuote(quote);
            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   = quote.Quotation_Id,
                    SourceType = SysConst.SourceTypeQuote,
                    Spec       = item.Spec,
                    Unit       = item.Unit,
                    UnitPrice  = item.UnitPrice
                };
                lDAL.AddLineItem(target);
            }
            lDAL.Save();

            int    quoId = quote.Quotation_Id;
            string quoNo = quote.Quotation_No;

            Utility.AddDefault(quote.Quotation_No, SysConst.SourceTypeQuote, FooterConsts.Quotation);
            string url    = Page.ResolveUrl(string.Format("~/QuotationForm.aspx?quoid={0}&quono={1}&sourcetype={2}&sourceno={3}", quoId, quoNo, SourceType, SourceNo));
            string script = string.Format("<script>window.open('{0}')</script>", url);

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "createquote", script);
            BindControl();
            SetFocus(btnCreateQuotation);
        }
        protected void btnCreateCADRefinement_Click(object sender, EventArgs e)
        {
            //get no
            SeedDAL sdal = new SeedDAL();
            string  no   = sdal.GetNoByTableName(SysConst.TableRefine, SysConst.SuffixRefine);
            //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 enqNo       = string.Empty;

            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;
                enqNo       = SourceNo;
                //update enq status
                enq.Status = "申请CAD细化";
                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;
                enqNo       = so.EnqNo;
                //update enq status
                so.Status = "申请CAD细化";
                soDAL.Save();
            }
            //new refine
            RefineDAL dal    = new RefineDAL();
            Refine    refine = new Refine()
            {
                Refine_No           = no,
                Status              = FirstStatusConsts.Refine,
                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,
                EnqNo = enqNo
            };

            dal.AddRefine(refine);
            dal.Save();

            int    refid  = refine.Refine_Id;
            string refno  = refine.Refine_No;
            string url    = Page.ResolveUrl(string.Format("~/RefineForm.aspx?refid={0}&refno={1}&sourcetype={2}&sourceno={3}", refid, refno, SourceType, SourceNo));
            string script = string.Format("<script>window.open('{0}')</script>", url);

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "createrefine", script);
            BindControl();
            SetFocus(btnCreateCADRefinement);
        }
        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);
        }