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);
        }
        private void BindData()
        {
            EnquiryDAL dal = new EnquiryDAL();
            var        enq = dal.GetEnquiryByNo(EnqNo);

            lblDate.Text        = enq.CreatedDate.ToString("yyyy-MM-dd");
            lblContactName.Text = enq.CustomerContactName;
            if (!string.IsNullOrEmpty(enq.CustomerPhone1) && !string.IsNullOrEmpty(enq.CustomerPhone2))
            {
                lblPhone.Text = enq.CustomerPhone1 + "/" + enq.CustomerPhone2;
            }
            else
            {
                lblPhone.Text = enq.CustomerPhone1 + enq.CustomerPhone2;
            }
            lblEmail.Text   = enq.CustomerEmail;
            lblQQ.Text      = enq.CustomerQQ;
            lblAddress.Text = enq.CustomerAddress;
            lblIsCustomerProvideImage.Text = enq.IsCustomerProvideImage ? YesNoConsts.Yes : YesNoConsts.No;
            lblSampleToCustomer.Text       = enq.IsSampleProvidedToCustomer ? YesNoConsts.Yes : YesNoConsts.No;
            if (enq.IsSampleProvidedToCustomer)
            {
                lblTextSampleCode.Visible   = true;
                lblSampleToCustomer.Visible = true;
                lblSampleCode.Visible       = true;
                SampleProvidDAL sdal    = new SampleProvidDAL();
                var             samples = sdal.GetSampleBySource(SysConst.SourceTypeEnquiry, EnqNo);
                StringBuilder   sb      = new StringBuilder();
                foreach (var item in samples)
                {
                    sb.Append(item.SampleName).Append(",");
                }
                if (sb.Length > 0)
                {
                    sb.Remove(sb.Length - 1, 1);
                }
                lblSampleCode.Text = sb.ToString();
            }
            lblSurveyNeeded.Text = enq.IsSurveyNeeded ? YesNoConsts.Yes : YesNoConsts.No;
            if (enq.IsSurveyNeeded)
            {
                lblSurveyType.Text = enq.SurveyType;
            }
            lblProvideRefine.Text   = enq.IsCADRefinementNeeded ? YesNoConsts.Yes : YesNoConsts.No;
            lblProvideDelivery.Text = enq.DeliveryType;
            lblDeliveryType.Text    = enq.DeliveryType;
            lblDeliveryAddress.Text = enq.DeliveryToAddress;
            lblProvideInstall.Text  = enq.IsInstallProvided ? YesNoConsts.Yes : YesNoConsts.No;
            lblInstallType.Text     = enq.InstallType;

            //item
            LineItemDAL lDAL  = new LineItemDAL();
            var         items = lDAL.GetLineItemsBySource(enq.Enquiry_Id, SysConst.SourceTypeEnquiry);

            Utility.BindDataToRepeater(rpItems, items);
            //bankinfo
            Utility.BindDataToDropdown(ddlBankInfo, Utility.GetLookupList("账户列表"));
            SetBankInfo();
        }
 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();
         }
     }
 }
