Esempio n. 1
0
        protected void btnSettlement_Click(object sender, EventArgs e)
        {
            //get no
            SeedDAL sdal = new SeedDAL();
            string  no   = sdal.GetNoByTableName(SysConst.TableSettlement, SysConst.SuffixSettlement);

            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;

            OrderDAL soDAL = new OrderDAL();
            var      so    = soDAL.GetOrderByNo(SourceNo);

            companyName = so.CustomerCompanyName;
            contact     = so.CustomerContactName;
            address     = so.CustomerAddress;
            email       = so.CustomerEmail;
            qq          = so.CustomerQQ;
            phone1      = so.CustomerPhone1;
            phone2      = so.CustomerPhone2;
            other       = so.CustomerOthers;

            //new refine
            SettlementDAL dal = new SettlementDAL();
            Settlement    st  = new Settlement()
            {
                St_No               = no,
                Status              = FirstStatusConsts.Settlement,
                SourceType          = SourceType,
                SourceNo            = SourceNo,
                CreatedDate         = DateTime.Now,
                CustomerCompanyName = companyName,
                CustomerContactName = contact,
                CustomerAddress     = address,
                CustomerEmail       = email,
                CustomerQQ          = qq,
                CustomerPhone1      = phone1,
                CustomerPhone2      = phone2,
                CustomerOthers      = other
            };

            dal.AddSettlement(st);
            dal.Save();

            int    stid   = st.St_Id;
            string stno   = st.St_No;
            string url    = Page.ResolveUrl(string.Format("~/SettlementForm.aspx?stid={0}&stno={1}&sourcetype={2}&sourceno={3}", stid, stno, SysConst.SourceTypeOrder, SourceNo));
            string script = string.Format("<script>window.open('{0}')</script>", url);

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "createsettle", script);
            BindControl();
            SetFocus(btnSettlement);
        }
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            //get no
            SeedDAL sdal = new SeedDAL();
            string  no   = sdal.GetNoByTableName(SysConst.TablePurchaseOrder, SysConst.SuffixPurchaseOrder);

            //if (string.Equals(SourceType, SysConst.SourceTypeSalesOrder, StringComparison.OrdinalIgnoreCase))
            //{
            //    SalesOrderDAL soDAL = new SalesOrderDAL();
            //    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;
            //}
            //new po
            PurchaseOrderDAL dal = new PurchaseOrderDAL();
            PurchaseOrder    po  = new PurchaseOrder()
            {
                Purchase_No = no,
                Status      = FirstStatusConsts.Purchase,
                SourceType  = string.Empty,
                SourceNo    = string.Empty,
                CreatedDate = DateTime.Now,
                CreatedAt   = DateTime.Now,
                CreatedBy   = SMSContext.Current.User.UserName
            };

            dal.AddPO(po);
            dal.Save();

            int    poid   = po.Purchase_Id;
            string pono   = po.Purchase_No;
            string url    = Page.ResolveUrl(string.Format("~/PurchaseForm.aspx?poid={0}&pono={1}&sourcetype={2}&sourceno={3}", poid, pono, string.Empty, string.Empty));
            string script = string.Format("<script>window.open('{0}')</script>", url);

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "createpo", script);
        }
