예제 #1
0
        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;
                }
            }
        }
예제 #2
0
        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;
            }
        }
예제 #3
0
        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;
            }
        }
예제 #4
0
        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();
        }
예제 #5
0
        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;
            }
        }
예제 #6
0
        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;
            }
        }
예제 #7
0
        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;
                }
            }
        }