示例#4
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 Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.BindDataToDropdown(ddlEnqOrdMan, Utility.GetUserList2(true));
                Utility.BindDataToDropdown(ddlRefMan, Utility.GetUserList2(true));

                if (!string.IsNullOrEmpty(SourceType) && !string.IsNullOrEmpty(SourceNo))
                {
                    //link
                    if (string.Equals(SourceType, SysConst.SourceTypeEnquiry, StringComparison.OrdinalIgnoreCase))
                    {
                        EnquiryDAL eDAL = new EnquiryDAL();
                        var        enq  = eDAL.GetEnquiryByNo(SourceNo);
                        lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/enquiryform.aspx?enqno={0}&enqid={1}", SourceNo, enq.Enquiry_Id));
                    }
                    else
                    {
                        OrderDAL sDAL = new OrderDAL();
                        var      ord  = sDAL.GetOrderByNo(SourceNo);
                        lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/orderform.aspx?ordno={0}&ordid={1}&sourcetype={2}&sourceno={3}", SourceNo, ord.Order_Id, ord.SourceType, ord.SourceNo));
                    }
                    lnkSource.Text = SourceNo;

                    RefineDAL dal    = new RefineDAL();
                    var       refine = dal.GetRefineByNo(RefNo);
                    //basic
                    txtCreatedDate.Text         = refine.CreatedDate.ToString("yyyy-MM-dd");
                    ddlEnqOrdMan.SelectedValue  = refine.EnqOrdMan;
                    ddlRefMan.SelectedValue     = refine.RefineMan;
                    txtCompletedDate.Text       = refine.RequestCompleteDate.HasValue ? refine.RequestCompleteDate.Value.ToString("yyyy-MM-dd") : string.Empty;
                    chkConfirm.Checked          = refine.NeedCustomerConfirm;
                    txtConfirmIntro.Text        = refine.CustomerConfirmIntro;
                    chkIncludeMachining.Checked = refine.IncludeMaching;
                    chkNeedApprove.Checked      = refine.NeedApprove;
                    txtRefineIntro.Text         = refine.RefineIntro;
                    //customer info
                    this.customerInfoControl.SetValue(
                        refine.CustomerCompanyName,
                        refine.CustomerContactName,
                        refine.CustomerAddress,
                        refine.CustomerEmail,
                        refine.CustomerQQ,
                        refine.CustomerPhone1,
                        refine.CustomerPhone2,
                        refine.CustomerOthers);
                    //history cad
                    UIUtility.BindUserControl(cADRefinementControl, SourceType, SourceNo);
                    //customer drawing
                    UIUtility.BindUserControl(customerDrawingControl, SourceType, SourceNo);
                    //survey
                    UIUtility.BindUserControl(surveyControl, SourceType, SourceNo);
                    //cad
                    cADFileListControl.RefineId = RefId;
                    UIUtility.BindUserControl(cADFileListControl, SourceType, SourceNo);
                    //followup
                    UIUtility.BindUserControl(followUpControl, SysConst.SourceTypeRefine, refine.Refine_No);

                    //status dropdown
                    var result = StatusEngine.GetRefineStatus(chkIncludeMachining.Checked, chkNeedApprove.Checked, chkConfirm.Checked);
                    ddlRefineStatus.Items.Clear();
                    foreach (var item in result)
                    {
                        ddlRefineStatus.Items.Add(new ListItem()
                        {
                            Text = item, Value = item
                        });
                    }
                    ddlRefineStatus.SelectedValue = refine.Status;
                }
            }
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(SourceType) && !string.IsNullOrEmpty(SourceNo))
                {
                    Utility.BindDataToDropdown(ddlEnqOrdMan, Utility.GetUserList2(true));
                    Utility.BindDataToDropdown(ddlQuoteMan, Utility.GetUserList2(true));
                    //link
                    if (string.Equals(SourceType, SysConst.SourceTypeEnquiry, StringComparison.OrdinalIgnoreCase))
                    {
                        EnquiryDAL eDAL = new EnquiryDAL();
                        var        enq  = eDAL.GetEnquiryByNo(SourceNo);
                        lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/enquiryform.aspx?enqno={0}&enqid={1}", SourceNo, enq.Enquiry_Id));
                    }
                    else
                    {
                        OrderDAL sDAL = new OrderDAL();
                        var      ord  = sDAL.GetOrderByNo(SourceNo);
                        lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/orderform.aspx?ordno={0}&ordid={1}&sourcetype={2}&sourceno={3}", SourceNo, ord.Order_Id, ord.SourceType, ord.SourceNo));
                    }
                    lnkSource.Text = SourceNo;

                    QuotationDAL dal   = new QuotationDAL();
                    var          quote = dal.GetQuoteByNo(QuoteNo);
                    //basic
                    txtCreatedDate.Text = quote.CreatedDate.ToString("yyyy-MM-dd");

                    ddlEnqOrdMan.SelectedValue = quote.EnqOrdMan;
                    ddlQuoteMan.SelectedValue  = quote.QuotationMan;
                    txtQuoteIntro.Text         = quote.QuotationIntro;

                    //customer info
                    this.customerInfoControl.SetValue(
                        quote.CustomerCompanyName,
                        quote.CustomerContactName,
                        quote.CustomerAddress,
                        quote.CustomerEmail,
                        quote.CustomerQQ,
                        quote.CustomerPhone1,
                        quote.CustomerPhone2,
                        quote.CustomerOthers);
                    //lineitem
                    UIUtility.BindUserControl(lineItemsControl, SysConst.SourceTypeQuote, quote.Quotation_Id);
                    //sample
                    this.SampleControl1.SetValue(quote.IsSampleProvidedToCustomer, quote.IsCustomerProvideSample);
                    UIUtility.BindUserControl(SampleControl1, SysConst.SourceTypeQuote, quote.Quotation_No);
                    //customer drawing
                    customerDrawingControl.IsCustomerProvideImage = quote.IsCustomerProvideImage;
                    UIUtility.BindUserControl(customerDrawingControl, SysConst.SourceTypeQuote, quote.Quotation_No);
                    //survey
                    SurveyEditControl1.IsSurveyNeed = quote.IsSurveyNeeded;
                    SurveyEditControl1.SurveyIntro  = quote.SurveyIntro;
                    UIUtility.BindUserControl(SurveyEditControl1, SysConst.SourceTypeQuote, quote.Quotation_No);
                    SurveyEditControl1.SetSurveyType(quote.SurveyType);
                    //cad
                    CADEditControl1.IsCADRefinementNeeded           = quote.IsCADRefinementNeeded;
                    CADEditControl1.RefineIntro                     = quote.CADRefinementIntro;
                    CADEditControl1.IsCustomerCADConfirmationNeeded = quote.IsCADNeedCustomerConfirmation;
                    UIUtility.BindUserControl(CADEditControl1, SysConst.SourceTypeQuote, quote.Quotation_No);
                    //delivery
                    DeliveryEditControl1.DeliveryIntro     = quote.DeliveryIntro;
                    DeliveryEditControl1.DeliveryToAddress = quote.DeliveryToAddress;
                    UIUtility.BindUserControl(DeliveryEditControl1, SysConst.SourceTypeQuote, quote.Quotation_No);
                    DeliveryEditControl1.SetDeliveryType(quote.DeliveryType);
                    //install
                    InstallEditControl1.IsInstallProvided = quote.IsInstallProvided;
                    InstallEditControl1.InstallIntro      = quote.InstallIntro;
                    UIUtility.BindUserControl(InstallEditControl1, SysConst.SourceTypeQuote, quote.Quotation_No);
                    InstallEditControl1.SetInstallType(quote.InstallType);
                    //quotation
                    UIUtility.BindUserControl(quotationControl, SourceType, SourceNo);
                    //survey
                    UIUtility.BindUserControl(surveyControl, SourceType, SourceNo);
                    //customer provide drawing
                    UIUtility.BindUserControl(customerDrawingControl1, SourceType, SourceNo);
                    //refine
                    UIUtility.BindUserControl(cADRefinementControl, SourceType, SourceNo);
                    //intro
                    UIUtility.BindUserControl(FooterIntroControl1, SysConst.SourceTypeQuote, quote.Quotation_No);
                    //followup
                    UIUtility.BindUserControl(followUpControl, SysConst.SourceTypeQuote, quote.Quotation_No);

                    //status dropdown
                    Utility.BindDataToDropdown(this.ddlQuotationStatus, Utility.GetQuotationStatusList());
                    ddlQuotationStatus.SelectedValue = quote.Status;
                    if (string.Equals(quote.Status, "报价完成", StringComparison.OrdinalIgnoreCase) ||
                        string.Equals(quote.Status, "待确认", StringComparison.OrdinalIgnoreCase) ||
                        string.Equals(quote.Status, "确认", StringComparison.OrdinalIgnoreCase) ||
                        string.Equals(quote.Status, "不确认", StringComparison.OrdinalIgnoreCase)
                        )
                    {
                        SetControlsStatus(false);
                        ddlQuotationStatus.Enabled = true;
                        btnChangeStatus.Enabled    = true;
                        btnPrint.Disabled          = false;
                        btnCopy.Enabled            = true;
                    }

                    if (quote.Status != "编辑中")
                    {
                        SetControlsStatus(false);
                        SetControlEnabled(btnChangeStatus, true);
                        SetControlEnabled(ddlQuotationStatus, true);
                    }
                }
            }
        }
        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);
        }