Esempio n. 3
0
        protected void btnCreateMachining_Click(object sender, EventArgs e)
        {
            //get no
            SeedDAL sdal = new SeedDAL();
            string  no   = sdal.GetNoByTableName(SysConst.TableMachining, SysConst.SuffixMachining);

            Machining mach = new Machining();

            mach.Mach_No     = no;
            mach.SourceNo    = SourceNo;
            mach.SourceType  = SourceType;
            mach.CreatedDate = DateTime.Now;
            mach.Status      = FirstStatusConsts.Mach;

            OrderDAL soDAL = new OrderDAL();
            var      so    = soDAL.GetOrderByNo(SourceNo);

            so.Status = "申请生产";
            soDAL.Save();

            mach.CustomerCompanyName = so.CustomerCompanyName;
            mach.CustomerContactName = so.CustomerContactName;
            mach.CustomerAddress     = so.CustomerAddress;
            mach.CustomerEmail       = so.CustomerEmail;
            mach.CustomerQQ          = so.CustomerQQ;
            mach.CustomerPhone1      = so.CustomerPhone1;
            mach.CustomerPhone2      = so.CustomerPhone2;
            mach.CustomerOthers      = so.CustomerOthers;

            MachiningDAL dal = new MachiningDAL();

            dal.AddMachining(mach);
            dal.Save();

            int    machId = mach.Mach_Id;
            string machNo = mach.Mach_No;
            string url    = Page.ResolveUrl(string.Format("~/MachiningForm.aspx?machid={0}&machno={1}&sourcetype={2}&sourceno={3}", machId, machNo, SourceType, SourceNo));
            string script = string.Format("<script>window.open('{0}')</script>", url);

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "createmach", script);
            BindControl();
            SetFocus(btnCreateMachining);
        }
        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);
        }
Esempio n. 5
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            var   ordNo = new SeedDAL().GetNoByTableName(SysConst.TableOrder, SysConst.SuffixOrder);
            Order ord   = new Order();

            ord.Status      = FirstStatusConsts.Order;
            ord.Order_No    = ordNo;
            ord.SourceNo    = string.Empty;
            ord.SourceType  = string.Empty;
            ord.InstallType = string.Empty;
            ord.CreatedDate = DateTime.Now;
            ord.IsActive    = true;
            var dal = new OrderDAL();

            dal.AddOrder(ord);
            dal.Save();
            ClientScript.RegisterClientScriptBlock(this.GetType(), "createorder",
                                                   string.Format("<script>window.open('orderform.aspx?ordid={0}&ordno={1}&sourceno={2}&sourcetype={3}')</script>",
                                                                 ord.Order_Id,
                                                                 ord.Order_No,
                                                                 ord.SourceNo,
                                                                 ord.SourceType));
            Utility.AddDefault(ord.Order_No, SysConst.SourceTypeOrder, FooterConsts.Order);
        }
