protected void btnSave_Click(object sender, EventArgs e)
        {
            MachiningDAL dal  = new MachiningDAL();
            var          mach = dal.GetMachByNo(MachNo);

            //update ord
            mach.MachCreateMan    = Utility.GetSelectedText(ddlMachCreateMan);
            mach.ProcessCreateMan = Utility.GetSelectedText(ddlMachTableMan);
            mach.SalesMan         = Utility.GetSelectedText(ddlSalesMan);
            mach.RefineMan        = Utility.GetSelectedText(ddlRefineMan);
            mach.SurveyMan        = Utility.GetSelectedText(ddlSurveyMan);
            mach.MachMan          = Utility.GetSelectedText(ddlMachProcessor);
            if (!string.IsNullOrEmpty(txtApplyDate.Text))
            {
                mach.ApplyDate = DateTime.Parse(txtApplyDate.Text);
            }

            if (!string.IsNullOrEmpty(txtExpectedCompletedDate.Text))
            {
                mach.ExpectedCompleteDate = DateTime.Parse(txtExpectedCompletedDate.Text);
            }
            if (!string.IsNullOrEmpty(txtCompletedDate.Text))
            {
                mach.CompleteDate = DateTime.Parse(txtCompletedDate.Text);
            }
            if (!string.IsNullOrEmpty(txtExpectedDeliveryDate.Text))
            {
                mach.ExpectedDeliveryDate = DateTime.Parse(txtExpectedDeliveryDate.Text);
            }
            if (!string.IsNullOrEmpty(txtExpectedInstallDate.Text))
            {
                mach.ExpectedInstallDate = DateTime.Parse(txtExpectedInstallDate.Text);
            }
            mach.MachIntro = txtMachiningSummary.Text;

            mach.CustomerCompanyName = customerInfoControl.CompanyName;
            mach.CustomerContactName = customerInfoControl.ContactName;
            mach.CustomerAddress     = customerInfoControl.Address;
            mach.CustomerEmail       = customerInfoControl.Email;
            mach.CustomerQQ          = customerInfoControl.QQ;
            mach.CustomerPhone1      = customerInfoControl.Phone1;
            mach.CustomerPhone2      = customerInfoControl.Phone2;
            mach.CustomerOthers      = customerInfoControl.Other;

            mach.IsRefineInstead = MachiningLineItem1.IsRefineInstead;
            mach.RefineNo        = MachiningLineItem1.RefineNo;
            mach.InsteadIntro    = MachiningLineItem1.RefineIntro;
            AddFollowUp(followUpControl, mach.Status, Utility.GetSelectedText(ddlMachiningStatus));
            mach.Status = Utility.GetSelectedText(ddlMachiningStatus);
            dal.Save();
            //save new customer
            customerInfoControl.Save();
            this.SetFocus(sender);
        }
Beispiel #2
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);
        }