示例#9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.BindDataToDropdown(ddlSurveyStatus, Utility.GetSurveyStatusList());
                Utility.BindDataToDropdown(ddlEnqOrdMan, Utility.GetUserList2(true));
                Utility.BindDataToDropdown(ddlSurveyMan, Utility.GetUserList2(true));
                if (!string.IsNullOrEmpty(SourceType) && !string.IsNullOrEmpty(SourceNo))
                {
                    //link
                    if (string.Equals(SourceType, SysConst.SourceTypeEnquiry, StringComparison.OrdinalIgnoreCase))
                    {
                        EnquiryDAL eDAL = new EnquiryDAL();
                        var        enq  = eDAL.GetEnquiryByNo(SourceNo);
                        lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/enquiryform.aspx?enqno={0}&enqid={1}", SourceNo, enq.Enquiry_Id));
                    }
                    else
                    {
                        OrderDAL sDAL = new OrderDAL();
                        var      ord  = sDAL.GetOrderByNo(SourceNo);
                        lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/orderform.aspx?ordno={0}&ordid={1}&sourcetype={2}&sourceno={3}", SourceNo, ord.Order_Id, ord.SourceType, ord.SourceNo));
                    }
                    lnkSource.Text = SourceNo;

                    SurveyDAL dal    = new SurveyDAL();
                    var       survey = dal.GetSurveyById(SVId);
                    //basic
                    txtCreatedDate.Text        = survey.CreatedDate.ToString("yyyy-MM-dd");
                    ddlEnqOrdMan.SelectedValue = survey.EnqOrdMan;
                    txtExpectedSurveyDate.Text = survey.ExpectedSurveyDate != null?survey.ExpectedSurveyDate.Value.ToString("yyyy-MM-dd") : string.Empty;

                    txtOnsiteContactName.Text  = survey.OnSiteContactName;
                    txtOnsiteContactPhone.Text = survey.OnSiteContactPhone;
                    txtSurveyIntro.Text        = survey.SurveyIntro;
                    ddlSurveyMan.SelectedValue = survey.SurveyMan;
                    //goods bring
                    Utility.BindDataToCheckBoxList(chklToos, Utility.GetLookupList("测量物品"));
                    string goods = survey.GoodsBring;
                    if (!string.IsNullOrEmpty(goods))
                    {
                        foreach (ListItem item in chklToos.Items)
                        {
                            if (goods.Contains(item.Text))
                            {
                                item.Selected = true;
                            }
                        }
                    }
                    //customer info
                    this.customerInfoControl.SetValue(
                        survey.CustomerCompanyName,
                        survey.CustomerContactName,
                        survey.CustomerAddress,
                        survey.CustomerEmail,
                        survey.CustomerQQ,
                        survey.CustomerPhone1,
                        survey.CustomerPhone2,
                        survey.CustomerOthers);
                    //line content
                    LineItemsControl1.SourceId = survey.Survey_Id;
                    UIUtility.BindUserControl(LineItemsControl1, SysConst.SourceTypeDelivery, survey.Survey_No);

                    //history survey
                    LineItemsControl1.IsPriceColumnVisible = false;
                    LineItemsControl1.IsFooterVisible      = false;
                    LineItemsControl1.SourceId             = survey.Survey_Id;
                    UIUtility.BindUserControl(LineItemsControl1, SysConst.SourceTypeSurvey, survey.Survey_No);
                    //cad refine
                    UIUtility.BindUserControl(cADRefinementControl, SourceType, SourceNo);
                    //customer drawing
                    UIUtility.BindUserControl(customerDrawingControl, SourceType, SourceNo);
                    //refine
                    UIUtility.BindUserControl(surveyControl, SourceType, SourceNo);
                    //survey data
                    if (!string.IsNullOrEmpty(survey.SurveyImagePath))
                    {
                        imgSurveyData.ImageUrl      = Page.ResolveUrl(survey.SurveyImagePath);
                        imgSurveyData.AlternateText = survey.SurveyImageName;
                    }
                    //followup
                    UIUtility.BindUserControl(followUpControl, SysConst.SourceTypeSurvey, survey.Survey_No);

                    //status dropdown
                    ddlSurveyStatus.SelectedValue = survey.Status;
                }
            }
        }