Esempio n. 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 btnCreateDelivery_Click(object sender, EventArgs e)
        {
            //get no
            SeedDAL sdal = new SeedDAL();
            string  no   = sdal.GetNoByTableName(SysConst.TableDelivery, SysConst.SuffixDelivery);
            //customer
            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;

            OrderDAL soDAL = new OrderDAL();
            var      so    = soDAL.GetOrderByNo(SourceNo);

            so.Status = "申请送货安装";
            soDAL.Save();

            string orderNo = so.Order_No;

            companyName = so.CustomerCompanyName;
            contact     = so.CustomerContactName;
            address     = so.CustomerAddress;
            email       = so.CustomerEmail;
            qq          = so.CustomerQQ;
            phone1      = so.CustomerPhone1;
            phone2      = so.CustomerPhone2;
            other       = so.CustomerOthers;

            //new delivery
            DeliveryDAL dal      = new DeliveryDAL();
            Delivery    delivery = new Delivery()
            {
                Order_No            = orderNo,
                Delivery_No         = no,
                Status              = FirstStatusConsts.Delivery,
                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
            };

            dal.AddDelivery(delivery);
            dal.Save();

            int    dlid = delivery.Delivery_Id;
            string dlno = delivery.Delivery_No;

            Utility.AddDefault(dlno, SysConst.SourceTypeDelivery, FooterConsts.Delivery);
            string url    = Page.ResolveUrl(string.Format("~/DeliveryForm.aspx?dlid={0}&dlno={1}&sourcetype={2}&sourceno={3}", dlid, dlno, SourceType, SourceNo));
            string script = string.Format("<script>window.open('{0}')</script>", url);

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "createdelivery", script);
            BindControl();
            SetFocus(btnCreateDelivery);
        }
        protected void btnCreatePurchase_Click(object sender, EventArgs e)
        {
            //get no
            SeedDAL sdal = new SeedDAL();
            string  no   = sdal.GetNoByTableName(SysConst.TablePurchaseOrder, SysConst.SuffixPurchaseOrder);
            //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;

            if (string.Equals(SourceType, SysConst.SourceTypeOrder, StringComparison.OrdinalIgnoreCase))
            {
                OrderDAL soDAL = new OrderDAL();
                var      so    = soDAL.GetOrderByNo(SourceNo);
                so.Status = "申请采购";
                soDAL.Save();

                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;
            }
            else if (string.Equals(SourceType, SysConst.SourceTypeMaching, StringComparison.OrdinalIgnoreCase))
            {
                MachiningDAL mDAL = new MachiningDAL();
                var          mach = mDAL.GetMachByNo(SourceNo);
                companyName = mach.CustomerCompanyName;
                contact     = mach.CustomerContactName;
                address     = mach.CustomerAddress;
                email       = mach.CustomerEmail;
                qq          = mach.CustomerQQ;
                phone1      = mach.CustomerPhone1;
                phone2      = mach.CustomerPhone2;
                other       = mach.CustomerOthers;
            }
            //new refine
            PurchaseOrderDAL dal = new PurchaseOrderDAL();
            PurchaseOrder    po  = new PurchaseOrder()
            {
                Purchase_No = no,
                Status      = FirstStatusConsts.Purchase,
                EnqOrdMan   = enqOrdMan,
                SourceType  = SourceType,
                SourceNo    = SourceNo,
                CreatedDate = DateTime.Now,
                CreatedAt   = DateTime.Now,
                CreatedBy   = SMSContext.Current.User.UserName
            };

            dal.AddPO(po);
            dal.Save();

            int    poid = po.Purchase_Id;
            string pono = po.Purchase_No;

            //poitem
            if (string.Equals(SourceType, SysConst.SourceTypeMaching, StringComparison.OrdinalIgnoreCase))
            {
                MachiningDAL mDAL      = new MachiningDAL();
                var          mach      = mDAL.GetMachByNo(SourceNo);
                MachItemDAL  miDAL     = new MachItemDAL();
                var          machItems = miDAL.GetMachItemsByMachId(mach.Mach_Id);

                POItemDAL pDAL = new POItemDAL();
                foreach (var item in machItems)
                {
                    PurchaseOrderItem poItem = new PurchaseOrderItem()
                    {
                        Code         = item.Code,
                        Deepth       = item.Deepth,
                        Intro        = item.Intro,
                        Long         = item.Long,
                        PO_Id        = poid,
                        Product_Code = item.Product_Code,
                        Quantity     = item.Quantity,
                        Square       = item.Square,
                        Width        = item.Width
                    };
                    pDAL.AddPOItem(poItem);
                }
                pDAL.Save();
            }

            string url    = Page.ResolveUrl(string.Format("~/PurchaseForm.aspx?poid={0}&pono={1}&sourcetype={2}&sourceno={3}", poid, pono, SourceType, SourceNo));
            string script = string.Format("<script>window.open('{0}')</script>", url);

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "createpo", script);
            BindControl();
            SetFocus(btnCreatePurchase);
        }
