private void C_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if ((sender is TextBox) && (sender as TextBox).Name == "tbxCompany")
                {
                    TextBox activeCompanyControl = sender as TextBox;

                    if (String.IsNullOrWhiteSpace(activeCompanyControl.Text))
                    {
                        frmCompany frmCompanyMaster = new frmCompany();
                        frmCompanyMaster.IsInChildMode = true;
                        //Set Child UI
                        ExtensionMethods.AddChildFormToPanel(this, frmCompanyMaster, ExtensionMethods.MainPanel);
                        frmCompanyMaster.WindowState = FormWindowState.Maximized;
                        frmCompanyMaster.Show();
                        frmCompanyMaster.FormClosed += FrmCompanyMaster_FormClosed;
                    }
                    else
                    {
                        SendKeys.Send("{TAB}");
                    }
                }
                else
                {
                    SendKeys.Send("{TAB}");
                }
            }
        }
        private void OpenCustomerLedgerddUpdateForm(bool isEdit)
        {
            try
            {
                frmCustomerLedgerMasterAddUpdate form = new frmCustomerLedgerMasterAddUpdate(isEdit);
                form.IsInChildMode = true;
                ExtensionMethods.AddChildFormToPanel(this, form, ExtensionMethods.MainPanel);
                form.WindowState = FormWindowState.Maximized;

                if (isEdit && dgvCustomerLedger.SelectedRows[0] != null)
                {
                    CustomerLedgerMaster existingItem = (CustomerLedgerMaster)dgvCustomerLedger.SelectedRows[0].DataBoundItem;
                    form.frmCustomerLedgerMasterAddUpdate_Fill_UsingExistingItem(existingItem);
                    form.LoadCustomerCompanyDiscountGrid();
                }
                form.FormClosed += Form_FormClosed;
                form.Show();

                if (!isEdit)
                {
                    CustomerLedgerMaster nextCust = new CustomerLedgerMaster()
                    {
                        CustomerLedgerName = txtSearch.Text
                    };
                    form.ConfigureCustomerLedger(nextCust);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvCustomerLedger.SelectedRows.Count == 0)
                {
                    MessageBox.Show("Please select atleast one row to edit");
                }

                if (dgvCustomerLedger.SelectedRows[0] != null)
                {
                    frmCustomerLedgerMasterAddUpdate form = new frmCustomerLedgerMasterAddUpdate(true);
                    form.IsInChildMode = true;
                    ExtensionMethods.AddChildFormToPanel(this, form, ExtensionMethods.MainPanel);
                    form.WindowState = FormWindowState.Maximized;

                    CustomerLedgerMaster existingItem = (CustomerLedgerMaster)dgvCustomerLedger.SelectedRows[0].DataBoundItem;
                    form.frmCustomerLedgerMasterAddUpdate_Fill_UsingExistingItem(existingItem);
                    form.LoadCustomerCompanyDiscountGrid();

                    form.FormClosed += Form_FormClosed;
                    form.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 4
0
        void AddEditSupplierLedger(int supplierId)
        {
            frmSupplierLedgerAddUpdate frmSupplierAddUpdate = new frmSupplierLedgerAddUpdate(supplierId, txtSearch.Text);

            frmSupplierAddUpdate.IsInChildMode = true;

            ExtensionMethods.AddChildFormToPanel(this, frmSupplierAddUpdate, ExtensionMethods.MainPanel);
            frmSupplierAddUpdate.WindowState = FormWindowState.Maximized;

            frmSupplierAddUpdate.FormClosed += FormSupplierLedgerAddUpdate_FormClosed;
            frmSupplierAddUpdate.Show();
        }
        private void C_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (sender is TextBox)
                {
                    TextBox activePersonRouteType       = sender as TextBox;
                    string  activePersonRouteTypeString = String.Empty;
                    bool    isValidTextbox = false;

                    switch (activePersonRouteType.Name)
                    {
                    case "tbxArea":
                    {
                        activePersonRouteType       = tbxArea;
                        activePersonRouteTypeString = Constants.RecordType.AREADISPLAYNAME;
                        isValidTextbox = true;
                    }
                    break;
                    }

                    if (isValidTextbox && String.IsNullOrWhiteSpace(activePersonRouteType.Text))
                    {
                        PersonRouteMaster personRouteMaster = new PersonRouteMaster()
                        {
                            RecordTypeNme   = activePersonRouteTypeString,
                            PersonRouteID   = ExtensionMethods.SafeConversionInt(Convert.ToString(activePersonRouteType.Tag)) ?? 0,
                            PersonRouteName = activePersonRouteType.Text
                        };

                        frmPersonRouteMaster frmPersonRouteMaster = new frmPersonRouteMaster();
                        frmPersonRouteMaster.IsInChildMode = true;
                        //Set Child UI
                        ExtensionMethods.AddChildFormToPanel(this, frmPersonRouteMaster, ExtensionMethods.MainPanel);
                        frmPersonRouteMaster.WindowState = FormWindowState.Maximized;
                        frmPersonRouteMaster.FormClosed += FrmPersonRouteMaster_FormClosed;
                        frmPersonRouteMaster.Show();
                        frmPersonRouteMaster.ConfigurePersonRoute(personRouteMaster);
                    }
                    else
                    {
                        SendKeys.Send("{TAB}");
                    }
                }
                else
                {
                    SendKeys.Send("{TAB}");
                }
            }
        }
Exemplo n.º 6
0
        private void OpenItemAddUpdateForm(int itemId)
        {
            frmItemMasterAddUpdated form = new frmItemMasterAddUpdated(itemId, txtSearch.Text);

            form.IsInChildMode = true;
            ExtensionMethods.AddChildFormToPanel(this, form, ExtensionMethods.MainPanel);
            form.WindowState = FormWindowState.Maximized;


            if (itemId > 0 && dgvItemList.SelectedRows[0] != null)
            {
                form.frmItemMasterAddUpdate_Fill_UsingExistingItem(GetCurrentRowItem());
            }

            form.FormClosed += FormItemMasterAddUpdated_FormClosed;
            form.Show();
        }
 private void dgvCustomerLedger_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex != -1)
         {
             frmCustomerLedgerMasterAddUpdate form = new frmCustomerLedgerMasterAddUpdate(true);
             form.IsInChildMode = true;
             ExtensionMethods.AddChildFormToPanel(this, form, ExtensionMethods.MainPanel);
             CustomerLedgerMaster existingItem = (CustomerLedgerMaster)dgvCustomerLedger.CurrentRow.DataBoundItem;
             form.frmCustomerLedgerMasterAddUpdate_Fill_UsingExistingItem(existingItem);
             form.LoadCustomerCompanyDiscountGrid();
             form.FormClosed += Form_FormClosed;
             form.Show();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        //ADD/UPDATE/DELETE Functionality

        private void btnAddNew_Click(object sender, EventArgs e)
        {
            try
            {
                frmCustomerLedgerMasterAddUpdate form = new frmCustomerLedgerMasterAddUpdate(false);
                form.IsInChildMode = true;
                ExtensionMethods.AddChildFormToPanel(this, form, ExtensionMethods.MainPanel);
                form.WindowState = FormWindowState.Maximized;
                form.FormClosed += Form_FormClosed;
                form.Show();

                CustomerLedgerMaster nextCust = new CustomerLedgerMaster()
                {
                    CustomerLedgerName = txtSearch.Text
                };
                form.ConfigureCustomerLedger(nextCust);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 9
0
        private void btnBatches_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvItemList.SelectedRows.Count == 0)
                {
                    MessageBox.Show("Please select atleast one row to edit batch");
                }
                else
                {
                    DataGridViewRow row = dgvItemList.CurrentRow;

                    frmBatches form = new frmBatches(Convert.ToString(row.Cells["ItemCode"].Value), Convert.ToString(row.Cells["ItemName"].Value));
                    ExtensionMethods.AddChildFormToPanel(this, form, ExtensionMethods.MainPanel);
                    form.WindowState = FormWindowState.Maximized;
                    form.FormClosed += FormBatch_Closed;
                    form.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }