public DataTable LoadGridEmployees() { try { if (ddl_BusinessUnit.SelectedItem.Value != string.Empty) { obj_smhr_EmpAssetTransfer = new SMHR_EMPASSETTRANSFER(); obj_smhr_EmpAssetTransfer.OPERATION = operation.Empty; obj_smhr_EmpAssetTransfer.EMPASSETTRANSFER_BUSINESSUNIT_ID = Convert.ToInt32(ddl_BusinessUnit.SelectedItem.Value); obj_smhr_EmpAssetTransfer.EMPASSETTRANSFER_ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); obj_smhr_EmpAssetTransfer.EMPASSETTRANSFER_FROMEMP_ID = Convert.ToInt32(ddl_Employee.SelectedValue); DataTable dt = BLL.get_AssetEmpDetails(obj_smhr_EmpAssetTransfer); return(dt); } else { return(null); } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_EmpAssetTransfer", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); return(null); } }
private void LoadEmployees() { try { if (ddl_BusinessUnit.SelectedItem.Value != string.Empty) { obj_smhr_EmpAssetTransfer = new SMHR_EMPASSETTRANSFER(); DataTable DT_Details = new DataTable(); obj_smhr_EmpAssetTransfer.OPERATION = operation.Empty; obj_smhr_EmpAssetTransfer.EMPASSETTRANSFER_BUSINESSUNIT_ID = Convert.ToInt32(ddl_BusinessUnit.SelectedItem.Value); obj_smhr_EmpAssetTransfer.EMPASSETTRANSFER_ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); DT_Details = BLL.get_AssetEmpDetails(obj_smhr_EmpAssetTransfer); ddl_Employee.DataSource = DT_Details; ddl_Employee.DataTextField = "EMPNAME"; ddl_Employee.DataValueField = "EMP_ID"; ddl_Employee.DataBind(); ddl_Employee.Items.Insert(0, new RadComboBoxItem("Select")); } else { ddl_Employee.Items.Insert(0, new RadComboBoxItem("Select")); } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_EmpAssetTransfer", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); return; } }
public DataTable LoadGridEmployees() { if (ddl_BusinessUnit.SelectedItem.Value != string.Empty) { SMHR_EMPASSETTRANSFER obj_smhr_EmpAssetTransfer = new SMHR_EMPASSETTRANSFER(); DataTable DT_Details = new DataTable(); obj_smhr_EmpAssetTransfer = new SMHR_EMPASSETTRANSFER(); obj_smhr_EmpAssetTransfer.OPERATION = operation.Empty; obj_smhr_EmpAssetTransfer.EMPASSETTRANSFER_BUSINESSUNIT_ID = Convert.ToInt32(ddl_BusinessUnit.SelectedItem.Value); obj_smhr_EmpAssetTransfer.EMPASSETTRANSFER_ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); return(BLL.get_AssetEmpDetails(obj_smhr_EmpAssetTransfer)); } else { return(null); } }
public void LoadGrid() { try { if (ddl_Employee.SelectedItem.Value != string.Empty) { obj_smhr_EmpAssetTransfer = new SMHR_EMPASSETTRANSFER(); obj_smhr_EmpAssetTransfer.EMPASSETTRANSFER_BUSINESSUNIT_ID = Convert.ToInt32(ddl_BusinessUnit.SelectedValue); obj_smhr_EmpAssetTransfer.EMPASSETTRANSFER_ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); obj_smhr_EmpAssetTransfer.EMPASSETTRANSFER_FROMEMP_ID = Convert.ToInt32(ddl_Employee.SelectedValue); DataTable DT = BLL.get_EmployeeAssetsTransfer(obj_smhr_EmpAssetTransfer); Rg_EmpAssetTransfer.DataSource = DT; Rg_EmpAssetTransfer.DataBind(); } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_EmpAssetTransfer", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); return; } }
protected void btn_Transfer_Click(object sender, EventArgs e) { try { CheckBox chkBox = new CheckBox(); Label EMPASSETDOC_ID = new Label(); RadComboBox rcmbToEmployee = new RadComboBox(); RadDatePicker rdpIssuedDate = new RadDatePicker(); bool status = false; bool emptyFlag = false; if (Rg_EmpAssetTransfer.Items.Count == 0) { BLL.ShowMessage(this, "No Assets Data Found for Selected Employee"); return; } foreach (GridDataItem item in Rg_EmpAssetTransfer.Items) { CheckBox chk = item.FindControl("chkCheck") as CheckBox; if (chk.Checked == true) { emptyFlag = true; } } if (emptyFlag == false) { BLL.ShowMessage(this, "Please Select Employees to Transfer"); return; } for (int index = 0; index <= Rg_EmpAssetTransfer.Items.Count - 1; index++) { chkBox = Rg_EmpAssetTransfer.Items[index].FindControl("chkCheck") as CheckBox; //EMPASSETDOC_ID = Rg_EmpAssetTransfer.Items[index]["EMPASSETDOC_ID"].Text; .FindControl("EMPASSETDOC_ID") as Label; rcmbToEmployee = Rg_EmpAssetTransfer.Items[index].FindControl("rcmbToEmployee") as RadComboBox; rdpIssuedDate = Rg_EmpAssetTransfer.Items[index].FindControl("rdpIssuedDate") as RadDatePicker; if (chkBox.Checked) { if (rcmbToEmployee.SelectedValue == "0") { BLL.ShowMessage(this, "Please Select Transfer Employee"); return; } if (ddl_Employee.SelectedValue == rcmbToEmployee.SelectedValue) { BLL.ShowMessage(this, "Asset cannot be Transferred to Same Employee"); return; } if (rdpIssuedDate.SelectedDate == null) { BLL.ShowMessage(this, "Please Select Valid Date of Transfer"); return; } SMHR_EMPLOYEE oSmhrEmployee = new SMHR_EMPLOYEE(); oSmhrEmployee.EMP_ID = Convert.ToInt32(rcmbToEmployee.SelectedValue); DataTable dt = BLL.get_Employeedetail(oSmhrEmployee); if (rdpIssuedDate.SelectedDate < Convert.ToDateTime(dt.Rows[0]["EMP_DOJ"])) { BLL.ShowMessage(this, "Transfer Date Should be Future Date"); return; } obj_smhr_EmpAssetTransfer = new SMHR_EMPASSETTRANSFER(); obj_smhr_EmpAssetTransfer.EMPASSETDOC_ID = Convert.ToInt32(Rg_EmpAssetTransfer.Items[index]["ASSET_ID"].Text); obj_smhr_EmpAssetTransfer.DEPARTMENT_ID = Convert.ToInt32(Rg_EmpAssetTransfer.Items[index]["ASSET_DEPARTMENT_ID"].Text); obj_smhr_EmpAssetTransfer.EMPASSETTRANSFER_ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); obj_smhr_EmpAssetTransfer.EMPASSETTRANSFER_FROMEMP_ID = Convert.ToInt32(ddl_Employee.SelectedValue); obj_smhr_EmpAssetTransfer.EMPASSETTRANSFER_TOEMP_ID = Convert.ToInt32(rcmbToEmployee.SelectedValue); obj_smhr_EmpAssetTransfer.EMPASSETTRANSFER_BUSINESSUNIT_ID = Convert.ToInt32(ddl_BusinessUnit.SelectedValue); obj_smhr_EmpAssetTransfer.EMPASSETTRANSFER_ISSUEDDATE = Convert.ToDateTime(rdpIssuedDate.SelectedDate).ToShortDateString(); obj_smhr_EmpAssetTransfer.CREATEDBY = Convert.ToInt32(Session["USER_ID"]); obj_smhr_EmpAssetTransfer.CREATEDDATE = DateTime.Now; obj_smhr_EmpAssetTransfer.OPERATION = operation.Insert; status = BLL.set_EmployeeAssetsTransfer(obj_smhr_EmpAssetTransfer); } } if (status == true) { LoadGrid(); BLL.ShowMessage(this, "Assets Transferred Successfully"); } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_EmpAssetTransfer", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); return; } }