// Load fields From Employee Table
        private void loadFields()
        {
            int id = int.Parse(txtEmployeeNumber.Text);

            tblEmployee          = adpEmployee.GetDataBy(id);
            Cache["tblEmployee"] = tblEmployee;

            var row = tblEmployee;

            if (row.Count > 0)
            {
                if (row != null)
                {
                    txtName.Text      = row[0].EmployeeName.ToString();
                    txtAddress.Text   = row[0].EmployeeAddress.ToString();
                    txtCity.Text      = row[0].EmployeeCity.ToString();
                    txtZipcode.Text   = row[0].EmployeeZipCode.ToString();
                    txtHomePhone.Text = row[0].EmployeeHomePhone.ToString();
                    txtCellPhone.Text = row[0].EmployeeCellPhone.ToString();
                    txtEmail.Text     = row[0].EmployeeEmail.ToString();
                    txtSalary.Text    = row[0].EmployeeSalary.ToString();
                    selectGender(row[0].EmployeeGender.ToString());
                    selectProvince(row[0].EmployeeProvince.ToString());
                    selectDepartment(row[0].EmployeeDepartmentID.ToString());
                    loadJobTitle();
                    selectJobTitle(row[0].EmployeeJobTitleId.ToString());
                    loadDOB(row[0].EmployeeDOB);
                    loadStartDate(row[0].EmployeeStartDate);
                    if (row[0].EmployeeStatus.ToString() == "A")
                    {
                        rdbStatus.SelectedIndex = 0;
                    }
                    else
                    {
                        rdbStatus.SelectedIndex = 1;
                    }
                }
                else
                {
                    clearFields();
                    lblErrorMessage.Text      = "Employee with ID " + id + " is not found";
                    lblErrorMessage.ForeColor = System.Drawing.Color.Red;
                }
            }
            else
            {
                clearFields();
                lblErrorMessage.Text      = " Employee with ID " + id + " is not found";
                lblErrorMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
Exemple #2
0
 public void refresh()
 {
     if (Session["DepartmentId"] != null || Session["EmployeeId"] != null)
     {
         int departmentID = int.Parse(Session["DepartmentId"].ToString());
         int employeeId   = int.Parse(Session["EmployeeId"].ToString());
         mountPage(departmentID);
         tblEmployee          = adpEmployee.GetDataBy(employeeId);
         Cache["tblEmployee"] = tblEmployee;
         lblEmployeeName.Text = "Hello " + tblEmployee[0].EmployeeName;
     }
     else
     {
         Response.Redirect("~/LoginForm.aspx");
     }
 }
Exemple #3
0
        public void createSession()
        {
            int id = int.Parse(txtEmployeeID.Text);

            tblEmployee = adpEmployee.GetDataBy(id);

            var row = tblEmployee;

            if (row.Count > 0)
            {
                if (row != null)
                {
                    Session["DepartmentId"] = row[0].EmployeeDepartmentID;
                    Session["EmployeeId"]   = txtEmployeeID.Text;
                    Response.Redirect("~/WelcomeForm.aspx");
                }
            }
            else
            {
                lblMessageError.Text      = " Error to create Session";
                lblMessageError.ForeColor = System.Drawing.Color.Red;
            }
        }