protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Utility.BindDataToDropdown(ddlPurchaseStatus, Utility.GetPurchaseStatusList()); Utility.BindDataToDropdown(ddlApplyPurchaseMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlApproveMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlMachMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlMachTableMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlPurchaseMan, Utility.GetUserList2(true)); Utility.BindDataToDropdown(ddlSalesMan, Utility.GetUserList2(true)); PurchaseOrderDAL dal = new PurchaseOrderDAL(); var po = dal.GetPOByNo(PONo); txtPurchaseId.Text = po.Purchase_No; txtPurchaseCreatedDate.Text = po.CreatedDate.ToString("yyyy-MM-dd"); txtApplyPurchaseDate.Text = po.ApplyPurchaseDate.HasValue ? po.ApplyPurchaseDate.Value.ToString("yyyy-MM-dd") : string.Empty; txtExpectedCompleteDate.Text = po.ExpectedCompleteDate.HasValue ? po.ExpectedCompleteDate.Value.ToString("yyyy-MM-dd") : string.Empty; ddlSalesMan.SelectedValue = po.EnqOrdMan; ddlMachMan.SelectedValue = po.MachiningCreateMan; ddlPurchaseMan.SelectedValue = po.PurchaseMan; ddlApplyPurchaseMan.SelectedValue = po.PurchaseApplyMan; ddlApproveMan.SelectedValue = po.ApproveMan; ddlMachTableMan.SelectedValue = po.MachTableCreateMan; txtPurchaseSummary.Text = po.PurchaseIntro; //purchase content BindControl(); //status ddlPurchaseStatus.SelectedValue = po.Status; //followup UIUtility.BindUserControl(followUpControl, SysConst.SourceTypePurchase, PONo); } }
protected void btnSave_Click(object sender, EventArgs e) { PurchaseOrderDAL dal = new PurchaseOrderDAL(); var po = dal.GetPOByNo(PONo); if (!string.IsNullOrEmpty(txtApplyPurchaseDate.Text)) { po.ApplyPurchaseDate = DateTime.Parse(txtApplyPurchaseDate.Text); } if (!string.IsNullOrEmpty(txtExpectedCompleteDate.Text)) { po.ExpectedCompleteDate = DateTime.Parse(txtExpectedCompleteDate.Text); } po.EnqOrdMan = Utility.GetSelectedText(ddlSalesMan); po.MachiningCreateMan = Utility.GetSelectedText(ddlSalesMan); po.PurchaseMan = Utility.GetSelectedText(ddlPurchaseMan); po.PurchaseApplyMan = Utility.GetSelectedText(ddlApplyPurchaseMan); po.ApproveMan = Utility.GetSelectedText(ddlApproveMan); po.MachTableCreateMan = Utility.GetSelectedText(ddlMachTableMan); po.PurchaseIntro = txtPurchaseSummary.Text; AddFollowUp(followUpControl, po.Status, Utility.GetSelectedText(ddlPurchaseStatus)); po.Status = Utility.GetSelectedText(ddlPurchaseStatus); dal.Save(); SetFocus(sender); }
protected void btnChangeStatus_Click(object sender, EventArgs e) { PurchaseOrderDAL dal = new PurchaseOrderDAL(); var po = dal.GetPOByNo(PONo); AddFollowUp(followUpControl, po.Status, Utility.GetSelectedText(ddlPurchaseStatus)); po.Status = Utility.GetSelectedText(ddlPurchaseStatus); dal.Save(); SetFocus(sender); }