private void LoadDepartment() { try { _obj_SMHR_Department = new SMHR_DEPARTMENT(); _obj_SMHR_Department.MODE = 9; if ((Convert.ToInt32(Session["EMP_ID"]) == 0)) { _obj_SMHR_Department.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"].ToString()); _obj_SMHR_Department.BUID = 5;//Convert.ToInt32(ViewState["Emp_BusinessUnitID"].ToString()); dt_Details = BLL.get_Department(_obj_SMHR_Department); if (dt_Details.Rows.Count > 0) { Rad_Department.Visible = true; Rad_Department.DataSource = dt_Details; Rad_Department.DataTextField = "DEPARTMENT_NAME"; Rad_Department.DataValueField = "DEPARTMENT_ID"; Rad_Department.DataBind(); Rad_Department.Items.Insert(0, new RadComboBoxItem("Select")); } } else { _obj_SMHR_Department.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"].ToString()); _obj_SMHR_Department.BUID = Convert.ToInt32(Session["BUSINESSUNIT_ID"].ToString().Split(',')[0]); dt_Details = BLL.get_Department(_obj_SMHR_Department); if (dt_Details.Rows.Count > 0) { Rad_Department.Visible = true; Rad_Department.DataSource = dt_Details; Rad_Department.DataTextField = "DEPARTMENT_NAME"; Rad_Department.DataValueField = "DEPARTMENT_ID"; Rad_Department.DataBind(); Rad_Department.Items.Insert(0, new RadComboBoxItem("Select")); } Rad_Department.SelectedValue = Convert.ToString(ViewState["deptid"].ToString()); Rad_Department.Enabled = false; } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Clearance", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); return; } }
protected void rad_Employees_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) { try { _obj_Smhr_AssetDoc = new SMHR_EMPASSETDOC(); _obj_Smhr_Employee = new SMHR_EMPLOYEE(); dt_resignedEmpDetails = new DataTable(); if (rad_Employees.SelectedIndex != 0) { ViewState["SelectedEmployee"] = rad_Employees.SelectedValue; _obj_Smhr_Employee.OPERATION = operation.Select_Dept; _obj_Smhr_Employee.EMP_ID = Convert.ToInt32(rad_Employees.SelectedValue); dt_resignedEmpDetails = BLL.get_ResignedEmployeeDetails(_obj_Smhr_Employee); if (dt_resignedEmpDetails.Rows.Count > 0) { ViewState["Emp_BusinessUnitID"] = dt_resignedEmpDetails.Rows[0]["EMP_BUSINESSUNIT_ID"].ToString(); if (Convert.ToInt32(Session["EMP_ID"]) == 0) { // LoadDepartment(); Rad_Department.Visible = true; Rad_Department.DataSource = dt_resignedEmpDetails; Rad_Department.DataTextField = "DEPARTMENT_Name"; Rad_Department.DataValueField = "EMPASSETDOC_DEPT_ID"; Rad_Department.DataBind(); Rad_Department.Items.Insert(0, new RadComboBoxItem("Select")); } else { _obj_Smhr_Employee = new SMHR_EMPLOYEE(); _obj_Smhr_Employee.OPERATION = operation.Select_DeptHead; _obj_Smhr_Employee.EMP_ID = Convert.ToInt32(Session["EMP_ID"]); dt_Details = BLL.get_ResignedEmployeeDetails(_obj_Smhr_Employee); if (dt_Details.Rows.Count > 0) { Rad_Department.Visible = true; Rad_Department.DataSource = dt_Details; Rad_Department.DataTextField = "DEPARTMENT_NAME"; Rad_Department.DataValueField = "DEPARTMENT_ID"; Rad_Department.DataBind(); Rad_Department.Items.Insert(0, new RadComboBoxItem("Select")); } //Rad_Department.SelectedValue = Convert.ToString(ViewState["deptid"].ToString()); //Rad_Department.Enabled = false; } tr_EmpDetails.Attributes.Add("style", "visibility:visible;display:block"); txt_EmployeeName.Text = dt_resignedEmpDetails.Rows[0]["EMPLOYEENAME"].ToString(); txt_EmployeeName.Enabled = false; txt_Address.Text = dt_resignedEmpDetails.Rows[0]["APPLICANT_ADDRESS"].ToString(); txt_Department.Text = dt_resignedEmpDetails.Rows[0]["DEPARTMENT_NAME"].ToString(); txt_Department.Enabled = false; txt_EmployeeCode.Text = dt_resignedEmpDetails.Rows[0]["EMP_EMPCODE"].ToString(); txt_EmployeeCode.Enabled = false; txt_Telephone.Text = dt_resignedEmpDetails.Rows[0]["EMP_MOBILENO"].ToString(); rdp_DateOfRetirement.SelectedDate = Convert.ToDateTime(dt_resignedEmpDetails.Rows[0]["EMPREG_REGDATE"].ToString()); rdp_DateOfRetirement.Enabled = false; } lbl_Department_Name.Text = string.Empty; //tr_EmpDetails.Attributes.Add("style", "visibility:hidden;display:none"); table_AssetDetails.Attributes.Add("style", "visibility:hidden;display:none"); //Get_Employee_Assets(rad_Employees.SelectedItem.ToString()); } else { Rad_Department.Items.Clear(); Rad_Department.ClearSelection(); if (Convert.ToInt32(Session["EMP_ID"]) == 0) { Rad_Department.ClearSelection(); tr_EmpDetails.Attributes.Add("style", "visibility:hidden;display:none"); table_AssetDetails.Attributes.Add("style", "visibility:hidden;display:none"); } else { tr_EmpDetails.Attributes.Add("style", "visibility:hidden;display:none"); table_AssetDetails.Attributes.Add("style", "visibility:hidden;display:none"); } } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Clearance", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); return; } }