private void DiscountCardDistribution( Customer customer, string currentCardType, string nextCardType) { if (customer == null) { return; } if (customer.DiscountRejected == 1) { return; } string briefMsgStr, detailMsgStr; if (String.IsNullOrEmpty(currentCardType)) { briefMsgStr = "ការប្រគល់ប័ណ្ណបញ្ចុះតំលៃ"; detailMsgStr = String.Format( "សូមមេត្តាផ្ដល់ប័ណ្ណកាតបញ្ចុះតំលៃប្រភេទ {0} ជូនទៅអតិថិជន {1}", nextCardType, customer.CustomerName); } else { briefMsgStr = "កាផ្លាស់ប្ដូរប័ណ្ណបញ្ចុះតំលៃ"; detailMsgStr = string.Format( "សូមមេត្តាប្ដូរប័ណ្ណបញ្ចុះតំលៃពីប្រភេទ {0} ទៅប្រភេទ {1} ជូនអតិថិជន {2}", currentCardType, nextCardType, customer.CustomerName); } using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsgStr; frmMessageBox.DetailMsgStr = detailMsgStr; if (frmMessageBox.ShowDialog(this) != DialogResult.OK) { return; } Visible = false; using (var frmCustomer = new FrmCustomer()) { frmCustomer.Customer = customer; if (frmCustomer.ShowDialog(this) == DialogResult.OK) { Customer = frmCustomer.Customer; } Visible = true; } } }
private void ManageCustomer(Customer customer, string operationStr) { if (String.IsNullOrEmpty(operationStr)) { return; } Visible = false; using (var frmCustomer = new FrmCustomer()) { DiscountCard discountCard = null; if (customer != null) { frmCustomer.Customer = customer; discountCard = customer.FkDiscountCard; } if (frmCustomer.ShowDialog(this) == DialogResult.OK) { try { //Remove existing discount card of selected customer if (discountCard != null) { _discountCardList.Remove(discountCard); } //Add new discount card of selected customer if (frmCustomer.Customer.FkDiscountCard != null) { _discountCardList.Add(frmCustomer.Customer.FkDiscountCard); } //Customer if (operationStr.Equals(Resources.OperationRequestInsert)) { _customerList.Add(frmCustomer.Customer); } else { _customerList[_customerList.IndexOf(lsbCustomer.SelectedItem as Customer)] = frmCustomer.Customer; } lsbCustomer.SelectedIndex = -1; lsbCustomer.SelectedIndex = lsbCustomer.FindStringExact(frmCustomer.Customer.CustomerName); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } } Visible = true; } }
private void BtnNewClick(object sender, EventArgs e) { if (!UserService.AllowToPerform(Resources.PermissionAddCustomer)) { const string briefMsg = "អំពីសិទ្ឋប្រើប្រាស់"; const string detailMsg = "អ្នកពុំមានសិទ្ឋគ្រប់គ្រាន់សំរាប់ការស្នើរសុំនេះឡើយ ។"; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); } return; } Visible = false; using (var frmCustomer = new FrmCustomer()) { if (frmCustomer.ShowDialog(this) == DialogResult.OK) { try { _customerList.Add(frmCustomer.Customer); if (frmCustomer.Customer.FkDiscountCard != null) { _discountCardList.Add(frmCustomer.Customer.FkDiscountCard); } lsbCustomer.SelectedIndex = -1; lsbCustomer.SelectedIndex = lsbCustomer.FindStringExact(frmCustomer.Customer.CustomerName); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } } Visible = true; } }
private void CustomerManagement(IEquatable<string> operationRequest) { using (var frmCustomer = new FrmCustomer()) { frmCustomer.CommonService = _commonService; frmCustomer.CustomerService = _customerService; if (operationRequest.Equals(Resources.OperationRequestUpdate)) if (dgvCustomer.CurrentRow != null) frmCustomer.Customer = _customerList[dgvCustomer.CurrentRow.Index]; if (frmCustomer.ShowDialog(this) == DialogResult.OK) { try { ThreadStart threadStart = UpdateControlContent; var thread = new Thread(threadStart); thread.Start(); if (operationRequest.Equals(Resources.OperationRequestInsert)) _customerList.Add(frmCustomer.Customer); dgvCustomer.Refresh(); SetCustomerInfo(); UpdateResultInfo(); EnableActionButton(); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } } } SetFocusToCustomerList(); }
private void BtnNewClick(object sender, EventArgs e) { if (!UserService.AllowToPerform(Resources.PermissionAddCustomer)) { const string briefMsg = "អំពីសិទ្ឋប្រើប្រាស់"; const string detailMsg = "អ្នកពុំមានសិទ្ឋគ្រប់គ្រាន់សំរាប់ការស្នើរសុំនេះឡើយ ។"; using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsg; frmMessageBox.DetailMsgStr = detailMsg; frmMessageBox.IsCanceledOnly = true; frmMessageBox.ShowDialog(this); } return; } Visible = false; using (var frmCustomer = new FrmCustomer()) { if (frmCustomer.ShowDialog(this) == DialogResult.OK) { try { _customerList.Add(frmCustomer.Customer); if (frmCustomer.Customer.FkDiscountCard != null) _discountCardList.Add(frmCustomer.Customer.FkDiscountCard); lsbCustomer.SelectedIndex = -1; lsbCustomer.SelectedIndex = lsbCustomer.FindStringExact(frmCustomer.Customer.CustomerName); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } } Visible = true; } }
private void ManageCustomer(Customer customer, string operationStr) { if (String.IsNullOrEmpty(operationStr)) return; Visible = false; using (var frmCustomer = new FrmCustomer()) { DiscountCard discountCard = null; if (customer != null) { frmCustomer.Customer = customer; discountCard = customer.FkDiscountCard; } if (frmCustomer.ShowDialog(this) == DialogResult.OK) { try { //Remove existing discount card of selected customer if (discountCard != null) _discountCardList.Remove(discountCard); //Add new discount card of selected customer if (frmCustomer.Customer.FkDiscountCard != null) _discountCardList.Add(frmCustomer.Customer.FkDiscountCard); //Customer if (operationStr.Equals(Resources.OperationRequestInsert)) _customerList.Add(frmCustomer.Customer); else _customerList[_customerList.IndexOf(lsbCustomer.SelectedItem as Customer)] = frmCustomer.Customer; lsbCustomer.SelectedIndex = -1; lsbCustomer.SelectedIndex = lsbCustomer.FindStringExact(frmCustomer.Customer.CustomerName); } catch (Exception exception) { FrmExtendedMessageBox.UnknownErrorMessage( Resources.MsgCaptionUnknownError, exception.Message); } } Visible = true; } }
private void DiscountCardDistribution( Customer customer, string currentCardType, string nextCardType) { if (customer == null) return; if (customer.DiscountRejected == 1) return; string briefMsgStr, detailMsgStr; if (String.IsNullOrEmpty(currentCardType)) { briefMsgStr = "ការប្រគល់ប័ណ្ណបញ្ចុះតំលៃ"; detailMsgStr = String.Format( "សូមមេត្តាផ្ដល់ប័ណ្ណកាតបញ្ចុះតំលៃប្រភេទ {0} ជូនទៅអតិថិជន {1}", nextCardType, customer.CustomerName); } else { briefMsgStr = "កាផ្លាស់ប្ដូរប័ណ្ណបញ្ចុះតំលៃ"; detailMsgStr = string.Format( "សូមមេត្តាប្ដូរប័ណ្ណបញ្ចុះតំលៃពីប្រភេទ {0} ទៅប្រភេទ {1} ជូនអតិថិជន {2}", currentCardType, nextCardType, customer.CustomerName); } using (var frmMessageBox = new FrmExtendedMessageBox()) { frmMessageBox.BriefMsgStr = briefMsgStr; frmMessageBox.DetailMsgStr = detailMsgStr; if (frmMessageBox.ShowDialog(this) != DialogResult.OK) return; Visible = false; using (var frmCustomer = new FrmCustomer()) { frmCustomer.Customer = customer; if (frmCustomer.ShowDialog(this) == DialogResult.OK) Customer = frmCustomer.Customer; Visible = true; } } }