private void btnEditOrder_Click(object sender, EventArgs e) { try { ServiceSalesOrder service = new ServiceSalesOrder(); if (SelectedOrderTypeID == service.SO_TYPE_WITHOUT_ORDER_ID) { frmSO_WithoutOrder frm = new frmSO_WithoutOrder(this.SelectedOrderID); if (frm.ShowDialog() == DialogResult.OK) { PopulateSalesOrdersGrid(); } } if (SelectedOrderTypeID == service.SO_TYPE_PRIMARY_ID) { frmSO_Primary frm = new frmSO_Primary(this.SelectedOrderID); if (frm.ShowDialog() == DialogResult.OK) { PopulateSalesOrdersGrid(); } } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "pageSalesOrder::btnEditOrder_Click", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAddTerms_Click(object sender, EventArgs e) { try { frmGridMultiSelect frm = new frmGridMultiSelect(APP_ENTITIES.SALES_ORDER_TERMS_AND_CONDITIONS); frm.Text = "TERMS AND CODITIONS FOR SALES ORDER (Multiselect)"; frm.SingleSelect = false; if (frm.ShowDialog() == DialogResult.OK) { this.Cursor = Cursors.WaitCursor; BindingList <MultiSelectListItem> selectedtTermsAndConditions = frm.SelectedItems; if (selectedtTermsAndConditions == null) { return; } ServiceSalesOrder _service = new ServiceSalesOrder(); foreach (MultiSelectListItem item in selectedtTermsAndConditions.AsEnumerable()) { TBL_MP_CRM_SalesOrder_TermsAndConditions model = new TBL_MP_CRM_SalesOrder_TermsAndConditions(); { model.FK_SalesOrderID = this.SelectedOrderID; model.TermTitle = item.Code; model.Term_Description = item.Description.Replace(item.Code, "").Replace("\n", ""); model.PK_Order_TermID = 0; model.Sequence = 0; _service.AddNewOrderTermAndCondition(model); } } PopulateTermsAndConditions(); this.Cursor = Cursors.Default; } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "ControlSalesOrderTermsAndCondition::btnAddTerms_Click", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.Cursor = Cursors.Default; }
private void btnOK_Click(object sender, EventArgs e) { TBL_MP_CRM_SalesOrder model = null; ServiceSalesOrder service = new ServiceSalesOrder(); try { errorProvider1.Clear(); if (!this.ValidateChildren()) { return; } if (this.SalesOrderID == 0) { model = new TBL_MP_CRM_SalesOrder(); } else { model = service.GetSalesOrderDBInfoByID(this.SalesOrderID); } model.FK_SalesOrderType = service.SO_TYPE_WITHOUT_ORDER_ID; model.SalesOrderNo = txtSalesOrderNo.Text; model.SalesOrderDate = dtSalesOrderDate.Value; model.FK_POSource = ((SelectListItem)cboPOSource.SelectedItem).ID; model.FK_SalesOrderStatus = ((SelectListItem)cboSalesOrderStatus.SelectedItem).ID; model.FK_ClientID = ((SelectListItem)cboClient.SelectedItem).ID; if (txtMaterialSupplyPoNo.Text.Trim() != string.Empty) { model.MaterialSupplyPONo = txtMaterialSupplyPoNo.Text.Trim(); model.MaterialSupplyPODate = dtMaterialSupplyPoDate.Value; model.MaterialSupplyPOValidDays = int.Parse(txtMaterialSupplyPoValidDays.Text.Trim()); model.MaterialSupplyPOExpiryDate = dtMaterialSupplyPoExpiryDate.Value; } else { model.MaterialSupplyPONo = null; model.MaterialSupplyPODate = null; model.MaterialSupplyPOValidDays = null; model.MaterialSupplyPOExpiryDate = null; } if (txtInstallationServicePoNo.Text.Trim() != string.Empty) { model.InstallationServicePONo = txtInstallationServicePoNo.Text.Trim(); model.InstallationServicePODate = dtInstallationServicePoDate.Value; model.InstallationServicePOValidDays = int.Parse(txtInstallationServicePoValidDays.Text.Trim()); model.InstallationServicePOExpiryDate = dtInstallationServicePoExpiryDate.Value; } else { model.InstallationServicePONo = null; model.InstallationServicePODate = null; model.InstallationServicePOValidDays = null; model.InstallationServicePOExpiryDate = null; } if (this.SalesOrderID == 0) { model.CreatedBy = Program.CURR_USER.EmployeeID; model.CreatedDate = AppCommon.GetServerDateTime(); model.FK_CompanyID = Program.CURR_USER.CompanyID; model.FK_BranchID = Program.CURR_USER.BranchID; model.FK_YearID = Program.CURR_USER.FinYearID; this.SalesOrderID = service.AddNewSalesOrder(model); } else { model.ModifiedBy = Program.CURR_USER.EmployeeID; model.ModifiedDate = AppCommon.GetServerDateTime(); service.UpdateSalesOrder(model); } this.DialogResult = DialogResult.OK; } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(errMessage, "frmSO_WithoutOrder::txtInstallationServicePoValidDays_TextChanged", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public pageSalesOrder() { InitializeComponent(); _service = new ServiceSalesOrder(); }
public void PopulateSalesOrderGeneralInfo() { this.Cursor = Cursors.WaitCursor; ServiceSalesOrder _service = new ServiceSalesOrder(); try { //btnApproveSO.Visible = true; DoBlanks(); SelectListItem selItem = null; List <SelectListItem> lst = _service.GetAllSalesOrderStatuses(); TBL_MP_CRM_SalesOrder model = (new ServiceSalesOrder()).GetSalesOrderDBInfoByID(SelectedSalesOrderID); if (model != null) { headerGroupMain.ValuesPrimary.Heading = model.SalesOrderNo; // lblSOApprovalInfo.Text =model.FK_ApprovedBy.ToString(); // lblSOApprovalInfo.StateCommon.Back.Color1 = (model.IsApproved) ? Color.Green : Color.Red; selItem = lst.Where(x => x.ID == model.FK_SalesOrderStatus).FirstOrDefault(); txtSOStatus.Text = selItem.Description; lst = (new ServiceMASTERS()).GetAllPOSources(); selItem = lst.Where(x => x.ID == model.FK_POSource).FirstOrDefault(); txtPOSource.Text = selItem.Description; if (model.MaterialSupplyPONo != null) { txtMaterialSupplyInfo.Text = string.Format("{0} dt. {1}\nfor {2} days till {3}", model.MaterialSupplyPONo, ((DateTime)model.MaterialSupplyPODate).ToString("dd MMM yyyy"), model.MaterialSupplyPOValidDays, ((DateTime)model.MaterialSupplyPOExpiryDate).ToString("dd/MM/yy")); } if (model.InstallationServicePONo != null) { txtInstallationServicesInfo.Text = string.Format("{0} dt. {1}\nfor {2} days till {3}", model.InstallationServicePONo, ((DateTime)model.InstallationServicePODate).ToString("dd MMM yyyy"), model.InstallationServicePOValidDays, ((DateTime)model.InstallationServicePOExpiryDate).ToString("dd/MM/yy")); } if (model.FK_ClientID != null) { txtClientName.Text = String.Format("{0} ({1}) ", model.Tbl_MP_Master_Party.PartyName, model.Tbl_MP_Master_Party.PartyCode); } if (model.FK_QuotationID != null) { txtQuotationInfo.Text = String.Format("{0} dt. {1} ", model.TBL_MP_CRM_SalesQuotation.Quotation_No, model.TBL_MP_CRM_SalesQuotation.Quotation_Date.ToString("dd MMM yyyy")); } if (model.FK_ProjectID != null) { headerProject.Values.Heading = "PROJECT: " + model.TBL_MP_PMC_ProjectMaster.ProjectNumber; txtProjectName.Text = model.TBL_MP_PMC_ProjectMaster.ProjectName; txtStartDate.Text = model.TBL_MP_PMC_ProjectMaster.StartDate.ToString("dd MMM yyyy"); txtEndDate.Text = model.TBL_MP_PMC_ProjectMaster.EndDate.ToString("dd MMM yyyy"); ServiceProject serviceProject = new ServiceProject(); txtBillingAddress.Text = serviceProject.GetProjectBillingAddress((int)model.FK_ProjectID); txtSiteAddr.Text = serviceProject.GetProjectSiteAddress((int)model.FK_ProjectID); } if (model.FK_ApprovedBy == null) { lblSOApprovalInfo.Text = "UN-APPROVED"; lblSOApprovalInfo.StateCommon.Back.Color1 = Color.Red; } else { lblSOApprovalInfo.Text = string.Format("APPROVED : {0}", ServiceEmployee.GetEmployeeNameByID((int)model.FK_ApprovedBy)); lblSOApprovalInfo.StateCommon.Back.Color1 = Color.Green; } if (!ReadOnly) { WhosWhoModel modell = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == this.SALES_ORDER_FORM_ID).FirstOrDefault(); if (modell != null) { if (modell.CanApprove) { if (model.FK_ApprovedBy == null) { btnApproveSO.Visible = true; } else { btnApproveSO.Visible = false; } } else { btnApproveSO.Visible = false; } } } /* * lblSOApprovalInfo.Text = "Unapproved Order"; * lblSOApprovalInfo.StateCommon.Back.Color1 = (model.FK_ApprovedBy == null) ? Color.Red : Color.Green; * WhosWhoModel premission = Program.CONTROL_ACCESS.ListControlAccess.Where(x => x.FormID == DB_FORM_IDs.SALES_ORDER).FirstOrDefault(); * if (premission != null) * { * if (premission.CanApprove) * if (model.FK_ApprovedBy == null) * btnApproveSO.Visible = true; * else * { * lblSOApprovalInfo.Text = string.Format("Approved: {0}", ServiceEmployee.GetEmployeeNameByID((int)model.FK_ApprovedBy)); * btnApproveSO.Visible = false; * } * else * btnApproveSO.Visible = false; * } */ } } catch (Exception ex) { string errMessage = ex.Message; if (ex.InnerException != null) { errMessage += string.Format("\n{0}", ex.InnerException.Message); } MessageBox.Show(ex.Message, "ControlSalesOrderGeneralInfo::PopulateSalesOrderGeneralInfo", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.Cursor = Cursors.Default; }