Ejemplo n.º 1
0
 public PopupDealerModelControl(Panel vPanel, Panel hPanel, Form popUpForm, DealerControl dealerControl)
 {
     _popUpForm     = popUpForm;
     _vPanel        = vPanel;
     _hPanel        = hPanel;
     _dealerControl = dealerControl;
     InitializeComponent();
     this.Load += new System.EventHandler(this.PopupModelControl_Load);
 }
Ejemplo n.º 2
0
        private void BUC_Dealers_Click(object sender, EventArgs e)
        {
            _hPanel.Controls.Clear();
            DealerControl dc = new DealerControl(_vPanel, _hPanel);

            _hPanel.Controls.Add(dc);
            dc.Dock = DockStyle.Fill;
            dc.Show();
        }
Ejemplo n.º 3
0
        private void BindInterfaceDataToObject()
        {
            _dealer.DealerName = TB_PMC_DealerName.Text;
            _dealer.Code       = TB_PMC_DealerCode.Text;
            _dealer.Address    = TB_PMC_DealerAddress.Text;
            _dealer.Contact    = TB_PMC_DealerContact.Text;

            if (_dealer.DealerName.Equals("") ||
                _dealer.Code.Equals("") ||
                _dealer.Address.Equals("") ||
                _dealer.Contact.Equals(""))
            {
                MessageBox.Show("Fill up all boxes!!");
            }
            else
            {
                ConfirmChange();
            }

            void ConfirmChange()
            {
                DialogResult dialogResult = MessageBox.Show(BPMC_AddOrUpdate.Text + " Dealer? ", "Confirm Change?", MessageBoxButtons.YesNo);

                if (dialogResult == DialogResult.Yes)
                {
                    if (_dealer != null)
                    {
                        if (BPMC_AddOrUpdate.Text.Equals("Update"))
                        {
                            if (DealerManager.UpdateDealer(_dealer))
                            {
                                MessageBox.Show("Dealer Updated successfully!");

                                ReloadDealerControl();
                            }
                            else
                            {
                                MessageBox.Show("Error! Dealer Code already Exist! Dealer Code must be unique!");
                            }
                        }
                        else if (BPMC_AddOrUpdate.Text.Equals("Add"))
                        {
                            if (DealerManager.AddDealer(_dealer))
                            {
                                MessageBox.Show("Dealer Added successfully!");

                                ReloadDealerControl();
                            }
                            else
                            {
                                MessageBox.Show("Error! Dealer Code already Exist! Dealer Code must be unique!");
                            }
                        }
                    }
                    else
                    {
                    }
                }
                else if (dialogResult == DialogResult.No)
                {
                    //do something else
                }

                void ReloadDealerControl()
                {
                    _hPanel.Controls.Clear();
                    _dealerControl = new DealerControl(_vPanel, _hPanel);
                    _hPanel.Controls.Add(_dealerControl);
                    _dealerControl.Dock = DockStyle.Fill;
                    _dealerControl.Show();
                    _popUpForm.Close();
                }
            }
        }
Ejemplo n.º 4
0
 public PopupDealerModelControl(Panel vPanel, Panel hPanel, DealerModel dealer, DealerControl dealerControl, Form popUpForm)
     : this(vPanel, hPanel, popUpForm, dealerControl)
 {
     _dealer = dealer;
 }