protected void BtnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         bool        flag = false;
         bool        b;
         EmployeeBLL obj1 = new EmployeeBLL();
         if (ddlShift.SelectedIndex == 0)
         {
             lblMessage.Text = "Please Select Shift Name";
             ddlShift.Focus();
             return;
         }
         List <EntityFacAllocEmp> lst = new EmployeeBLL().GetAllocatedEmpToShift(Convert.ToInt32(ddlShift.SelectedValue));
         int RowCount = 0;
         int TotalRow = dgvAllEmp.Rows.Count;
         int Freq     = 0;
         foreach (GridViewRow item in dgvAllEmp.Rows)
         {
             Freq++;
             CheckBox CheckBox = item.FindControl("chkSelect") as CheckBox;
             if (CheckBox.Checked)
             {
                 RowCount++;
                 lst.Add(new EntityFacAllocEmp {
                     Emp_Id = Convert.ToInt32(item.Cells[1].Text), FullName = Convert.ToString(item.Cells[2].Text)
                 });
             }
             if (Freq == TotalRow && RowCount == 0)
             {
                 lblMessage.Text = "Please Select Employee";
             }
         }
         if (flag)
         {
             lblMessage.Text = "Invalid Employee Allocation..";
             foreach (GridView item in dgvAllEmp.Rows)
             {
                 item.Columns[0].Visible = true;//
             }
         }
         else
         {
             dgvAllocEmp.AutoGenerateColumns = false;
             dgvAllocEmp.DataSource          = lst;
             dgvAllocEmp.DataBind();
         }
     }
     catch (Exception ex)
     {
         lblMessage.Text = ex.Message;
     }
 }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         // You can add validation rules here or in the EmployeeBLL class
         if (EmployeeBLL.Add(txtFirstName.Value, txtLastName.Value, Convert.ToInt32(txtAge.Value), Convert.ToInt32(ddlCountries.SelectedValue)))
         {
             lbMsg.Text = "The new employee was inserted successfully";
         }
     }
     catch (Exception ex)
     {
         lbMsg.Text = "error";
         AppLogger.WriteLog(ex.ToString());
     }
 }
Exemple #3
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        emp.empName     = empName.Text;
        emp.empSex      = empSex.Text;
        emp.empBirthday = empBirthday.Text;
        emp.deptId      = deptId.Text;
        emp.postId      = postId.Text;
        Response.Write("<script>('添加成功!')</script>");

        if (bll.Add(emp) == 1)
        {
            Response.Write("<script>('添加成功!')</script>");
        }
        else
        {
            Response.Write("<script>('添加失败!')</script>");
        }
    }
