protected void btnChangeStatus_Click(object sender, EventArgs e) { MachiningDAL dal = new MachiningDAL(); var mach = dal.GetMachByNo(MachNo); AddFollowUp(followUpControl, mach.Status, Utility.GetSelectedText(ddlMachiningStatus)); SetFocus(btnChangeStatus); }
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); }
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); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Utility.BindDataToDropdown(ddlMachiningStatus, Utility.GetMachiningStatusList()); Utility.BindDataToDropdown(ddlMachCreateMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlMachTableMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlSalesMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlRefineMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlSurveyMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlMachProcessor, Utility.GetUserList2(true)); if (!string.IsNullOrWhiteSpace(MachNo)) { MachiningDAL dal = new MachiningDAL(); var mach = dal.GetMachByNo(MachNo); OrderDAL sDAL = new OrderDAL(); var order = sDAL.GetOrderByNo(SourceNo); lnkSource.NavigateUrl = Page.ResolveUrl(string.Format("~/OrderForm.aspx?ordno={0}&ordid={1}&sourceno={2}&sourcetype={3}", order.Order_No, order.Order_Id, order.SourceNo, order.SourceType)); lnkSource.Text = SourceNo; txtCreatedDate.Text = mach.CreatedDate.ToString("yyyy-MM-dd"); ddlMachCreateMan.SelectedValue = mach.MachCreateMan; ddlMachTableMan.SelectedValue = mach.ProcessCreateMan; ddlSalesMan.SelectedValue = mach.SalesMan; ddlRefineMan.SelectedValue = mach.RefineMan; ddlSurveyMan.SelectedValue = mach.SurveyMan; ddlMachProcessor.SelectedValue = mach.MachMan; txtApplyDate.Text = mach.ApplyDate.HasValue ? mach.ApplyDate.Value.ToString("yyyy-MM-dd") : string.Empty; txtExpectedCompletedDate.Text = mach.ExpectedCompleteDate.HasValue ? mach.ExpectedCompleteDate.Value.ToString("yyyy-MM-dd") : string.Empty; txtCompletedDate.Text = mach.CompleteDate.HasValue ? mach.CompleteDate.Value.ToString("yyyy-MM-dd") : string.Empty; txtExpectedDeliveryDate.Text = mach.ExpectedDeliveryDate.HasValue ? mach.ExpectedDeliveryDate.Value.ToString("yyyy-MM-dd") : string.Empty; txtExpectedInstallDate.Text = mach.ExpectedInstallDate.HasValue ? mach.ExpectedInstallDate.Value.ToString("yyyy-MM-dd") : string.Empty; txtMachiningSummary.Text = mach.MachIntro; //customer info this.customerInfoControl.SetValue( mach.CustomerCompanyName, mach.CustomerContactName, mach.CustomerAddress, mach.CustomerEmail, mach.CustomerQQ, mach.CustomerPhone1, mach.CustomerPhone2, mach.CustomerOthers); //history refine UIUtility.BindUserControl(cADRefinementControl, SysConst.SourceTypeOrder, SourceNo); //customer drawing customerDrawingControl.IsCustomerProvideImage = order.IsCustomerProvideImage; UIUtility.BindUserControl(customerDrawingControl, SysConst.SourceTypeOrder, order.Order_No); //survey UIUtility.BindUserControl(surveyControl, SysConst.SourceTypeOrder, SourceNo); //purchase UIUtility.BindUserControl(PurchaseControl1, SysConst.SourceTypeMaching, mach.Mach_No); //machining table MachiningLineItem1.IsRefineInstead = mach.IsRefineInstead; MachiningLineItem1.RefineNo = mach.RefineNo; MachiningLineItem1.RefineIntro = mach.InsteadIntro; MachiningLineItem1.OrderNo = order.Order_No; MachiningLineItem1.MachId = mach.Mach_Id; UIUtility.BindUserControl(MachiningLineItem1, SysConst.SourceTypeMaching, mach.Mach_No); //maching summary MachiningSummaryControl1.MachId = mach.Mach_Id; UIUtility.BindUserControl(MachiningSummaryControl1, SysConst.SourceTypeMaching, mach.Mach_No); //status ddlMachiningStatus.SelectedValue = mach.Status; //followup UIUtility.BindUserControl(followUpControl, SysConst.SourceTypeOrder, order.Order_No); } } }