Esempio n. 1
0
 private void personRouteMasterToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         frmPersonRouteMaster form = new frmPersonRouteMaster();
         ExtensionMethods.AddFormToPanel(form, pnlMain);
         form.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        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}");
                }
            }
        }