Esempio n. 10
0
        protected void rpEnqList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "GenerateOrder" && (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item))
            {
                HiddenField hdId = e.Item.FindControl("hdId") as HiddenField;
                Enquiry     enq  = new EnquiryDAL().GetEnquiryById(int.Parse(hdId.Value));

                OrderDAL dal   = new OrderDAL();
                var      order = dal.GetOrderByEnq(enq.Enquiry_No);
                if (order != null)
                {
                    ClientScript.RegisterClientScriptBlock(this.GetType(), "generateorder",
                                                           string.Format("<script>window.open('OrderForm.aspx?ordid={0}&ordno={1}&sourcetype=E&sourceno={2}')</script>", order.Order_Id, order.Order_No, enq.Enquiry_No));
                    return;
                }


                SeedDAL     sdal     = new SeedDAL();
                LineItemDAL lDAL     = new LineItemDAL();
                var         no       = sdal.GetNoByTableName(SysConst.TableOrder, SysConst.SuffixOrder);
                var         enqItems = lDAL.GetLineItemsBySource(enq.Enquiry_Id, SysConst.SourceTypeEnquiry);

                Order ord = new Order();
                ord.SourceType          = SysConst.SourceTypeEnquiry;
                ord.SourceNo            = enq.Enquiry_No;
                ord.Order_No            = no;
                ord.Status              = FirstStatusConsts.Order;
                ord.CreatedDate         = DateTime.Now;
                ord.CustomerAddress     = enq.CustomerAddress;
                ord.CustomerCompanyName = enq.CustomerCompanyName;
                ord.CustomerContactName = enq.CustomerContactName;
                ord.CustomerEmail       = enq.CustomerEmail;
                ord.CustomerOthers      = enq.CustomerOthers;
                ord.CustomerPhone1      = enq.CustomerPhone1;
                ord.CustomerPhone2      = enq.CustomerPhone2;
                ord.CustomerQQ          = enq.CustomerQQ;

                ord.IsSampleProvidedToCustomer = enq.IsSampleProvidedToCustomer;
                ord.IsCustomerProvideSample    = enq.IsCustomerProvideSample;
                ord.IsCustomerProvideImage     = enq.IsCustomerProvideImage;
                ord.IsSurveyNeeded             = enq.IsSurveyNeeded;
                ord.SurveyType                    = enq.SurveyType;
                ord.SurveyIntro                   = enq.SurveyIntro;
                ord.IsCADRefinementNeeded         = enq.IsCADRefinementNeeded;
                ord.CADRefinementIntro            = enq.CADRefinementIntro;
                ord.IsCADNeedCustomerConfirmation = enq.IsCADNeedCustomerConfirmation;
                ord.DeliveryType                  = enq.DeliveryType;
                ord.DeliveryIntro                 = enq.DeliveryIntro;
                ord.DeliveryToAddress             = enq.DeliveryToAddress;
                ord.IsInstallProvided             = enq.IsInstallProvided;
                ord.InstallType                   = string.IsNullOrEmpty(enq.InstallType) ? string.Empty : enq.InstallType;

                ord.InstallIntro = enq.InstallIntro;
                ord.EnqNo        = enq.Enquiry_No;
                ord.IsActive     = true;
                dal.AddOrder(ord);
                dal.Save();
                //intro
                //intro
                Utility.AddDefault(ord.Order_No, SysConst.SourceTypeOrder, FooterConsts.Order);
                //item
                foreach (var item in enqItems)
                {
                    LineItem newItem = new LineItem()
                    {
                        Intro      = item.Intro,
                        Name       = item.Name,
                        Project    = item.Project,
                        Quantity   = item.Quantity,
                        Remark     = item.Remark,
                        SourceId   = ord.Order_Id,
                        SourceType = SysConst.SourceTypeOrder,
                        Spec       = item.Spec,
                        Unit       = item.Unit,
                        UnitPrice  = item.UnitPrice
                    };
                    lDAL.AddLineItem(newItem);
                }
                lDAL.Save();
                ClientScript.RegisterClientScriptBlock(this.GetType(), "generateorder",
                                                       string.Format("<script>window.open('OrderForm.aspx?ordid={0}&ordno={1}&sourcetype=E&sourceno={2}')</script>", ord.Order_Id, ord.Order_No, enq.Enquiry_No));
            }
            else if (e.CommandName == "Delete" && (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item))
            {
                HiddenField hdId = e.Item.FindControl("hdId") as HiddenField;
                new EnquiryDAL().Delete(int.Parse(hdId.Value));
                Utility.BindDataToRepeater(rpEnqList, GetEnquiryList());
            }
            else
            {
                SetSorting(e);
                if (!string.IsNullOrWhiteSpace(SortOrder))
                {
                    Utility.BindDataToRepeater(rpEnqList, GetEnquiryList().Sort(string.Format("{0} {1}", e.CommandName, SortOrder)));
                }
            }
        }
Esempio n. 11
0
        protected void btnCopy_Click(object sender, EventArgs e)
        {
            string       quono       = GetQueryStringValue("quono");
            QuotationDAL dal         = new QuotationDAL();
            var          sourceQuote = dal.GetQuoteByNo(quono);

            Quotation targetQuote = new Quotation();
            SeedDAL   sdal        = new SeedDAL();
            var       quoteNo     = sdal.GetNoByTableName(SysConst.TableNameQuotation, SysConst.SuffixQuotation);

            targetQuote.Quotation_No                  = quoteNo;
            targetQuote.SourceNo                      = sourceQuote.SourceNo;
            targetQuote.SourceType                    = sourceQuote.SourceType;
            targetQuote.CADRefinementIntro            = sourceQuote.CADRefinementIntro;
            targetQuote.CreatedDate                   = sourceQuote.CreatedDate;
            targetQuote.CustomerAddress               = sourceQuote.CustomerAddress;
            targetQuote.CustomerCompanyName           = sourceQuote.CustomerCompanyName;
            targetQuote.CustomerContactName           = sourceQuote.CustomerContactName;
            targetQuote.CustomerEmail                 = sourceQuote.CustomerEmail;
            targetQuote.CustomerOthers                = sourceQuote.CustomerOthers;
            targetQuote.CustomerPhone1                = sourceQuote.CustomerPhone1;
            targetQuote.CustomerPhone2                = sourceQuote.CustomerPhone2;
            targetQuote.CustomerQQ                    = sourceQuote.CustomerQQ;
            targetQuote.DeliveryIntro                 = sourceQuote.DeliveryIntro;
            targetQuote.DeliveryToAddress             = sourceQuote.DeliveryToAddress;
            targetQuote.DeliveryType                  = sourceQuote.DeliveryType;
            targetQuote.InstallIntro                  = sourceQuote.InstallIntro;
            targetQuote.InstallType                   = sourceQuote.InstallType;
            targetQuote.IsCADNeedCustomerConfirmation = sourceQuote.IsCADNeedCustomerConfirmation;
            targetQuote.IsCADRefinementNeeded         = sourceQuote.IsCADRefinementNeeded;
            targetQuote.IsCustomerProvideImage        = sourceQuote.IsCustomerProvideImage;
            targetQuote.IsCustomerProvideSample       = sourceQuote.IsCustomerProvideSample;
            targetQuote.IsInstallProvided             = sourceQuote.IsInstallProvided;
            targetQuote.IsSampleProvidedToCustomer    = sourceQuote.IsSampleProvidedToCustomer;
            targetQuote.IsSurveyNeeded                = sourceQuote.IsSurveyNeeded;
            targetQuote.QuotationIntro                = sourceQuote.QuotationIntro;
            targetQuote.QuotationMan                  = sourceQuote.QuotationMan;
            targetQuote.Status      = FirstStatusConsts.Order;
            targetQuote.SurveyIntro = sourceQuote.SurveyIntro;
            targetQuote.SurveyType  = sourceQuote.SurveyType;

            dal.AddQuote(targetQuote);
            dal.Save();

            LineItemDAL lDal  = new LineItemDAL();
            var         items = lDal.GetLineItemsBySource(sourceQuote.Quotation_Id, SysConst.SourceTypeQuote);

            foreach (var item in items)
            {
                var targetQuoteItem = new LineItem()
                {
                    Intro      = item.Intro,
                    Name       = item.Name,
                    Project    = item.Project,
                    Quantity   = item.Quantity,
                    Remark     = item.Remark,
                    SourceId   = targetQuote.Quotation_Id,
                    SourceType = SysConst.SourceTypeQuote,
                    Spec       = item.Spec,
                    Unit       = item.Unit,
                    UnitPrice  = item.UnitPrice
                };

                lDal.AddLineItem(targetQuoteItem);
            }
            lDal.Save();

            //intro
            Utility.AddDefault(targetQuote.Quotation_No, SysConst.SourceTypeQuote, FooterConsts.Quotation);
            ClientScript.RegisterClientScriptBlock(this.GetType(), "copyquote",
                                                   string.Format("<script>window.open('quotationform.aspx?quoid={0}&quono={1}&sourceno={2}&sourcetype={3}')</script>",
                                                                 targetQuote.Quotation_Id,
                                                                 targetQuote.Quotation_No,
                                                                 targetQuote.SourceNo,
                                                                 targetQuote.SourceType));
        }
        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);
        }
