コード例 #1
0
        private void personalDetailsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmEmployeeDetails pFrmEmployeeDetails = new frmEmployeeDetails(mFormName);

            pFrmEmployeeDetails.ShowDialog();
        }
コード例 #2
0
        private void mnuEmployeeDetails_Click(object sender, EventArgs e)
        //===============================================================
        {
            this.Hide();
            frmEmployeeDetails pFrmEmployeeDetails = new frmEmployeeDetails(mFormName);

            pFrmEmployeeDetails.ShowDialog();
        }
コード例 #3
0
 private void grdEmployeeDetailDisplay_CellContentClick(object sender, DataGridViewCellEventArgs e)
 //=================================================================================================
 {
     if (e.ColumnIndex == 9)
     {
         int pUserId = Convert.ToInt32(grdEmployeeDetailDisplay.Rows[e.RowIndex].Cells[e.ColumnIndex - 9].Value.ToString());
         Program.gBE.UserId = pUserId;
         string          pFormName        = "Employee Details";
         frmEmployeeEdit pFrmEmployeeEdit = new frmEmployeeEdit(pFormName);
         pFrmEmployeeEdit.ShowDialog();
     }
     if (e.ColumnIndex == 10)
     {
         int pUserId = Convert.ToInt32(grdEmployeeDetailDisplay.Rows[e.RowIndex].Cells[e.ColumnIndex - 10].Value.ToString());
         Program.gBE.UserId = pUserId;
         MessageBoxButtons buttons = MessageBoxButtons.YesNo;
         if (mBA.IsDeleteAdmin(Program.gBE) == "ADMIN")
         {
             DialogResult result = MessageBox.Show("Are you sure you want to delete? Admin deletion will forcefully sign out the application. You have to re-login again.", "Admin Deletion", buttons, MessageBoxIcon.Warning);
             if (result == System.Windows.Forms.DialogResult.Yes)
             {
                 if (mBA.DeleteUser(Program.gBE) > 0)
                 {
                     MessageBox.Show("Admin Deleted Successufully.");
                     Application.Restart();
                 }
             }
         }
         else
         {
             DialogResult result = MessageBox.Show("Are you sure you want to delete?", "User Deletion", buttons, MessageBoxIcon.Warning);
             if (result == System.Windows.Forms.DialogResult.Yes)
             {
                 if (mBA.DeleteUser(Program.gBE) > 0)
                 {
                     MessageBox.Show("User Deleted Successufully.");
                     this.Hide();
                     frmEmployeeDetails pFrmEmployeeDetails = new frmEmployeeDetails(mFormName);
                     pFrmEmployeeDetails.ShowDialog();
                 }
             }
         }
     }
 }
コード例 #4
0
        private void cmdSave_Click(object sender, EventArgs e)
        //===================================================
        {
            if (txtAddress.Text == "" || txtPincode.Text == "" || txtDateOfBirth.Text == "" || txtContactNumber.Text == "" || txtEmailId.Text == "")
            {
                MessageBox.Show("Please fill in all fields", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtAddress.Focus();
                return;
            }
            if (!Regex.Match(txtPincode.Text, @"^\d{6}$").Success)
            {
                MessageBox.Show("Please input 6 digit integer value as Pincode.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPincode.Focus();
                return;
            }
            DateTime pDate = Convert.ToDateTime(DateTime.Now.ToShortDateString());

            if (Convert.ToDateTime(dtpDateOfBirth.Text).Year > pDate.Year - 18)
            {
                MessageBox.Show("User Age should be Minimum 18 Years. Please input Proper Date of Birth.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                dtpDateOfBirth.Focus();
                return;
            }
            if (!Regex.Match(txtContactNumber.Text, @"^\d{10}$").Success)
            {
                MessageBox.Show("Please input 6 digit integer value as Phone Number.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtContactNumber.Focus();
                return;
            }
            if (!Regex.Match(txtEmailId.Text, @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$").Success)
            {
                MessageBox.Show("Invalid Email Id", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtEmailId.Focus();
                return;
            }
            Program.gBE.UserId      = Convert.ToInt32(txtId.Text.ToString());
            Program.gBE.UserAddress = txtAddress.Text.ToString();
            Program.gBE.UserPincode = Convert.ToInt32(txtPincode.Text.ToString());
            if (optMale.Checked == true)
            {
                Program.gBE.UserGender = optMale.Text.ToString();
            }
            else if (optFemale.Checked == true)
            {
                Program.gBE.UserGender = optFemale.Text.ToString();
            }
            else
            {
                Program.gBE.UserGender = optOther.Text.ToString();
            }
            Program.gBE.UserDOB           = Convert.ToDateTime(txtDateOfBirth.Text.ToString());
            Program.gBE.UserContactNo     = Convert.ToInt64(txtContactNumber.Text.ToString());
            Program.gBE.UserEmail         = txtEmailId.Text.ToString();
            Program.gBE.UserQualification = cmbQualification.SelectedItem.ToString();
            if (mBA.EditUserPersonalDetails(Program.gBE) > 0)
            {
                MessageBox.Show("User Personal Details Updated Successufully.");
                this.Hide();
                frmEmployeeDetails pFrmEmployeeDetails = new frmEmployeeDetails(mFormName);
                pFrmEmployeeDetails.ShowDialog();
            }
        }