Exemple #4
0
        private void btnEmployeeAdd_Click(object sender, EventArgs e)
        {
            if (txtFirstName.Text != string.Empty && txtLastName.Text != string.Empty && txtMail.Text != string.Empty && txtPassword.Text != string.Empty)
            {
                if (_updateEmployee == null)
                {
                    int pass = rnd.Next(10000000, 99999999);

                    employee.FirstName  = txtFirstName.Text;
                    employee.LastName   = txtLastName.Text;
                    employee.PositionID = (int)cmbPosition.SelectedValue;
                    employee.EMail      = txtMail.Text;
                    employee.Password   = pass.ToString();
                    if (employeeBLL.Add(employee))
                    {
                        mail mail = new mail();
                        if (mail.SentMail(txtMail.Text, "Aramıza hoşgeldiniz", string.Format(
                                              "Değerli çalışanımız : {0}\n\nBizimle olmanızdan dolayı mutluyuz\n\nSistemi kullanmak için bilgileriniz : \n\nMail Adres:{1}\nParola : {2}\n\n\n\nİyi Çalışmalar dileriz\n\nBlack Group"
                                              , employee.FullName, employee.EMail, employee.Password
                                              )))
                        {
                            MessageBox.Show("Çalışan kaydı oluşturuldu bilgiler çalışan mail adresine gönderildi");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Kayıt Ekleme Başarısız");
                    }
                }
                else
                {
                    _updateEmployee.FirstName  = txtFirstName.Text;
                    _updateEmployee.LastName   = txtLastName.Text;
                    _updateEmployee.PositionID = (int)cmbPosition.SelectedValue;
                    _updateEmployee.EMail      = txtMail.Text;
                    _updateEmployee.Password   = txtPassword.Text;

                    if (employeeBLL.Update(_updateEmployee))
                    {
                        MessageBox.Show("Güncelleme başarılı");
                    }
                    else
                    {
                        MessageBox.Show("Güncelleme işlemi başarısız");
                    }
                }
                bool control = true;
                foreach (var item in MdiParent.MdiChildren)
                {
                    if (item is EmployeeListForm)
                    {
                        ((EmployeeListForm)item).EmployeeList();
                        item.BringToFront();
                        control = false;
                    }
                }
                if (control)
                {
                    EmployeeListForm employeeList = new EmployeeListForm();
                    employeeList.MdiParent = MdiParent;
                    employeeList.Show();
                }
            }
            else
            {
                MessageBox.Show("Boş Alan Bırakmayınız!");
            }
        }
Exemple #5
0
        private void splBtnSave_Click(object sender, EventArgs e)
        {
            if (txtEdtFullName.Text != "" && (rdoMale.Checked || rdoFemale.Checked) &&
                txtEdtMobilePhone.Text != "")
            {
                if (txtEdtID.Text == "")
                {
                    try
                    {
                        GetData();
                        dgvEmployee.DataSource = employeeBLL.Add(employee);
                        ClearData();
                        GetAll();

                        XtraMessageBox.Show("Đã thêm thông tin nhân viên " + employee.FullName, "THÔNG BÁO!",
                                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch
                    {
                        XtraMessageBox.Show("Không được thêm nhân viên dưới 18 tuổi", "THÔNG BÁO!",
                                            MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    int rowIndex = dgvEmployee.CurrentRow.Index;
                    employee.FullName = dgvEmployee["Họ tên", rowIndex].Value.ToString();

                    if (rdoMale.Checked)
                    {
                        employee.Gender = true;
                    }
                    else
                    {
                        employee.Gender = false;
                    }

                    employee.Birthday    = DateTime.Parse(dgvEmployee["Ngày sinh", rowIndex].Value.ToString());
                    employee.MobilePhone = dgvEmployee["Điện thoại", rowIndex].Value.ToString();

                    if (employee.FullName != txtEdtFullName.Text ||
                        employee.Gender != (bool)dgvEmployee["Giới tính", rowIndex].Value ||
                        employee.Birthday != dtpBirthday.Value ||
                        employee.MobilePhone != txtEdtMobilePhone.Text)
                    {
                        try
                        {
                            GetData();
                            dgvEmployee.DataSource = employeeBLL.Update(employee);
                            ClearData();
                            GetAll();

                            XtraMessageBox.Show("Đã sửa thông tin nhân viên " + employee.FullName, "THÔNG BÁO!",
                                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        catch
                        {
                            XtraMessageBox.Show("Nhân viên không được dưới 18 tuổi", "THÔNG BÁO!",
                                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
            }
            else
            {
                XtraMessageBox.Show("Vui lòng nhập đủ các thông tin", "THÔNG BÁO!",
                                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemple #6
0
        private void btnCreateEmployee_Click(object sender, EventArgs e)
        {
            employee = new Employee();

            if (btnCreateEmployee.Text == "Çalışan Oluştur")
            {
                control = Convert.ToBoolean(_employeeBLL.Get(txtEmail.Text));

                if (control)
                {
                    MessageBox.Show("Bu E-mail daha önce kayıt gerçekleştirilmiş.");
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(txtEmployeeName.Text))
                    {
                        errorProvider.SetError(txtEmployeeName, "Çalışan ismi boş geçilemez");
                        return;
                    }

                    employee.FirstName = txtEmployeeName.Text;
                    errorProvider.SetError(txtEmployeeName, "");



                    if (string.IsNullOrWhiteSpace(txtEmployeeLastName.Text))
                    {
                        errorProvider.SetError(txtEmployeeLastName, "Çalışan soyismi boş geçilemez");
                        return;
                    }

                    employee.LastName = txtEmployeeLastName.Text;
                    errorProvider.SetError(txtEmployeeLastName, "");


                    employee.EmployeeTypeID = (int)cmbEmployeeType.SelectedValue;

                    if (string.IsNullOrWhiteSpace(mskdTxtPhone.Text))
                    {
                        errorProvider.SetError(mskdTxtPhone, "Telefon numarası boş geçilemez.");
                        return;
                    }

                    employee.Phone = mskdTxtPhone.Text;
                    errorProvider.SetError(mskdTxtPhone, "");


                    if (string.IsNullOrWhiteSpace(txtEmail.Text))
                    {
                        errorProvider.SetError(txtEmail, "EMail boş geçilemez.");
                        return;
                    }

                    employee.EMail = txtEmail.Text;
                    errorProvider.SetError(txtEmail, "");



                    if (string.IsNullOrWhiteSpace(txtPassword.Text))
                    {
                        errorProvider.SetError(txtPassword, "Şifre kısmı boş geçilemez.");
                        return;
                    }

                    employee.Password = txtPassword.Text;
                    errorProvider.SetError(txtPassword, "");

                    _employeeBLL.Add(employee);
                    MessageBox.Show("Çalışan oluşturma işlemi başarıyla gerçekleşti.");
                    CleanControls();
                }
            }
            else
            {
                if (string.IsNullOrWhiteSpace(txtEmployeeName.Text))
                {
                    errorProvider.SetError(txtEmployeeName, "Çalışan ismi boş geçilemez");
                    return;
                }

                employee.FirstName = txtEmployeeName.Text;
                errorProvider.SetError(txtEmployeeName, "");



                if (string.IsNullOrWhiteSpace(txtEmployeeLastName.Text))
                {
                    errorProvider.SetError(txtEmployeeLastName, "Çalışan soyismi boş geçilemez");
                    return;
                }

                employee.LastName = txtEmployeeLastName.Text;
                errorProvider.SetError(txtEmployeeLastName, "");


                employee.EmployeeTypeID = (int)cmbEmployeeType.SelectedValue;

                if (string.IsNullOrWhiteSpace(mskdTxtPhone.Text))
                {
                    errorProvider.SetError(mskdTxtPhone, "Telefon numarası boş geçilemez.");
                    return;
                }

                employee.Phone = mskdTxtPhone.Text;
                errorProvider.SetError(mskdTxtPhone, "");


                if (string.IsNullOrWhiteSpace(txtEmail.Text))
                {
                    errorProvider.SetError(txtEmail, "EMail boş geçilemez.");
                    return;
                }

                employee.EMail = txtEmail.Text;
                errorProvider.SetError(txtEmail, "");



                if (string.IsNullOrWhiteSpace(txtPassword.Text))
                {
                    errorProvider.SetError(txtPassword, "Şifre kısmı boş geçilemez.");
                    return;
                }

                employee.Password = txtPassword.Text;
                errorProvider.SetError(txtPassword, "");
                _employeeBLL.Update(employee);
                MessageBox.Show("Güncelleme işlemi başarıyla gerçekleşti.");
                CleanControls();
            }
        }
        /// <summary>
        /// 添加员工
        /// </summary>
        private void AddEmployee()
        {
            string employeeNO = txtEmployeeNo.Text.Trim();  //员工编号

            try
            {
                //判断编号是否已经使用
                bool isExist = eBll.IsExist(employeeNO);
                if (isExist)
                {
                    ExecuteScript("AlertDialog('员工编号已存在!', null);");
                    return;
                }
                string name   = txtName.Text.Trim();            //员工姓名
                int    gender = 0;                              //员工性别
                if (rdbFemale.Checked)
                {
                    gender = 1;
                }
                //出生日期
                string birthdate = txtBirthDate.Text.Trim();

                Employee emp = new Employee();
                emp.ID         = Guid.NewGuid().ToString();
                emp.EMPLOYEENO = employeeNO;
                //密码加密
                emp.PASSWORD = AES.Encrypt("666666", "0512000000000512");
                //姓名
                emp.NAME = name == null ? null : name;
                //性别
                emp.SEX = gender == 0;
                if (!string.IsNullOrEmpty(birthdate))
                {
                    emp.BIRTHDATE = Convert.ToDateTime(birthdate);
                }
                //手机号码
                emp.MOBILEPHONE = txtMobilePhone.Text.Trim();
                //转正日期
                emp.TOREGULARDATE = Convert.ToDateTime(txtToRegularDate.Text.Trim());
                //员工类型,0:总经办,1:客服,2:造价员
                decimal userType = 0;
                //总经办
                if (rdbGMO.Checked)
                {
                    userType = 0;
                }
                //客服
                else if (rdbCustomerService.Checked)
                {
                    userType = 1;
                }
                //造价员
                else if (rdbEmployee.Checked)
                {
                    userType = 2;
                }
                // 其他用户类型
                else if (rdbOtherUserType.Checked)
                {
                    if (!string.IsNullOrEmpty(txtUserType.Text.Trim()))
                    {
                        userType = Convert.ToDecimal(txtUserType.Text.Trim());
                    }
                }
                emp.TYPE           = userType;
                emp.ISBRANCHLEADER = rblIsBranchLeader.SelectedValue == "1";
                emp.ISEXTERNAL     = rblIsExternal.SelectedValue == "1";
                //启用状态
                emp.AVAILABLE = 1;
                bool flag = eBll.Add(emp);
                //本系统添加成功
                if (flag)
                {
                    if (rblAddRole.SelectedValue == "1")
                    {
                        // 添加角色
                        EmployeeRole empRole = new EmployeeRole();
                        empRole.ID         = Guid.NewGuid().ToString();
                        empRole.EMPLOYEEID = emp.ID;
                        // 1 客服
                        if (emp.TYPE == 1)
                        {
                            empRole.ROLEID = "fea3a06f-6d97-45d3-93f7-b145c158eb27";
                        }
                        // 2 工程师
                        else if (emp.TYPE == 2)
                        {
                            empRole.ROLEID = "2B43010866666af2b73d78c35288d565";
                        }
                        if (!string.IsNullOrEmpty(empRole.ROLEID))
                        {
                            new EmployeeRoleBLL().Add(empRole);
                        }
                    }

                    // 创建员工编号同名目录
                    string rootPath       = Convert.ToString(ConfigurationManager.AppSettings["employeePath"]);
                    string employeeFolder = Path.Combine(rootPath, emp.EMPLOYEENO);
                    if (!Directory.Exists(employeeFolder))
                    {
                        Directory.CreateDirectory(employeeFolder);
                    }

                    // 2018-05-19 添加
                    // 添加员工的任务分成配置
                    EmployeeProportionBLL epBll         = new EmployeeProportionBLL();
                    EmployeeProportion    empProportion = new EmployeeProportion();
                    empProportion.ID               = Guid.NewGuid().ToString();
                    empProportion.EMPLOYEEID       = emp.ID;
                    empProportion.PROPORTION       = 0.3m;
                    empProportion.PARENTEMPLOYEEID = null;
                    empProportion.ISBRANCHLEADER   = emp.ISBRANCHLEADER;
                    epBll.Add(empProportion);
                    // 任务分成配置结束

                    // 2018-05-20 添加
                    // 添加员工的默认账户
                    EmployeeAccount empAcct = new EmployeeAccount();
                    empAcct.ID             = Guid.NewGuid().ToString();
                    empAcct.EMPLOYEEID     = emp.ID;
                    empAcct.AMOUNT         = 0m;
                    empAcct.PAIDAMOUNT     = 0m;
                    empAcct.SURPLUSAMOUNT  = 0m;
                    empAcct.OTHERSAMOUNT   = 0m;
                    empAcct.CREATEDATE     = DateTime.Now;
                    empAcct.LASTUPDATEDATE = DateTime.Now;
                    EmployeeAccountBLL empAcctBll = new EmployeeAccountBLL();
                    empAcctBll.Add(empAcct);

                    // 员工账户结束
                    #region 调用钉钉接口,添加员工到钉钉
                    //如果选择了钉钉同步创建
                    if (Request.Form["sync"] == "rdbSync")
                    {
                        string  accessTokenResult = DingTalkHelper.GetAccessToken();
                        JObject jObj        = JObject.Parse(accessTokenResult);
                        string  errcode     = jObj["errcode"].ToString();
                        string  accessToken = string.Empty;
                        if (errcode == "0")
                        {
                            accessToken = jObj["access_token"].ToString();
                            string postUrl = string.Format("https://oapi.dingtalk.com/user/create?access_token={0}", accessToken);
                            //岗位
                            string position = string.Empty;
                            //钉钉系统中对应的部门ID
                            string departmentid = string.Empty;
                            ////总经办
                            //if (rdbGMO.Checked)
                            //{
                            //    position = rdbGMO.Text;
                            //    departmentid = "37037510";
                            //}
                            ////客服
                            //else if (rdbCustomerService.Checked)
                            //{
                            //    position = rdbCustomerService.Text;
                            //    departmentid = "36958636";
                            //}
                            ////造价员
                            //else if (rdbEmployee.Checked)
                            //{
                            //    position = rdbEmployee.Text;
                            //    departmentid = "36961466";
                            //}
                            departmentid = "110817907";

                            //\"orderInDepts\":\"{1:10}\",  \"remark\":\"\",    \"tel\":\"010-12333\",  \"workPlace\":\"\",  \"isHide\":false,  \"isSenior\":false
                            string param = "{\"name\":\"" + emp.NAME + "\",    \"department\":[" + departmentid + "],  \"position\":\"" + position + "\",  \"mobile\":\"" + emp.MOBILEPHONE +
                                           "\",  \"email\":\"" + emp.EMAIL + "\",  \"jobnumber\":\"" + emp.EMPLOYEENO + "\",}";
                            object  userCreateResult = WebServiceHelper.Post(postUrl, param);
                            JObject jCreateResult    = JObject.Parse(userCreateResult.ToString());
                            //返回码
                            errcode = jCreateResult["errcode"].ToString();
                            //返回消息
                            string errmsg = jCreateResult["errmsg"].ToString();
                            //返回码为0,成功
                            if (errcode == "0")
                            {
                                string dingTalkUserId = jCreateResult["userid"].ToString();
                                emp.DINGTALKUSERID = dingTalkUserId;
                                try
                                {
                                    //关联钉钉UserId
                                    bool uptFlag = eBll.Update(emp);
                                    //关联成功
                                    if (uptFlag)
                                    {
                                        //弹出提示并刷新当前页面
                                        ExecuteScript("alert('添加成功!');window.location.href='/Pages/Admin/EmployeeAdd?UserId=" + emp.ID + "'");
                                    }
                                    else
                                    {
                                        ExecuteScript("AlertDialog('关联钉钉UserId失败!', null);");
                                    }
                                }
                                //本地OA更新钉钉UserId失败
                                catch (Exception ex)
                                {
                                    LogHelper.WriteLine("自动关联钉钉UserId失败。" + ex.Message + ex.StackTrace);
                                    ExecuteScript("AlertDialog('操作失败!', null)");
                                }
                            }
                            else
                            {
                                LogHelper.WriteLine("用户在OA系统创建成功,但在钉钉系统创建失败,原因:" + errmsg);
                                //ExecuteScript("AlertDialog('OA系统已成功创建用户,但该用户在钉钉系统中创建失败,请人工在钉钉系统中添加。<br />钉钉系统中添加成功后,需要将其系统中的UserId填写并关联到本系统中。', null)");
                                ExecuteScript("alert('OA系统已成功创建用户,但该用户在钉钉系统中创建失败,请人工在钉钉系统中添加。钉钉系统中添加成功后,需要将其系统中的UserId填写并关联到本系统中。');window.location.href='EmployeeAdd?UserId=" + emp.ID + "';");
                            }
                        }
                        else
                        {
                            ExecuteScript("AlertDialog('用户已在本系统中成功创建,但获取钉钉token失败,并未在钉钉系统中成功添加用户,请人工添加!', null)");
                        }
                    }
                    else
                    {
                        ExecuteScript("alert('本系统添加成功但尚未关联钉钉UserId,请尽快关联!');window.location.href='/Pages/Admin/EmployeeAdd?UserId=" + emp.ID + "';");
                    }
                    #endregion
                }
                //添加失败
                else
                {
                    ExecuteScript("AlertDialog('添加失败!', null)");
                }
            }
            catch (Exception ex)
            {
                string exMsg = ex.Message;
                LogHelper.WriteLine(string.Format("员工添加出错。" + exMsg + ex.StackTrace));  //写入文本日志
                string script = string.Format("AlertDialog('服务器错误,请联系管理员!<p>{0}</p>'), null", exMsg);
                ExecuteScript(script);
            }
        }
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            List <string> errors = new List <string>();

            if (string.IsNullOrEmpty(txtFirstName.Text))
            {
                errors.Add("First Name is required.");
            }
            ;

            if (string.IsNullOrEmpty(txtLastName.Text))
            {
                errors.Add("Last Name is required.");
            }
            ;

            if (string.IsNullOrEmpty(txtLastName.Text))
            {
                errors.Add("Email Address is required.");
            }
            ;

            if (string.IsNullOrEmpty(txtLastName.Text))
            {
                errors.Add("Salary is required.");
            }
            ;

            if (cboAssignment.SelectedValue == null)
            {
                errors.Add("Please select an Assignment.");
            }

            if (cboStatus.SelectedValue == null)
            {
                errors.Add("Please select a Status.");
            }

            decimal salary = 0;

            if (!decimal.TryParse(txtSalary.Text, out salary))
            {
                errors.Add("Please enter a valid decimal for Salary.");
            }

            if (errors.Count > 0)
            {
                foreach (var error in errors)
                {
                    txtbErrors.Text = txtbErrors.Text + error + "\n";
                }

                return;
            }



            Assignment assignment = Assignment.Field;

            if (cboAssignment.SelectedValue.ToString().ToLower() == "office")
            {
                assignment = Assignment.Office;
            }

            Status status = Status.Regular;

            if (cboStatus.SelectedValue.ToString().ToLower() == "probationary")
            {
                status = Status.Probationary;
            }

            var op = EmployeeBLL.Add(new Employee()
            {
                Id           = Guid.NewGuid(),
                FirstName    = txtFirstName.Text,
                LastName     = txtLastName.Text,
                Salary       = salary,
                EmailAddress = txtEmailAddress.Text,
                Status       = status,
                Assignment   = assignment
            });

            if (op.Code != "200")
            {
                MessageBox.Show("Error : " + op.Message);
            }
            else
            {
                MessageBox.Show("Employee is successfully added to table");
            }

            myParentWindow.showData();
            this.Close();
        }
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            List <string> errors = new List <string>();

            if (string.IsNullOrEmpty(txtFirstName.Text))
            {
                errors.Add("First Name is required.");
            }
            ;

            if (string.IsNullOrEmpty(txtLastName.Text))
            {
                errors.Add("Last Name is required.");
            }
            ;

            if (string.IsNullOrEmpty(txtLastName.Text))
            {
                errors.Add("Email Address is required.");
            }
            ;

            if (string.IsNullOrEmpty(txtDepartmentName.Text))
            {
                errors.Add("Department Name is required.");
            }
            ;

            if (string.IsNullOrEmpty(txtContactNumber.Text))
            {
                errors.Add("Contact Number is required.");
            }
            ;

            if (cboAssignment.SelectedValue == null)
            {
                errors.Add("Please select an Assignment.");
            }

            if (cboGender.SelectedValue == null)
            {
                errors.Add("Please select a Gender.");
            }

            if (errors.Count > 0)
            {
                foreach (var error in errors)
                {
                    txtbErrors.Text = txtbErrors.Text + error + "\n";
                }

                return;
            }
            Assignment assignment = Assignment.Field;

            if (cboAssignment.SelectedValue.ToString().ToLower() == "office")
            {
                assignment = Assignment.Office;
            }

            Gender gender = Gender.Male;

            if (cboGender.SelectedValue.ToString().ToLower() == "Female")
            {
                gender = Gender.Female;
            }

            var op = EmployeeBLL.Add(new Employee()
            {
                Id             = Guid.NewGuid(),
                FirstName      = txtFirstName.Text,
                LastName       = txtLastName.Text,
                EmailAddress   = txtEmailAddress.Text,
                DepartmentName = txtDepartmentName.Text,
                ContactNumber  = txtContactNumber.Text,
                Gender         = gender,
                Assignment     = assignment
            });

            if (op.Code != "200")
            {
                MessageBox.Show("Error : " + op.Message);
            }
            else
            {
                MessageBox.Show("Employee is successfully added to table");
            }

            myParentWindow.showData();
            this.Close();
        }