Esempio n. 13
0
        public static Order GenerateOrder(Quotation quote)
        {
            Order   ord   = new Order();
            SeedDAL sdal  = new SeedDAL();
            var     ordNo = sdal.GetNoByTableName(SysConst.TableOrder, SysConst.SuffixOrder);

            ord.Order_No                      = ordNo;
            ord.SourceNo                      = quote.Quotation_No;
            ord.SourceType                    = SysConst.SourceTypeQuote;
            ord.CADRefinementIntro            = quote.CADRefinementIntro;
            ord.CreatedDate                   = quote.CreatedDate;
            ord.CustomerAddress               = quote.CustomerAddress;
            ord.CustomerCompanyName           = quote.CustomerCompanyName;
            ord.CustomerContactName           = quote.CustomerContactName;
            ord.CustomerEmail                 = quote.CustomerEmail;
            ord.CustomerOthers                = quote.CustomerOthers;
            ord.CustomerPhone1                = quote.CustomerPhone1;
            ord.CustomerPhone2                = quote.CustomerPhone2;
            ord.CustomerQQ                    = quote.CustomerQQ;
            ord.DeliveryIntro                 = quote.DeliveryIntro;
            ord.DeliveryToAddress             = quote.DeliveryToAddress;
            ord.DeliveryType                  = quote.DeliveryType;
            ord.InstallIntro                  = quote.InstallIntro;
            ord.InstallType                   = string.IsNullOrEmpty(quote.InstallType) ? string.Empty : quote.InstallType;
            ord.IsCADNeedCustomerConfirmation = quote.IsCADNeedCustomerConfirmation;
            ord.IsCADRefinementNeeded         = quote.IsCADRefinementNeeded;
            ord.IsCustomerProvideImage        = quote.IsCustomerProvideImage;
            ord.IsCustomerProvideSample       = quote.IsCustomerProvideSample;
            ord.IsInstallProvided             = quote.IsInstallProvided;
            ord.IsSampleProvidedToCustomer    = quote.IsSampleProvidedToCustomer;
            ord.IsSurveyNeeded                = quote.IsSurveyNeeded;
            ord.OrderIntro                    = quote.QuotationIntro;
            ord.OrderMan                      = quote.QuotationMan;
            ord.Status      = FirstStatusConsts.Order;
            ord.SurveyIntro = quote.SurveyIntro;
            ord.SurveyType  = quote.SurveyType;
            ord.EnqNo       = quote.EnqNo;
            ord.IsActive    = true;
            OrderDAL dal = new OrderDAL();

            dal.AddOrder(ord);
            dal.Save();

            LineItemDAL lDal  = new LineItemDAL();
            var         items = lDal.GetLineItemsBySource(quote.Quotation_Id, SysConst.SourceTypeQuote);

            foreach (var item in items)
            {
                var newOrderItem = new LineItem()
                {
                    Intro      = item.Intro,
                    Name       = item.Name,
                    Project    = item.Project,
                    Quantity   = item.Quantity,
                    Remark     = item.Remark,
                    SourceId   = ord.Order_Id,
                    SourceType = SysConst.SourceTypeOrder,
                    Spec       = item.Spec,
                    Unit       = item.Unit,
                    UnitPrice  = item.UnitPrice
                };

                lDal.AddLineItem(newOrderItem);
            }
            lDal.Save();
            Utility.AddDefault(ord.Order_No, SysConst.SourceTypeOrder, FooterConsts.Order);
            return(ord);
        }
