protected void LoadMainGrid() { try { SMHR_EMPCOMOFF _obj_smhr_empcompoff = new SMHR_EMPCOMOFF(); _obj_smhr_empcompoff.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); _obj_smhr_empcompoff.LOGIN_ID = Convert.ToInt32(Session["USER_ID"]); DataTable dt = new DataTable(); dt = BLL.get_empcompffs(_obj_smhr_empcompoff); for (int index = 0; index < dt.Rows.Count; index++) { if (!(Convert.ToString(dt.Rows[index]["COMPOFF_STATUS"]) == "PENDING")) { if (Convert.ToString(dt.Rows[index]["APPROVED_BY"]) == string.Empty) { dt.Rows[index]["APPROVED_BY"] = "ADMIN"; } } } if (Control != null) { //if (Session["SELFSERVICE"] == "true") if ((Convert.ToString(Session["SELFSERVICE"]) == "true" && Control.ToUpper() == "SELFCOMP") || (Convert.ToString(Session["SELFSERVICE"]) == "" && Control.ToUpper() == "SELFCOMP")) { dt.DefaultView.RowFilter = " EMP_ID='" + Convert.ToString(Session["EMP_ID"]) + "'"; dt = dt.DefaultView.ToTable(); } } Rg_CmpOffDet.DataSource = dt; if (Convert.ToInt32(Session["EMP_ID"]) > 0 && Control != null) { if (Session["DASHBOARD"] != null) { //Rm_CMPOFF_page.SelectedIndex = 1; //lnk_Add_Command(null, null); } } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_comoffrequest", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
private void LoadData() { try { _obj_smhr_empcompoff = new SMHR_EMPCOMOFF(); _obj_smhr_empcompoff.OPERATION = operation.Check; if (Session["EMP_ID"] != null) { _obj_smhr_empcompoff.EMPCOMPOFF_EMPID = Convert.ToInt32(Session["EMP_ID"]); } _obj_smhr_empcompoff.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); RG_CompoffApproval.DataSource = BLL.get_empcompffs(_obj_smhr_empcompoff); } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_CompOffApproval", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
//protected void rcmb_BusinessUnit_SelectedIndexChanged1(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) //{ // rcmb_CmpOffEmployeeID.Items.Clear(); // SMHR_EMPCOMOFF _obj_smhr_compoff = new SMHR_EMPCOMOFF(); // _obj_smhr_compoff.BUID = Convert.ToInt32(rcmb_BusinessUnit.SelectedItem.Value); // _obj_smhr_compoff.OPERATION = operation.Empty; // rcmb_CmpOffEmployeeID.DataSource = BLL.get_empcompffs(_obj_smhr_compoff); // rcmb_CmpOffEmployeeID.DataTextField = "EMPNAME"; // rcmb_CmpOffEmployeeID.DataValueField = "EMP_ID"; // rcmb_CmpOffEmployeeID.DataBind(); // rcmb_CmpOffEmployeeID.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("Select", "-1")); //} private void LoadEmployees() { try { //if (Convert.ToString(Session["SELFSERVICE"]) == "") //{ // //FOR MANAGER // rcmb_CmpOffEmployeeID.Items.Clear(); // SMHR_EMPCOMOFF _obj_smhr_compoff = new SMHR_EMPCOMOFF(); // _obj_smhr_compoff.BUID = Convert.ToInt32(rcmb_BusinessUnit.SelectedItem.Value); // _obj_smhr_compoff.EMPCOMPOFF_EMPID = Convert.ToInt32(Session["EMP_ID"]); // _obj_smhr_compoff.OPERATION = operation.Empty_Self; // rcmb_CmpOffEmployeeID.DataSource = BLL.get_empcompffs(_obj_smhr_compoff); // rcmb_CmpOffEmployeeID.DataTextField = "EMPNAME"; // rcmb_CmpOffEmployeeID.DataValueField = "EMP_ID"; // rcmb_CmpOffEmployeeID.DataBind(); // rcmb_CmpOffEmployeeID.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("Select", "-1")); //} //else //{ //FRO ADMIN rcmb_CmpOffEmployeeID.Items.Clear(); SMHR_EMPCOMOFF _obj_smhr_compoff = new SMHR_EMPCOMOFF(); _obj_smhr_compoff.BUID = Convert.ToInt32(rcmb_BusinessUnit.SelectedItem.Value); _obj_smhr_compoff.OPERATION = operation.Empty; rcmb_CmpOffEmployeeID.DataSource = BLL.get_empcompffs(_obj_smhr_compoff); rcmb_CmpOffEmployeeID.DataTextField = "EMPNAME"; rcmb_CmpOffEmployeeID.DataValueField = "EMP_ID"; rcmb_CmpOffEmployeeID.DataBind(); rcmb_CmpOffEmployeeID.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("Select", "-1")); //} } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_comoffrequest", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void lnk_Edit_Command(object sender, CommandEventArgs e) { try { btn_Save.Visible = false; SMHR_EMPCOMOFF _obj_smhr_empcompoff = new SMHR_EMPCOMOFF(); _obj_smhr_empcompoff.OPERATION = operation.Select; DataTable dtdet = BLL.get_empcompffs(new SMHR_EMPCOMOFF(Convert.ToInt32(Convert.ToString(e.CommandArgument)))); loaddropdowns(); if ((Convert.ToInt32(dtdet.Rows[0]["EMP_STATUS"]) == 0) || (Convert.ToInt32(dtdet.Rows[0]["EMP_STATUS"]) == 1)) { btn_Update.Visible = true; _obj_smhr_empcompoff.BUID = Convert.ToInt32(Convert.ToString(dtdet.Rows[0]["BUSINESSUNIT_ID"])); _obj_smhr_empcompoff.EMPCOMPOFF_EMPID = Convert.ToInt32(Convert.ToString(dtdet.Rows[0]["EMPCOMPOFF_EMPID"])); _obj_smhr_empcompoff.OPERATION = operation.Empty; DataTable dtemp = BLL.get_empcompffs(_obj_smhr_empcompoff); rcmb_CmpOffEmployeeID.DataSource = dtemp; //lbl_Curr.Text = Convert.ToString(dtemp.Rows[0]["CURRENCY"]); rcmb_CmpOffEmployeeID.DataTextField = "EMPNAME"; rcmb_CmpOffEmployeeID.DataValueField = "EMP_ID"; rcmb_CmpOffEmployeeID.DataBind(); rcmb_CmpOffEmployeeID.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("Select", "-1")); rcmb_CmpOffEmployeeID.SelectedIndex = rcmb_CmpOffEmployeeID.Items.FindItemIndexByValue(Convert.ToString(dtdet.Rows[0]["EMPCOMPOFF_EMPID"])); } else if ((Convert.ToInt32(dtdet.Rows[0]["EMP_STATUS"]) == 2) || (Convert.ToInt32(dtdet.Rows[0]["EMP_STATUS"]) == 3)) { btn_Update.Visible = false; _obj_smhr_empcompoff.BUID = Convert.ToInt32(Convert.ToString(dtdet.Rows[0]["BUSINESSUNIT_ID"])); _obj_smhr_empcompoff.EMPCOMPOFF_EMPID = Convert.ToInt32(Convert.ToString(dtdet.Rows[0]["EMPCOMPOFF_EMPID"])); _obj_smhr_empcompoff.OPERATION = operation.EMPTY_R; DataTable dtemp = BLL.get_empcompffs(_obj_smhr_empcompoff); rcmb_CmpOffEmployeeID.DataSource = dtemp; //lbl_Curr.Text = Convert.ToString(dtemp.Rows[0]["CURRENCY"]); rcmb_CmpOffEmployeeID.DataTextField = "EMPNAME"; rcmb_CmpOffEmployeeID.DataValueField = "EMP_ID"; rcmb_CmpOffEmployeeID.DataBind(); rcmb_CmpOffEmployeeID.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("Select", "-1")); rcmb_CmpOffEmployeeID.SelectedIndex = rcmb_CmpOffEmployeeID.Items.FindItemIndexByValue(Convert.ToString(dtdet.Rows[0]["EMPCOMPOFF_EMPID"])); } lbl_CmpDetID.Text = Convert.ToString(e.CommandArgument); rcmb_BusinessUnit.SelectedIndex = rcmb_BusinessUnit.Items.FindItemIndexByValue(Convert.ToString(dtdet.Rows[0]["BUSINESSUNIT_ID"])); rdtp_Dateofwork.SelectedDate = Convert.ToDateTime(dtdet.Rows[0]["EMPCOMPOFF_WORKDAY"]); Session["EMPCOMPOFF_WORKDAY"] = Convert.ToDateTime(dtdet.Rows[0]["EMPCOMPOFF_WORKDAY"]); //if (dtdet.Rows[0]["EMPCOMPOFF_COMPOFFDAY"] != System.DBNull.Value) //{ // rdtp_compoffday.SelectedDate = Convert.ToDateTime(dtdet.Rows[0]["EMPCOMPOFF_COMPOFFDAY"]); //} //else //{ // rdtp_compoffday.SelectedDate = null; //} rtp_LoginTime.SelectedDate = Convert.ToDateTime(dtdet.Rows[0]["EMPCOMPOFF_LOGINTIME"]); rtp_LogoutTime.SelectedDate = Convert.ToDateTime(dtdet.Rows[0]["EMPCOMPOFF_LOGOUTTIME"]); rtxt_NDays.Text = Convert.ToString(dtdet.Rows[0]["EMPCOMPOFF_DAYS"]); bool result = Convert.ToString(dtdet.Rows[0]["EMPCOMPOFF_REASON"]).Contains("</br>"); string strReason = string.Empty; if (result) { strReason = Convert.ToString(dtdet.Rows[0]["EMPCOMPOFF_REASON"]).Replace("</br>", ""); } else { strReason = Convert.ToString(dtdet.Rows[0]["EMPCOMPOFF_REASON"]); } rtxt_Reason.Text = strReason; //rtxt_Reason.Text = Convert.ToString(dtdet.Rows[0]["EMPCOMPOFF_REASON"]); rdp_AppDate.SelectedDate = Convert.ToDateTime(dtdet.Rows[0]["EMPCOMPOFF_APPLIEDDATE"]); rcmb_Compoff.SelectedIndex = rcmb_Compoff.FindItemIndexByValue(Convert.ToString(dtdet.Rows[0]["EMPCOMPOFF_LEAVETYPE"])); if (Convert.ToInt32(dtdet.Rows[0]["EMPCOMPOFF_STATUS"]) == 0) { Rm_CMPOFF_page.SelectedIndex = 1; if ((Convert.ToInt32(Session["WRITEFACILITY"]) == 2) || ((Convert.ToInt32(dtdet.Rows[0]["EMP_STATUS"]) == 2) || (Convert.ToInt32(dtdet.Rows[0]["EMP_STATUS"]) == 3))) { btn_Update.Visible = false; } else { btn_Update.Visible = true; } rcmb_BusinessUnit.Enabled = false; rcmb_CmpOffEmployeeID.Enabled = false; } else { if (Convert.ToString(dtdet.Rows[0]["EMPCOMPOFF_STATUS"]) == "2") { BLL.ShowMessage(this, " Request had already been rejected, cannot be edited"); } else { BLL.ShowMessage(this, " Request had already been approved, cannot be edited"); } Rm_CMPOFF_page.SelectedIndex = 1; btn_Update.Visible = false; EnabledFields(false); } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_comoffrequest", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void btn_Save_Click(object sender, EventArgs e) { try { SMHR_EMPCOMOFF _obj_smhr_compoff = new SMHR_EMPCOMOFF(); _obj_smhr_compoff.EMPCOMPOFF_WORKDAY = Convert.ToDateTime(rdtp_Dateofwork.SelectedDate); _obj_smhr_compoff.EMPCOMPOFF_LOGINTIME = Convert.ToString(Convert.ToDateTime(rtp_LoginTime.SelectedDate).TimeOfDay); _obj_smhr_compoff.EMPCOMPOFF_LOGOUTTIME = Convert.ToString(Convert.ToDateTime(rtp_LogoutTime.SelectedDate).TimeOfDay); if (Convert.ToDateTime(rtp_LoginTime.SelectedDate).TimeOfDay > Convert.ToDateTime(rtp_LogoutTime.SelectedDate).TimeOfDay) { BLL.ShowMessage(this, "Login time should be less than Logout time."); return; } _obj_smhr_compoff.EMPCOMPOFF_EMPID = Convert.ToInt32(rcmb_CmpOffEmployeeID.SelectedItem.Value); _obj_smhr_compoff.EMPCOMPOFF_DAYS = 1;//Convert.ToInt32(rtxt_NDays.Text); //string strTest = rtxt_Reason.Text; //StringBuilder sb = new StringBuilder(); //for (int i = 0; i < strTest.Length; i++) //{ // if (i % 12 == 0) // sb.Append("</br>"); // sb.Append(strTest[i]); //} //string strReason = sb.ToString(); //_obj_smhr_compoff.EMPCOMPOFF_REASON = strReason; _obj_smhr_compoff.EMPCOMPOFF_REASON = Convert.ToString(BLL.ReplaceQuote(rtxt_Reason.Text)); _obj_smhr_compoff.EMPCOMPOFF_APPLIEDDATE = Convert.ToDateTime(rdp_AppDate.SelectedDate); _obj_smhr_compoff.EMPCOMPOFF_STATUS = 0; _obj_smhr_compoff.CREATEDBY = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session _obj_smhr_compoff.CREATEDDATE = DateTime.Now; _obj_smhr_compoff.LASTMDFBY = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session _obj_smhr_compoff.LASTMDFDATE = DateTime.Now; //_obj_smhr_compoff.EMPCOMPOFF_COMPOFFDAY = Convert.ToDateTime(rdtp_compoffday.SelectedDate); //DataTable dt_comp = BLL.CheckCompoffDay(_obj_smhr_compoff); //if (dt_comp.Rows[0]["RESULT"].ToString() == "1") //{ // BLL.ShowMessage(this, "Entered Compoff Day is Not a Working Day"); // return; //} DataTable dt_val = BLL.CheckWorkDay(_obj_smhr_compoff); _obj_smhr_compoff.EMPCOMPOFF_WORKDAY = Convert.ToDateTime(rdtp_Dateofwork.SelectedDate); _obj_smhr_compoff.EMPCOMPOFF_EMPID = Convert.ToInt32(rcmb_CmpOffEmployeeID.SelectedItem.Value); _obj_smhr_compoff.EMPCOMPOFF_LEAVETYPE = Convert.ToInt32(rcmb_Compoff.SelectedItem.Value); //_obj_smhr_compoff.OPERATION = operation.Validate; //if (Convert.ToString(BLL.get_empcompffs(_obj_smhr_compoff).Rows[0]["Count"]) == "1") //{ // BLL.ShowMessage(this, "Compensatory off is already approved for this work day"); // return; //} if (dt_val.Rows[0]["RESULT"].ToString() == "1") { switch (((Button)sender).ID.ToUpper()) { case "BTN_UPDATE": _obj_smhr_compoff.OPERATION = operation.Update; _obj_smhr_compoff.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); _obj_smhr_compoff.EMPCOMPOFF_ID = Convert.ToInt32(lbl_CmpDetID.Text); BLL.set_empcompoffs(_obj_smhr_compoff); BLL.ShowMessage(this, "Comp Off Request Updated successfully"); break; case "BTN_SAVE": _obj_smhr_compoff.OPERATION = operation.Validate; if (Convert.ToString(BLL.get_empcompffs(_obj_smhr_compoff).Rows[0]["Count"]) == "1") { BLL.ShowMessage(this, "Compensatory off is already approved for this work day"); return; } //_obj_smhr_compoff.OPERATION = operation.Validate1; //if (Convert.ToString(BLL.get_empcompffs(_obj_smhr_compoff).Rows[0]["Count"]) == "1") //{ // BLL.ShowMessage(this, "Compensatory off is already applied for this Compoff day"); // return; //} _obj_smhr_compoff.OPERATION = operation.Insert; _obj_smhr_compoff.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); BLL.set_empcompoffs(_obj_smhr_compoff); BLL.ShowMessage(this, "Comp Off Request Submitted successfully"); break; default: break; } clearcontrols(); Rm_CMPOFF_page.SelectedIndex = 0; LoadMainGrid(); Rg_CmpOffDet.DataBind(); //clearcontrols(); } else { BLL.ShowMessage(this, "Not a valid day to apply for Compensatory Off"); return; } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_comoffrequest", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void btn_Reject_Click(object sender, EventArgs e) { try { CheckBox chkBox = new CheckBox(); Label lblid = new Label(); TextBox txt = new TextBox(); string str = ""; for (int index = 0; index <= RG_CompoffApproval.Items.Count - 1; index++) { chkBox = RG_CompoffApproval.Items[index].FindControl("chk_choose") as CheckBox; lblid = RG_CompoffApproval.Items[index].FindControl("lblCompoffID") as Label; txt = RG_CompoffApproval.Items[index].FindControl("txt_AppRemarks") as TextBox; if (chkBox.Checked) { if (str == "") { str = "" + lblid.Text + ""; } else { str = str + "," + lblid.Text + ""; } } } if (string.IsNullOrEmpty(str)) { BLL.ShowMessage(this, "Please select employees"); return; } bool status = false; _obj_smhr_empcompoff = new SMHR_EMPCOMOFF(); _obj_smhr_empcompoff.EMPCOMPOFF_EMPID = Convert.ToInt32(Session["EMP_ID"]); _obj_smhr_empcompoff.EMPCOMPOFF_STATUS = 2; _obj_smhr_empcompoff.EMPCOMPOFF_REASON = str; _obj_smhr_empcompoff.EMPCOMPOFF_APPROVEDBY = Convert.ToInt32(rtxt_ReportingMgr.Text); //string[] strSpilt = lblDOB.Text.Split('/'); //lblDOB.Text = strSpilt[1] + "/" + strSpilt[0] + "/" + strSpilt[2]; //txt_FDOB.SelectedDate = Convert.ToDateTime(lblDOB.Text); _obj_smhr_empcompoff.EMPCOMPOFF_APPROVEDDATE = Convert.ToDateTime(rdp_ApprovalDate.SelectedDate.Value); //Convert.ToDateTime(rdp_ApprovalDate.SelectedDate.Value.ToString("MM/dd/YYYy")); _obj_smhr_empcompoff.EMPCOMPOFF_APPROVALREMARKS = txt.Text; if (txt.Text == "") { _obj_smhr_empcompoff.EMPCOMPOFF_APPROVALREMARKS = null; } _obj_smhr_empcompoff.LASTMDFBY = Convert.ToInt32(Session["USER_ID"]); _obj_smhr_empcompoff.LASTMDFDATE = DateTime.Now; _obj_smhr_empcompoff.OPERATION = operation.Update1; status = BLL.set_empcompoffs(_obj_smhr_empcompoff); if (status == true) { BLL.ShowMessage(this, "Selected Compoffs Rejected"); LoadData(); RG_CompoffApproval.DataBind(); //rg_expenseapproval.visible = false; return; } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_CompOffApproval", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void btn_Approve_Click(object sender, EventArgs e) { try { SMHR_LEAVEBALANCE _obj_smhr_leavebal = new SMHR_LEAVEBALANCE(); CheckBox chkBox = new CheckBox(); Label lblid = new Label(); Label lblempid = new Label(); Label lblleave = new Label(); TextBox txt = new TextBox(); string str = ""; string str1 = ""; for (int index = 0; index <= RG_CompoffApproval.Items.Count - 1; index++) { chkBox = RG_CompoffApproval.Items[index].FindControl("chk_choose") as CheckBox; lblid = RG_CompoffApproval.Items[index].FindControl("lblCompoffID") as Label; lblempid = RG_CompoffApproval.Items[index].FindControl("lblEMPID") as Label; txt = RG_CompoffApproval.Items[index].FindControl("txt_AppRemarks") as TextBox; if (chkBox.Checked) { if (str == "") { str = "" + lblid.Text + ""; } else { str = str + "," + lblid.Text + ""; } if (str1 == "") { str1 = "" + lblempid.Text + ""; } else { str1 = str1 + "," + lblempid.Text + ""; } } } if (string.IsNullOrEmpty(str)) { BLL.ShowMessage(this, "please select employees"); return; } bool status = false; _obj_smhr_empcompoff = new SMHR_EMPCOMOFF(); //_obj_smhr_empcompoff.EMPNAME = str1; _obj_smhr_empcompoff.EMPCOMPOFF_STATUS = 1; _obj_smhr_empcompoff.EMPCOMPOFF_REASON = str; _obj_smhr_empcompoff.EMPCOMPOFF_APPROVEDBY = Convert.ToInt32(rtxt_ReportingMgr.Text); //string[] strSpilt = (rdp_ApprovalDate.SelectedDate).ToString().Split('/'); //_obj_smhr_empcompoff.EMPCOMPOFF_APPROVEDDATE = Convert.ToDateTime(strSpilt[1] + "/" + strSpilt[0] + "/" + strSpilt[2]); _obj_smhr_empcompoff.EMPCOMPOFF_APPROVEDDATE = Convert.ToDateTime(rdp_ApprovalDate.SelectedDate.Value); _obj_smhr_empcompoff.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); if (txt.Text != string.Empty) { _obj_smhr_empcompoff.EMPCOMPOFF_APPROVALREMARKS = "a"; } else { _obj_smhr_empcompoff.EMPCOMPOFF_APPROVALREMARKS = null; } _obj_smhr_empcompoff.LASTMDFBY = Convert.ToInt32(Session["USER_ID"]); _obj_smhr_empcompoff.LASTMDFDATE = DateTime.Now; _obj_smhr_empcompoff.OPERATION = operation.Update1; status = BLL.set_empcompoffs(_obj_smhr_empcompoff); if (status == true) { bool rs = false; for (int index = 0; index <= RG_CompoffApproval.Items.Count - 1; index++) { chkBox = RG_CompoffApproval.Items[index].FindControl("chk_choose") as CheckBox; if (chkBox.Checked) { lblid = RG_CompoffApproval.Items[index].FindControl("lblCompoffID") as Label; lblempid = RG_CompoffApproval.Items[index].FindControl("lblEMPID") as Label; lblleave = RG_CompoffApproval.Items[index].FindControl("lblleavetype") as Label; _obj_smhr_leavebal.OPERATION = operation.Update; _obj_smhr_leavebal.EMPNAME = lblempid.Text; _obj_smhr_leavebal.MODE = 4; _obj_smhr_leavebal.LT_LEAVETYPEID = Convert.ToInt32(lblleave.Text); rs = BLL.set_leavebalances(_obj_smhr_leavebal); } } if (rs == true) { BLL.ShowMessage(this, "Selected Compoffs approved and Leave Balance Updated"); LoadData(); RG_CompoffApproval.DataBind(); return; } //_obj_smhr_leavebal.OPERATION = operation.Update; //_obj_smhr_leavebal.EMPNAME = str1; //_obj_smhr_leavebal.MODE = 4; //SMHR_LEAVEMASTER _obj_smhr_leavemaster = new SMHR_LEAVEMASTER(); //_obj_smhr_leavemaster.OPERATION = operation.Empty; //_obj_smhr_leavemaster.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); //DataTable dtid = new DataTable(); //dtid = BLL.get_LeaveMaster(_obj_smhr_leavemaster); //if (dtid.Rows.Count > 0) //{ // _obj_smhr_leavebal.LT_LEAVETYPEID = Convert.ToInt32(dtid.Rows[0]["LEAVEMASTER_ID"]); // bool rs = BLL.set_leavebalances(_obj_smhr_leavebal); // BLL.ShowMessage(this, "selected Compoffs approved and Leave Balance Updated"); // LoadData(); // RG_CompoffApproval.DataBind(); // return; //} //else //{ // BLL.ShowMessage(this,"Please select allow Comp-off check in either of the leaves in Leave Master screen"); //} } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_CompOffApproval", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { Session["DASHBOARD"] = "true"; } if (Convert.ToString(Session["EMP_ID"]) == "") { Response.Redirect("Login.aspx", false); } if (!Page.IsPostBack) { lbl_Birthday.Text = "BIRTHDAY REMINDERS - " + DateTime.Now.ToLongDateString().ToUpper(); getBirthday(); string str_Loginid = Convert.ToString(Session["USER_ID"]); _obj_smhr_Dashboard = new SMHR_DAHSBOARD(); //CODE FOR FETCHING EMPLOYEE NAME _obj_smhr_Dashboard.OPERATION = operation.Select; _obj_smhr_Dashboard.SMHR_DASHBOARD_EMP_ID = Convert.ToInt32(str_Loginid); DataTable dt_getEMP_NAME = BLL.get_EMP_ID(_obj_smhr_Dashboard); if (dt_getEMP_NAME.Rows.Count != 0) { lbl_EmpName.Text = Convert.ToString(dt_getEMP_NAME.Rows[0][0]); lbl_EmpBloodGroup.Text = Convert.ToString(dt_getEMP_NAME.Rows[0][1]); } else { BLL.ShowMessage(this, "No employee name exists for this login id"); //Response.Redirect("~/Login.aspx"); } //CODE FOR FETCHING EMPLOYEE ID _obj_smhr_Dashboard.OPERATION = operation.Select_Emp; _obj_smhr_Dashboard.SMHR_DASHBOARD_LOGIN_ID = Convert.ToInt32(str_Loginid); DataTable dt_getEMP_ID = BLL.get_EMP_ID(_obj_smhr_Dashboard); string STR_EMP_ID = Convert.ToString(dt_getEMP_ID.Rows[0][0]); lbl_EmpId.Text = STR_EMP_ID; //CODE FOR FETCHING EMPLOYEE DESIGNATION _obj_smhr_Dashboard.OPERATION = operation.Select_Pos; _obj_smhr_Dashboard.SMHR_DASHBOARD_EMP_ID = Convert.ToInt32(STR_EMP_ID); DataTable dt_getEMP_DESG = BLL.get_EMP_ID(_obj_smhr_Dashboard); lbl_EmpDesignation.Text = Convert.ToString(dt_getEMP_DESG.Rows[0][0]); //CODE FOR FETCHING EMPLOYEE DEPARTMENT _obj_smhr_Dashboard.OPERATION = operation.Select_Dept; _obj_smhr_Dashboard.SMHR_DASHBOARD_EMP_ID = Convert.ToInt32(STR_EMP_ID); DataTable dt_getEMP_DEPT = BLL.get_EMP_ID(_obj_smhr_Dashboard); lbl_EmpDepartment.Text = Convert.ToString(dt_getEMP_DEPT.Rows[0][0]); //NO of Pending Leave Applications _obj_smhr_Leaveapp = new SMHR_LEAVEAPP(); _obj_smhr_Leaveapp.OPERATION = operation.Check_New; _obj_smhr_Leaveapp.LEAVEAPP_STATUS = Convert.ToInt32(0); _obj_smhr_Leaveapp.LEAVEAPP_APPROVEDBY = Convert.ToInt32(STR_EMP_ID); DataTable dt_NoOfPendingLeave = BLL.get_LeaveApp(_obj_smhr_Leaveapp); lbl_pendingleave.Text = Convert.ToString(dt_NoOfPendingLeave.Rows[0][0]); //No of Pending Comp-Off Application _obj_smhr_Compoff = new SMHR_EMPCOMOFF(); _obj_smhr_Compoff.OPERATION = operation.Check_New; _obj_smhr_Compoff.EMPCOMPOFF_STATUS = Convert.ToInt32(0); _obj_smhr_Compoff.EMPCOMPOFF_APPROVEDBY = Convert.ToInt32(STR_EMP_ID); DataTable dt_NoOfPendingCOMPOFF = BLL.get_empcompffs(_obj_smhr_Compoff); lbl_pendingcompoff.Text = Convert.ToString(dt_NoOfPendingCOMPOFF.Rows[0][0]); //No of Pending Expense Applications _obj_smhr_Expense = new SMHR_EXPENSE(); _obj_smhr_Expense.OPERATION = operation.Check_New; _obj_smhr_Expense.EXPENSE_STATUS = Convert.ToInt32(0); _obj_smhr_Expense.EXPENSE_APPROVEDBY = Convert.ToInt32(STR_EMP_ID); DataTable dt_NoOfPendingExpense = BLL.get_Expense(_obj_smhr_Expense); lbl_pendingexpense.Text = Convert.ToString(dt_NoOfPendingExpense.Rows[0][0]); //No of Pending Loan Applications //EMPLOYEE LEAVE APPLICATION STATUS _obj_smhr_Leaveapp = new SMHR_LEAVEAPP(); _obj_smhr_Leaveapp.OPERATION = operation.Select_New; _obj_smhr_Leaveapp.EMP_ID = Convert.ToInt32(STR_EMP_ID); DataTable dt_leavestatus = BLL.get_LeaveApp(_obj_smhr_Leaveapp); int int_NoOfLeaves = dt_leavestatus.Rows.Count; if (int_NoOfLeaves == 0) { lbl_MgrLeaveAppStatus.Text = "No leave application status available"; //BLL.ShowMessage(this, "No data available"); } else { int lastLeaveStatus = Convert.ToInt32(dt_leavestatus.Rows[int_NoOfLeaves - 1][0]); if (lastLeaveStatus == 0) { lbl_MgrLeaveAppStatus.Text = "Leave Application Pending"; } else if (lastLeaveStatus == 1) { lbl_MgrLeaveAppStatus.Text = "Leave Application Approved"; } else if (lastLeaveStatus == 2) { lbl_MgrLeaveAppStatus.Text = "Leave Application Rejected"; } else if (lastLeaveStatus == 3) { lbl_MgrLeaveAppStatus.Text = "Leave Application Cancelled"; } else { lbl_MgrLeaveAppStatus.Text = "Leave Application Not Found"; } } //EMPLOYEE COMP-OFF APPLICATION STATUS _obj_smhr_Compoff = new SMHR_EMPCOMOFF(); _obj_smhr_Compoff.OPERATION = operation.Select_New; _obj_smhr_Compoff.EMP_ID = Convert.ToInt32(STR_EMP_ID); DataTable dt_compoff = BLL.get_empcompffs(_obj_smhr_Compoff); int int_NoOfCompOff = dt_compoff.Rows.Count; if (int_NoOfCompOff == 0) { lbl_MgrCompOffAppStatus.Text = "No comp-off application status available"; // BLL.ShowMessage(this, "No data available"); } else { int lastCompOffStatus = Convert.ToInt32(dt_compoff.Rows[(int_NoOfCompOff) - 1][0]); if (lastCompOffStatus == 0) { lbl_MgrCompOffAppStatus.Text = "Comp-Off Application Pending"; } else if (lastCompOffStatus == 1) { lbl_MgrCompOffAppStatus.Text = "Comp-Off Application Approved"; } else if (lastCompOffStatus == 2) { lbl_MgrCompOffAppStatus.Text = "Comp-Off Applicaiton Rejected"; } else if (lastCompOffStatus == 3) { lbl_MgrCompOffAppStatus.Text = "Comp-Off Application Cancelled"; } else { lbl_MgrCompOffAppStatus.Text = "Comp-Off Application Not Found"; } } //EMPLOYEE EXPENSE APPLICATION STATUS _obj_smhr_Expense = new SMHR_EXPENSE(); _obj_smhr_Expense.OPERATION = operation.Select_New; _obj_smhr_Expense.EMP_ID = Convert.ToInt32(STR_EMP_ID); DataTable dt_expense = BLL.get_Expense(_obj_smhr_Expense); int int_NoOfExpense = dt_compoff.Rows.Count; if (int_NoOfExpense == 0) { lbl_MgrExpenseAppStatus.Text = "No expense application status available"; } else { int lastExpenseStatus = Convert.ToInt32(dt_compoff.Rows[(int_NoOfExpense) - 1][0]); if (lastExpenseStatus == 0) { lbl_MgrExpenseAppStatus.Text = "Expense Application Pending"; } else if (lastExpenseStatus == 1) { lbl_MgrExpenseAppStatus.Text = "Expense Application Approved"; } else if (lastExpenseStatus == 2) { lbl_MgrExpenseAppStatus.Text = "Expense Application Rejected"; } else if (lastExpenseStatus == 3) { lbl_MgrExpenseAppStatus.Text = "Expense Application Cancelled"; } else { lbl_MgrExpenseAppStatus.Text = "Expense Application Not Found"; } } //Modified #region Pie-Chart for Ytd Balances _obj_smhr_Dashboard = new SMHR_DAHSBOARD(); string str_MonthNo = DateTime.Now.Month.ToString(); System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo(); string str_Period_Month = mfi.GetMonthName(Convert.ToInt32(str_MonthNo)); string str_Period_Year = DateTime.Now.Year.ToString(); string str_PeriodName = str_Period_Month.ToUpper() + " " + str_Period_Year; _obj_smhr_Dashboard.OPERATION = operation.Check_New; _obj_smhr_Dashboard.SMHR_DASHBOARD_PERIODNAME = str_PeriodName; DataTable dt_PeriodID = BLL.get_EMP_ID(_obj_smhr_Dashboard); if (dt_PeriodID.Rows.Count == 0) { //DataTable dt_ZeroYtdBalance = new DataTable(); //BLL.ShowMessage(this, "No data available"); } string str_PeriodId = Convert.ToString(dt_PeriodID.Rows[0][0]); _obj_smhr_Dashboard.OPERATION = operation.Check1; _obj_smhr_Dashboard.SMHR_DASHBOARD_EMP_ID = Convert.ToInt32(STR_EMP_ID); _obj_smhr_Dashboard.SMHR_DASHBOARD_PERIODID = Convert.ToInt32(str_PeriodId); DataTable dt_YtdBalance = BLL.get_EMP_ID(_obj_smhr_Dashboard); if (dt_YtdBalance.Rows.Count == 0) { DataTable dt_ZeroYtdBalance = new DataTable(); DataRow dr_ZeroYtdBalance = dt_ZeroYtdBalance.NewRow(); DataColumn dc_ZeroYtdBalance = new DataColumn(); DataColumn dc_ZeroPayItem_PayDesc = new DataColumn(); dc_ZeroYtdBalance.ColumnName = "YtdBalance"; dc_ZeroPayItem_PayDesc.ColumnName = "payitem_paydesc"; dt_ZeroYtdBalance.Columns.Add(dc_ZeroYtdBalance); dt_ZeroYtdBalance.Columns.Add(dc_ZeroPayItem_PayDesc); dr_ZeroYtdBalance["YtdBalance"] = "0.00"; dr_ZeroYtdBalance["payitem_paydesc"] = "Ytd Balances"; dt_ZeroYtdBalance.Rows.Add(dr_ZeroYtdBalance); RadChart_YtdBalances.DataSource = dt_ZeroYtdBalance; RadChart_YtdBalances.DataBind(); //RadChart_YtdBalances.Visible = false; //BLL.ShowMessage(this, "No data available for ytd balances"); } else { RadChart_YtdBalances.DataSource = dt_YtdBalance; RadChart_YtdBalances.DataBind(); } #endregion //Pie-chart #region Pie-Chart for Leave Balance bool status = false; _obj_smhr_Dashboard = new SMHR_DAHSBOARD(); string str_Current_Year = DateTime.Now.Year.ToString(); _obj_smhr_Dashboard.SMHR_DASHBOARD_PERIODNAME = str_Current_Year; _obj_smhr_Dashboard.OPERATION = operation.Select_Period; DataTable dt_Period_ID = BLL.get_EMP_ID(_obj_smhr_Dashboard); string str_Period_Name = Convert.ToString(dt_Period_ID.Rows[0][0]); _obj_smhr_Dashboard.OPERATION = operation.Select_New; _obj_smhr_Dashboard.SMHR_DASHBOARD_PERIODNAME = str_Period_Name; _obj_smhr_Dashboard.SMHR_DASHBOARD_EMP_ID = Convert.ToInt32(STR_EMP_ID); DataTable dt_LeaveBalance = BLL.get_EMP_ID(_obj_smhr_Dashboard); if (dt_LeaveBalance.Rows.Count != 0) { for (int int_rowcount = 0; int_rowcount < dt_LeaveBalance.Rows.Count; int_rowcount++) { if (Convert.ToDouble(dt_LeaveBalance.Rows[int_rowcount]["LT_CURRENTBALANCE"]) == 0.00) { //BLL.ShowMessage(this, "No leaves to have fun"); lbl_zeroleave.Visible = true; lbl_zeroleave.Text = "No leaves available"; status = true; } } if (status == false) { RadChart2.Visible = true; RadChart2.DataSource = dt_LeaveBalance; RadChart2.DataBind(); } } else { lbl_zeroleave.Visible = true; lbl_zeroleave.Text = "No leaves available"; //BLL.ShowMessage(this, "No data available for leave balances"); } #endregion #region Pie-Chart for Performance Hikes _obj_smhr_Dashboard = new SMHR_DAHSBOARD(); _obj_smhr_Dashboard.OPERATION = operation.Select_Hike; _obj_smhr_Dashboard.SMHR_DASHBOARD_EMP_ID = Convert.ToInt32(STR_EMP_ID); DataTable dt_Hike = BLL.get_EMP_ID(_obj_smhr_Dashboard); if (dt_Hike.Rows.Count != 0) { for (int int_rowcount = 0; int_rowcount < dt_Hike.Rows.Count; int_rowcount++) { if (Convert.ToDouble(dt_Hike.Rows[int_rowcount]["Hike"]) == 0.00) { //BLL.ShowMessage(this, "No leaves to have fun"); lbl_zerohike.Visible = true; lbl_zerohike.Text = "No leaves available"; status = true; } } if (status == false) { RadChart_Performance.Visible = true; RadChart_Performance.DataSource = dt_Hike; RadChart_Performance.DataBind(); } } else { lbl_zerohike.Visible = true; lbl_zerohike.Text = "No leaves to have fun"; //BLL.ShowMessage(this, "No data available for leave balances"); } #endregion //Code For scrolling text //_obj_smhr_Recruitmentupdates = new SMHR_RECRUITMENTUPDATES(); //_obj_smhr_Recruitmentupdates.OPERATION = operation.Select_New; //_obj_smhr_Recruitmentupdates.SMHR_CURRENTDATE = DateTime.Now; //DataTable dt_RecruitmentUpdates = BLL.get_RecruitmentUpdates(_obj_smhr_Recruitmentupdates); //if (dt_RecruitmentUpdates.Rows.Count != 0) //{ // //string str_ReqName = dt_RecruitmentUpdates.Rows[0]["JOBREQ_REQNAME"].ToString(); // Radticker1.DataSource = dt_RecruitmentUpdates;// dt_RecruitmentUpdates; // Radticker1.DataTextField = "JOBREQ_UPDATE"; // //Radticker1.DataMember = str_ReqName; // Radticker1.DataBind(); //} //else //{ // BLL.ShowMessage(this, "Recruitment are closed now"); //} } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_Dashboard1", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }