コード例 #1
0
        private void newPersonToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddNewPersonOptionForm form = new AddNewPersonOptionForm();

            form.ShowDialog();

            if (form.hasValue)
            {
                string   yearin    = "";
                string   armtown   = "";
                DateTime regisDate = DateTime.MinValue;
                DateTime comeDate  = DateTime.MinValue;
                string   originId  = "";

                yearin    = form.yearin;
                armtown   = form.armtown;
                regisDate = form.regisDate;
                comeDate  = form.comeDate;
                originId  = form.originId;

                AddNewPersonForm form2 = new AddNewPersonForm(form.yearin, form.armtown, form.regisDate, form.comeDate, form.originId);
                form2.MdiParent   = this;
                form2.WindowState = FormWindowState.Maximized;
                //form2.StartPosition = FormStartPosition.CenterParent;
                form2.Show();
            }
            else
            {
            }
        }
コード例 #2
0
        private void gvResult_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (gvResult.SelectedRows.Count > 0)
            {
                string navyid = gvResult.SelectedRows[0].Cells["navyid"].Value.ToString();

                //change con string for get person detail
                string OldConString = Constants.currentConString;
                if (rbAddNew.Checked)
                {
                    Constants.currentConString = dcoreNav.getConnection().ConnectionString;
                }
                else if (rbEditOrDelete.Checked)
                {
                    Constants.currentConString = dcoreNavAll.getConnection().ConnectionString;
                }

                AddNewPersonForm f = new AddNewPersonForm(navyid);
                f.SetbtnSubmitAndNewVisible(false);
                f.SetbtnSubmitVisible(false);
                f.ShowDialog();

                //rollback con string
                Constants.currentConString = OldConString;
            }
        }
コード例 #3
0
        private void btnAddPersonCommand_Click(object sender, EventArgs e)
        {
            var person = AddNewPersonForm.CreatePerson();

            if (person == null)
            {
                return;
            }

            _DomainModel.AddPerson(person.FirstName, person.LastName);
        }
コード例 #4
0
ファイル: SearchPersonForm.cs プロジェクト: theeranan/Navy
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (gvResult.SelectedRows.Count > 0)
     {
         try
         {
             AddNewPersonForm f = new AddNewPersonForm(gvResult.SelectedRows[0].Cells["navyid"].Value.ToString());
             f.SetbtnSubmitAndNewVisible(false);
             f.SetbtnSubmitVisible(true);
             f.Show();
         }
         catch (Exception ex)
         {
             MessageBox.Show("พบข้อผิดพลาดในการเรียกดูข้อมูล .. " + ex.Message);
         }
     }
     else
     {
         MessageBox.Show("กรุณาเลือกข้อมูลก่อน");
     }
 }
コード例 #5
0
        private void gvResult_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                //btnSubmit_Click(sender, e);
                //e.Handled = true;

                if (gvResult.SelectedRows.Count > 0)
                {
                    string navyid = gvResult.SelectedRows[0].Cells["navyid"].Value.ToString();

                    //change con string for get person detail
                    string OldConString = Constants.currentConString;
                    if (rbAddNew.Checked)
                    {
                        Constants.currentConString = dcoreNav.getConnection().ConnectionString;
                    }
                    else if (rbEditOrDelete.Checked)
                    {
                        Constants.currentConString = dcoreNavAll.getConnection().ConnectionString;
                    }

                    AddNewPersonForm f = new AddNewPersonForm(navyid);
                    f.SetbtnSubmitAndNewVisible(false);
                    f.SetbtnSubmitVisible(false);
                    f.ShowDialog();

                    //rollback con string
                    Constants.currentConString = OldConString;
                }
            }

            if (e.KeyCode == Keys.Delete)
            {
            }
        }