Esempio n. 14
0
        protected void btnGenerateOrder_Click(object sender, EventArgs e)
        {
            Enquiry  enq   = new EnquiryDAL().GetEnquiryByNo(GetQueryStringValue("enqno"));
            OrderDAL dal   = new OrderDAL();
            var      order = dal.GetOrderByEnq(enq.Enquiry_No);

            if (order != null)
            {
                ClientScript.RegisterClientScriptBlock(this.GetType(), "generateorder",
                                                       string.Format("<script>window.open('OrderForm.aspx?ordid={0}&ordno={1}&sourcetype=E&sourceno={2}')</script>", order.Order_Id, order.Order_No, enq.Enquiry_No));
                return;
            }

            SeedDAL     sdal     = new SeedDAL();
            LineItemDAL lDAL     = new LineItemDAL();
            var         no       = sdal.GetNoByTableName(SysConst.TableOrder, SysConst.SuffixOrder);
            var         enqItems = lDAL.GetLineItemsBySource(enq.Enquiry_Id, SysConst.SourceTypeEnquiry);

            Order ord = new Order();

            ord.SourceType          = SysConst.SourceTypeEnquiry;
            ord.SourceNo            = enq.Enquiry_No;
            ord.Order_No            = no;
            ord.Status              = FirstStatusConsts.Order;
            ord.CreatedDate         = DateTime.Now;
            ord.CustomerAddress     = enq.CustomerAddress;
            ord.CustomerCompanyName = enq.CustomerCompanyName;
            ord.CustomerContactName = enq.CustomerContactName;
            ord.CustomerEmail       = enq.CustomerEmail;
            ord.CustomerOthers      = enq.CustomerOthers;
            ord.CustomerPhone1      = enq.CustomerPhone1;
            ord.CustomerPhone2      = enq.CustomerPhone2;
            ord.CustomerQQ          = enq.CustomerQQ;

            ord.IsSampleProvidedToCustomer = enq.IsSampleProvidedToCustomer;
            ord.IsCustomerProvideSample    = enq.IsCustomerProvideSample;
            ord.IsCustomerProvideImage     = enq.IsCustomerProvideImage;
            ord.IsSurveyNeeded             = enq.IsSurveyNeeded;
            ord.SurveyType                    = enq.SurveyType;
            ord.SurveyIntro                   = enq.SurveyIntro;
            ord.IsCADRefinementNeeded         = enq.IsCADRefinementNeeded;
            ord.CADRefinementIntro            = enq.CADRefinementIntro;
            ord.IsCADNeedCustomerConfirmation = enq.IsCADNeedCustomerConfirmation;
            ord.DeliveryType                  = enq.DeliveryType;
            ord.DeliveryIntro                 = enq.DeliveryIntro;
            ord.DeliveryToAddress             = enq.DeliveryToAddress;
            ord.IsInstallProvided             = enq.IsInstallProvided;
            ord.InstallType                   = string.IsNullOrEmpty(enq.InstallType) ? string.Empty : enq.InstallType;
            ord.InstallIntro                  = enq.InstallIntro;
            ord.EnqNo    = enq.Enquiry_No;
            ord.IsActive = true;

            dal.AddOrder(ord);
            dal.Save();
            //intro
            Utility.AddDefault(ord.Order_No, SysConst.SourceTypeOrder, FooterConsts.Order);
            //item
            foreach (var item in enqItems)
            {
                LineItem newItem = new LineItem()
                {
                    Intro      = item.Intro,
                    Name       = item.Name,
                    Project    = item.Project,
                    Quantity   = item.Quantity,
                    Remark     = item.Remark,
                    SourceId   = ord.Order_Id,
                    SourceType = SysConst.SourceTypeOrder,
                    Spec       = item.Spec,
                    Unit       = item.Unit,
                    UnitPrice  = item.UnitPrice
                };
                lDAL.AddLineItem(newItem);
            }
            lDAL.Save();
            ClientScript.RegisterClientScriptBlock(this.GetType(), "generateorder",
                                                   string.Format("<script>window.open('OrderForm.aspx?ordid={0}&ordno={1}&sourcetype=E&sourceno={2}')</script>", ord.Order_Id, ord.Order_No, enq.Enquiry_No));
        }