//private bool chk_Validate(DateTime? rad_ReceievedDate) //{ // try // { // _obj_Smhr_Employee = new SMHR_EMPLOYEE(); // _obj_Smhr_Employee.OPERATION = operation.Select; // _obj_Smhr_Employee.EMP_ID = Convert.ToInt32(rad_Employees.SelectedValue.ToString().Split('~')[0]); // _obj_Smhr_Employee.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); // DataTable dt_Details = BLL.get_Employee(_obj_Smhr_Employee); // if (dt_Details.Rows.Count != 0) // { // if (Convert.ToBoolean(dt_Details.Rows[0]["EMPREG_IS_TERMINATED"]) == 0)//Normal Resignation // { // if (Convert.ToDateTime(Convert.ToString(dt_Details.Rows[0]["EMP_DOJ"])) > Convert.ToDateTime(rad_ReceievedDate)) // { // BLL.ShowMessage(this, "Date Should be Greater than Employee Join Date"); // return true; // } // if (Convert.ToDateTime(Convert.ToString(dt_Details.Rows[0]["EMPREG_APPROVEDDATE"])) > Convert.ToDateTime(rad_ReceievedDate)) // { // BLL.ShowMessage(this, "Date Should be Greater than Employee Resignation Approved Date"); // return true; // } // } // else // { // if (Convert.ToBoolean(dt_Details.Rows[0]["EMPREG_IS_TERMINATED"]) == 1)// Is Terminated // { // if (Convert.ToDateTime(Convert.ToString(dt_Details.Rows[0]["EMP_DOJ"])) > Convert.ToDateTime(rad_ReceievedDate)) // { // BLL.ShowMessage(this, "Date Should be Greater than Employee Join Date"); // return true; // } // if (Convert.ToDateTime(Convert.ToString(dt_Details.Rows[0]["EMP_RESGDATE"])) > Convert.ToDateTime(rad_ReceievedDate)) // { // BLL.ShowMessage(this, "Date Should be Greater than Employee Resignation Date"); // return true; // } // } // } // } // } // catch (Exception ex) // { // SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frmassetdoc", ex.StackTrace, DateTime.Now); // Response.Redirect("~/Frm_ErrorPage.aspx"); // return false; // } //} #endregion protected void btn_Cancel_Click1(object sender, EventArgs e) { try { Rad_Department.Items.Clear(); Rad_Department.ClearSelection(); } 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 radBU_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) { try { rad_Employees.Items.Clear(); rad_Employees.ClearSelection(); Rad_Department.Items.Clear(); Rad_Department.ClearSelection(); tr_EmpDetails.Attributes.Add("style", "visibility:hidden;display:none"); table_AssetDetails.Attributes.Add("style", "visibility:hidden;display:none"); if (radBU.SelectedIndex > 0) { LoadEmployees(); } } 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 btn_Submit_Click(object sender, EventArgs e) { try { _obj_Smhr_Applicant = new SMHR_APPLICANT(); _obj_Smhr_Employee = new SMHR_EMPLOYEE(); _obj_Smhr_Asset_Clearance = new SMHR_EMP_ASSET_CLEARANCE(); int count = 0; if (rad_Employees.SelectedItem.Text == "Select") { BLL.ShowMessage(this, "Please select an Employee"); return; } if (Rad_Department.SelectedItem.Text == "Select") { BLL.ShowMessage(this, "Please select a Department"); return; } if (Rg_DepartmentswithAssets.Items.Count == 0) { BLL.ShowMessage(this, "No Assets for the Employee"); return; } if (rad_Employees.SelectedIndex > 0) { _obj_Smhr_Employee.EMP_ID = Convert.ToInt32(rad_Employees.SelectedValue); } else { if (ViewState["SelectedEmployee"] != null) { _obj_Smhr_Employee.EMP_ID = Convert.ToInt32(ViewState["SelectedEmployee"]); } else { BLL.ShowMessage(this, "No Employees for Clearance"); return; } } if (txt_Address != null && txt_Address.Text != string.Empty) { _obj_Smhr_Applicant.APPLICANT_ADDRESS = Convert.ToString(txt_Address.Text); } if (txt_Telephone != null && txt_Telephone.Text != string.Empty) { _obj_Smhr_Employee.EMP_MOBILENO = Convert.ToString(txt_Telephone.Text); } Label lbl_Asset_Id = new Label(); CheckBox chkBox = new CheckBox(); bool status = false; foreach (GridDataItem item in Rg_DepartmentswithAssets.Items) { chkBox = item.FindControl("chkChoose") as CheckBox; if (chkBox.Checked) { count++; RadComboBox radReceivedPayable = item.FindControl("radReceivedPayable") as RadComboBox; lbl_Asset_Id = item.FindControl("lbl_Asset_Id") as Label; if (radReceivedPayable.SelectedItem.Text != "Select") { RadTextBox rad_Reason = item.FindControl("rad_Reason") as RadTextBox; _obj_Smhr_Asset_Clearance.EMP_ASSET_CLEARANCE_REMARKS = Convert.ToString(rad_Reason.Text); } else { BLL.ShowMessage(this, "Please select Received/Amount Payable"); return; } RadTextBox rad_Amount = item.FindControl("rad_Amount") as RadTextBox; if (rad_Amount != null && rad_Amount.Text != string.Empty) { _obj_Smhr_Asset_Clearance.EMP_ASSET_CLEARANCE_AMOUNT = Convert.ToDecimal(rad_Amount.Text); } RadDatePicker rad_ReceievedDate = item.FindControl("rad_ReceivedDate") as RadDatePicker; if (rad_ReceievedDate.SelectedDate == null) { BLL.ShowMessage(this, "Please select Date"); return; } else { _obj_Smhr_Asset_Clearance.EMP_ASSET_CLEARANCE_RECEIVED_DATE = Convert.ToDateTime(rad_ReceievedDate.SelectedDate.Value); } _obj_Smhr_Asset_Clearance.EMP_ASSET_CLEARANCE_ASSET_ID = Convert.ToInt32(lbl_Asset_Id.Text); _obj_Smhr_Asset_Clearance.EMP_ASSET_CLEARANCE_DEPT_ID = Convert.ToInt32(Rad_Department.SelectedValue); _obj_Smhr_Asset_Clearance.EMP_ASSET_CLEARANCE_RECEIEVED_BY = Convert.ToInt32(Session["EMP_ID"]); _obj_Smhr_Asset_Clearance._EMP_ASSET_CLEARANCE_DEPTHEADREMARKS = Convert.ToString(rad_DeptHeadRemarks.Text); _obj_Smhr_Asset_Clearance.EMP_ASSET_CLEARANCE_CREATEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_Smhr_Asset_Clearance.EMP_ASSET_CLEARANCE_CREATEDDATE = DateTime.Now; _obj_Smhr_Asset_Clearance.EMP_ASSET_CLEARANCE_LSTMFDBY = Convert.ToInt32(Session["USER_ID"]); _obj_Smhr_Asset_Clearance.EMP_ASSET_CLEARANCE_LSTMFDDATE = DateTime.Now; _obj_Smhr_Employee = new SMHR_EMPLOYEE(); _obj_Smhr_Employee.OPERATION = operation.Select; _obj_Smhr_Employee.EMP_ID = Convert.ToInt32(rad_Employees.SelectedValue); _obj_Smhr_Employee.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); DataTable dt_Details = BLL.get_Employee(_obj_Smhr_Employee); if (dt_Details != null) { if (dt_Details.Rows.Count != 0) { if (!(Convert.ToBoolean(dt_Details.Rows[0]["EMPREG_IS_TERMINATED"])))//Normal Resignation { if (Convert.ToDateTime(Convert.ToString(dt_Details.Rows[0]["EMP_DOJ"])) > Convert.ToDateTime(rad_ReceievedDate.SelectedDate)) { BLL.ShowMessage(this, "Date Should be Greater than Employee Joining Date"); return; } else if (Convert.ToDateTime(Convert.ToString(dt_Details.Rows[0]["EMPREG_APPROVEDDATE"])) > Convert.ToDateTime(rad_ReceievedDate.SelectedDate)) { BLL.ShowMessage(this, "Date Should be Greater than Employee Resignation Approved Date"); return; } else { status = BLL.set_Assets_Clearance(_obj_Smhr_Asset_Clearance, _obj_Smhr_Employee, _obj_Smhr_Applicant); } } else { if (Convert.ToBoolean(dt_Details.Rows[0]["EMPREG_IS_TERMINATED"]))// Is Terminated { if (Convert.ToDateTime(Convert.ToString(dt_Details.Rows[0]["EMP_DOJ"])) > Convert.ToDateTime(rad_ReceievedDate.SelectedDate)) { BLL.ShowMessage(this, "Date Should be Greater than Employee Join Date"); return; } else if (Convert.ToDateTime(Convert.ToString(dt_Details.Rows[0]["EMP_RESGDATE"])) > Convert.ToDateTime(rad_ReceievedDate.SelectedDate)) { BLL.ShowMessage(this, "Date Should be Greater than Employee Resignation Date"); return; } else { status = BLL.set_Assets_Clearance(_obj_Smhr_Asset_Clearance, _obj_Smhr_Employee, _obj_Smhr_Applicant); } } } } if (status == true) { BLL.ShowMessage(this, "Asset(s) Successfully Received"); } else { BLL.ShowMessage(this, "Asset(s) not Received"); } } } } if (Rg_DepartmentswithAssets.Items.Count > 0) { if (count == 0) { BLL.ShowMessage(this, "Please Select Atleast One Asset"); return; } } Get_Employee_Assets(rad_Employees.SelectedValue); LoadEmployees(); //LoadDepartment(); Rad_Department.Items.Clear(); Rad_Department.ClearSelection(); radBU.Items.Clear(); LoadBusinessUnits(); 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; } }
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; } }