private void GetStatus() { try { Business obj = new Business(); DataTable ds = obj.GetLeaveStatus(); ddlSelect.DataSource = ds; ddlSelect.DataTextField = "Status"; ddlSelect.DataValueField = "StatusID"; ddlSelect.DataBind(); ddlLeaveApprove.DataSource = ds; ddlLeaveApprove.DataTextField = "Status"; ddlLeaveApprove.DataValueField = "StatusID"; ddlLeaveApprove.DataBind(); } catch (Exception ex) { } }
protected void btnUpdateIn_Click(object sender, EventArgs e) { try { string EmpID = hdnEmpID.Value.ToString().Trim(); int loguserId = Convert.ToInt32(hdnLogUserID.Value); string empname = Session["EmpName"].ToString().Trim(); string timezone = ""; if (Convert.ToInt32(Session["TimeZoneID"]) == 2) { timezone = "Eastern Standard Time"; } else { timezone = "India Standard Time"; } DateTime ISTTime = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(timezone)); var CurentDatetime = ISTTime; string notes = ""; string signinTime = ""; if (loguserId != 0) { notes = "Sign in time changed by " + empname + " at -" + ISTTime.ToString("MM/dd/yyyy hh:mm:ss") + "\n"; signinTime = Convert.ToDateTime(hdnSignInTime.Value).ToString("MM/dd/yyyy") + " " + txtSignIn.Text; } else { signinTime = Convert.ToDateTime(hdnSignInTime.Value).ToString("MM/dd/yyyy") + " " + txtSignIn.Text; notes = "Sign in time added by " + empname + " at -" + ISTTime.ToString("MM/dd/yyyy hh:mm:ss") + "\n to " + signinTime; } Business obj = new Business(); bool bnew = obj.UpdateSignTime(EmpID, loguserId, signinTime, notes); Page.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true); } catch (Exception ex) { } }
protected void btnMultipleUpdateOut_Click(object sender, EventArgs e) { try { Business obj = new Business(); string EmpID = hdnMultipleEmpID.Value.ToString().Trim(); DateTime StartDate = GeneralFunction.GetFirstDayOfWeekDate(Convert.ToDateTime(Session["TodayDate"].ToString())); DateTime EndDate = GeneralFunction.GetLastDayOfWeekDate(Convert.ToDateTime(Session["TodayDate"].ToString())); string empname = Session["EmpName"].ToString().Trim(); string timezone = ""; if (Convert.ToInt32(Session["TimeZoneID"]) == 2) { timezone = "Eastern Standard Time"; } else { timezone = "India Standard Time"; } DateTime ISTTime = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(timezone)); var CurentDatetime = ISTTime; int LocationID = Convert.ToInt32(ddlLocation.SelectedItem.Value); int len = Convert.ToInt32(hdnMultipleLength.Value); if (len == 0) { string signInnotes = ""; string signinTime = ""; int loguserId = Convert.ToInt32(hdnMultipleEditLogUserID.Value); if (txtMultipleSignIn.Text != "") { if (loguserId != 0) { signInnotes = "Sign in time changed by " + empname + " at -" + ISTTime.ToString("MM/dd/yyyy hh:mm:ss") + "\n"; signinTime = Convert.ToDateTime(hdnMultipleSignInTime.Value).ToString("MM/dd/yyyy") + " " + txtMultipleSignIn.Text; } else { signinTime = Convert.ToDateTime(hdnMultipleSignInTime.Value).ToString("MM/dd/yyyy") + " " + txtMultipleSignIn.Text; signInnotes = "Sign in time added by " + empname + " at -" + ISTTime.ToString("MM/dd/yyyy hh:mm:ss") + "\n to " + signinTime; } string Signoutnotes = "Sign out time changed by " + empname + " at -" + ISTTime.ToString("MM/dd/yyyy hh:mm:ss") + "\n"; string signOutTime = "01/01/1900"; if (txtMultipleSignOut.Text != "") { signOutTime = Convert.ToDateTime(hdnMultipleSignInTime.Value).ToString("MM/dd/yyyy") + " " + txtMultipleSignOut.Text; } bool bnew = obj.UpdateSignInSignOut(EmpID, loguserId, signinTime, signOutTime, signInnotes, Signoutnotes); } else { bool bnew = obj.UpdateSignInSignOutDelete(loguserId); } } else { // System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "GetMultiple();", true); string multiplesignIns = hdnMultipleSignIns.Value; string[] multipleSet = multiplesignIns.Split('*'); for (int i = 0; i < multipleSet.Length - 1; i++) { string[] singleSet = multipleSet[i].Split('-'); int loguserID = Convert.ToInt32(singleSet[0].ToString()); string signIn = singleSet[1].ToString(); string signOut = singleSet[2].ToString(); string signInTime = "01/01/1900"; string signInnotes = ""; string Signoutnotes = ""; if (signIn != "N/A" && signIn != "") { signInTime = Convert.ToDateTime(hdnMultipleSignInTime.Value).ToString("MM/dd/yyyy") + " " + signIn; signInnotes = "Sign in time changed by " + empname + " at -" + ISTTime.ToString("MM/dd/yyyy hh:mm:ss") + "\n"; string signOutTime = "01/01/1900"; if (signOut != "N/A") { signOutTime = Convert.ToDateTime(hdnMultipleSignInTime.Value).ToString("MM/dd/yyyy") + " " + signOut; Signoutnotes = "Sign out time changed by " + empname + " at -" + ISTTime.ToString("MM/dd/yyyy hh:mm:ss") + "\n"; } bool bnew = obj.UpdateSignInSignOut(EmpID, loguserID, signInTime, signOutTime, signInnotes, Signoutnotes); } else { bool bnew = obj.UpdateSignInSignOutDelete(loguserID); } } } // GetReportAdmin(StartDate, EndDate, LocationID); Page.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true); mdlMultipleEditEditPopUp.Hide(); } catch (Exception ex) { } }
private void GetShifts(string LocationName) { Business business = new Business(); DataSet dsShifts = business.GetShiftsByLocationName(LocationName); ddlShift.DataSource = dsShifts; ddlShift.DataTextField = "shiftname"; ddlShift.DataValueField = "shiftID"; ddlShift.DataBind(); ddlShift.Items.Insert(0, new ListItem("ALL", "0")); }
private void GetNamesList(string Fieldname, DataTable dt) { try { if (Fieldname == "Department") { Attendance.BAL.Report obj = new Report(); DataTable ds = obj.GetAllDepartments(); ddlNewValue.DataSource = ds; ddlNewValue.DataTextField = "DeptName"; ddlNewValue.DataValueField = "DeptID"; ddlNewValue.DataBind(); ddlNewValue.SelectedIndex = ddlNewValue.Items.IndexOf(ddlNewValue.Items.FindByValue(dt.Rows[0]["NewValue"].ToString())); txtEditNewValue.Visible = false; ddlNewValue.Visible = true; } else if (Fieldname == "Location") { Attendance.BAL.Report obj = new Report(); DataTable ds = obj.GetLocations(); ddlNewValue.DataSource = ds; ddlNewValue.DataTextField = "LocationName"; ddlNewValue.DataValueField = "LocationId"; ddlNewValue.DataBind(); ddlNewValue.SelectedIndex = ddlNewValue.Items.IndexOf(ddlNewValue.Items.FindByValue(dt.Rows[0]["NewValue"].ToString())); txtEditNewValue.Visible = false; ddlNewValue.Visible = true; } else if (Fieldname == "Schedule") { Attendance.BAL.Report obj = new Attendance.BAL.Report(); DataTable ds = obj.GetAllScheduleTypes(); ddlNewValue.DataSource = ds; ddlNewValue.DataValueField = "ScheduleID"; ddlNewValue.DataTextField = "ScheduleType"; ddlNewValue.DataBind(); ddlNewValue.SelectedIndex = ddlNewValue.Items.IndexOf(ddlNewValue.Items.FindByValue(dt.Rows[0]["NewValue"].ToString())); txtEditNewValue.Visible = false; ddlNewValue.Visible = true; } else if (Fieldname == "State") { Attendance.BAL.Business obj = new Attendance.BAL.Business(); DataTable ds = obj.GetState(); ddlNewValue.DataSource = ds; ddlNewValue.DataValueField = "StateID"; ddlNewValue.DataTextField = "StateName"; ddlNewValue.DataBind(); ddlNewValue.SelectedIndex = ddlNewValue.Items.IndexOf(ddlNewValue.Items.FindByValue(dt.Rows[0]["NewValue"].ToString())); txtEditNewValue.Visible = false; ddlNewValue.Visible = true; } else if (Fieldname == "Wage") { Attendance.BAL.Report obj = new Attendance.BAL.Report(); DataTable ds = obj.GetAllWages(); ddlNewValue.DataSource = ds; ddlNewValue.DataValueField = "WageID"; ddlNewValue.DataTextField = "WageType"; ddlNewValue.DataBind(); txtEditNewValue.Visible = false; ddlNewValue.Visible = true; ddlNewValue.SelectedIndex = ddlNewValue.Items.IndexOf(ddlNewValue.Items.FindByValue(dt.Rows[0]["NewValue"].ToString())); } else if (Fieldname == "Employee type") { Attendance.BAL.Report obj = new Attendance.BAL.Report(); DataTable ds = obj.GetAllEmployeetypes(); ddlNewValue.DataSource = ds; ddlNewValue.DataValueField = "EmpType"; ddlNewValue.DataTextField = "EmpTypeID"; ddlNewValue.DataBind(); ddlNewValue.SelectedIndex = ddlNewValue.Items.IndexOf(ddlNewValue.Items.FindByValue(dt.Rows[0]["NewValue"].ToString())); txtEditNewValue.Visible = false; ddlNewValue.Visible = true; } else if (Fieldname == "Shift") { Attendance.BAL.EmployeeBL obj = new Attendance.BAL.EmployeeBL(); DataTable ds = obj.GetShifts(); DataView dv = ds.DefaultView; dv.RowFilter = "locationID=" + Convert.ToInt32(dt.Rows[0]["locationID"].ToString()); DataTable dt1 = dv.ToTable(); ddlNewValue.DataSource = dt1; ddlNewValue.DataTextField = "ShiftName"; ddlNewValue.DataValueField = "ShiftID"; ddlNewValue.DataBind(); ddlNewValue.SelectedIndex = ddlNewValue.Items.IndexOf(ddlNewValue.Items.FindByValue(dt.Rows[0]["NewValue"].ToString())); txtEditNewValue.Visible = false; ddlNewValue.Visible = true; } else if (Fieldname == "Filling status") { ddlNewValue.DataSource = null; ddlNewValue.DataBind(); ddlNewValue.Items.Insert(0, new ListItem("Single", "1")); ddlNewValue.Items.Insert(1, new ListItem("Married", "2")); txtEditNewValue.Visible = false; ddlNewValue.Visible = true; ddlNewValue.SelectedIndex = ddlNewValue.Items.IndexOf(ddlNewValue.Items.FindByValue(dt.Rows[0]["NewValue"].ToString())); } else { txtEditNewValue.Text = dt.Rows[0]["NewValue"].ToString(); txtEditNewValue.Visible = true; ddlNewValue.Visible = false; } } catch (Exception ex) { } }
private void GetShifts(string LocationName) { try { Business business = new Business(); DataSet dsShifts = business.GetShiftsByLocationName(LocationName); ddlShift.DataSource = dsShifts; ddlShift.DataTextField = "shiftname"; ddlShift.DataValueField = "shiftID"; ddlShift.DataBind(); ddlShift.Items.Insert(0, new ListItem("Select", "0")); ddlgridShift.DataSource = dsShifts; ddlgridShift.DataTextField = "shiftname"; ddlgridShift.DataValueField = "shiftID"; ddlgridShift.DataBind(); ddlgridShift.Items.Insert(0, new ListItem("ALL", "0")); } catch (Exception ex) { ////Shobha, I cannot and will not be relieving you. I //expect you to continue working as we have agreed earlier. // I have made it very clear in our long conversation. //There is no second thoughts on my end. When we talked, //you have not mentioned anything about blank check. //Even if you did now, I cannot help. Please understand //we have to honor each of our commitments and fulfill our obligations. //I expect you to stick to your end of the relationship. // Anything else from you will cause immense damage and hurt to me and the organization. // It is simply not acceptable. } }
protected void LeaveSubmit_Click(object sender, EventArgs e) { try { Business obj = new Business(); string timezone = ""; if (Convert.ToInt32(Session["TimeZoneID"]) == 2) { timezone = "Eastern Standard Time"; } else { timezone = "India Standard Time"; } DateTime CurrentDt = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(timezone)); int UserID = Convert.ToInt32(hdnLeaveUserID.Value); DateTime FromDt = Convert.ToDateTime(txtFromDt.Text); DateTime ToDt = Convert.ToDateTime(txtToDt.Text); string Passcode = txtLeavePassCode.Text.ToString(); string Reason = txtReason.Text == "" ? "" : GeneralFunction.ToProperNotes(txtReason.Text); string EmpID = txtLeaveEmpID.Text; DataSet ds = obj.SaveLeaveRequestDetails(UserID, EmpID, FromDt, ToDt, CurrentDt, Reason, Passcode); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["LeaveID"].ToString() == "Applied") { lblLeaveError.Text = "You have already applied leave for these days"; lblLeaveError.Visible = true; txtReason.Text = ""; txtFromDt.Text = ""; txtToDt.Text = ""; } else { System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "showLeaveSuccess();", true); } } else { lblLeaveError.Text = "Invalid employee id and passcode"; lblLeaveError.Visible = true; } } else { lblLeaveError.Text = "Invalid employee id and passcode"; lblLeaveError.Visible = true; } } catch (Exception ex) { } }
protected void btnLeaveReqSubmit_Click(object sender, EventArgs e) { try { Business obj = new Business(); int userid = Convert.ToInt32(Session["UserID"]); DateTime FromDate = Convert.ToDateTime(txtLeaveFrom.Text); DateTime ToDate = Convert.ToDateTime(txtLeaveTo.Text); string Reason = txtReason.Text == "" ? "" : GeneralFunction.ToProperNotes(txtReason.Text); string timezone = ""; if (Convert.ToInt32(Session["TimeZoneID"]) == 2) { timezone = "Eastern Standard Time"; } else { timezone = "India Standard Time"; } DateTime ISTTime = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(timezone)); DataSet ds = obj.SaveLeaveRequestDetails(userid, "", FromDate, ToDate, ISTTime, Reason, ""); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["LeaveID"].ToString() == "Applied") { lblLeaveError.Text = "You have already applied leave for these days"; lblLeaveError.Visible = true; txtReason.Text = ""; txtLeaveFrom.Text = ""; txtLeaveTo.Text = ""; } else { System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "alert('Leave request updated successfully');", true); mdlNewLeaveRequest.Hide(); DateTime startDate = Convert.ToDateTime(Session["TodayDate"]); DateTime endDate = startDate.AddDays(7); EmployeeBL objLeave = new EmployeeBL(); DataTable datas = objLeave.GetLeaveRequestDetByUserID(Convert.ToInt32(Session["UserID"]), startDate, endDate); grdSingleLeaveReq.DataSource = datas; grdSingleLeaveReq.DataBind(); objLeave = null; } } } } catch (Exception ex) { } }
private void GetShifts(string LocationName) { try { Business business = new Business(); DataSet dsShifts = business.GetShiftsByLocationName(LocationName); ddlShift.DataSource = dsShifts; ddlShift.DataTextField = "shiftname"; ddlShift.DataValueField = "shiftID"; ddlShift.DataBind(); } catch (Exception ex) { } }
private void GetShifts(int LocationID) { try { Business business = new Business(); DataSet dsShifts = business.GetShiftsByLocationIdToHoliday(LocationID); ddlHolshift.DataSource = dsShifts; ddlHolshift.DataTextField = "shiftname"; ddlHolshift.DataValueField = "shiftname"; ddlHolshift.DataBind(); ddlHolshift.Items.Insert(0, new ListItem("Select", "Select")); ddlHolshift.Items.Insert(1, new ListItem("ALL", "0")); ddlDefaultShift.DataSource = dsShifts; ddlDefaultShift.DataTextField = "shiftname"; ddlDefaultShift.DataValueField = "shiftname"; ddlDefaultShift.DataBind(); ddlDefaultShift.Items.Insert(0, new ListItem("Select", "Select")); ddlDefaultShift.Items.Insert(1, new ListItem("ALL", "0")); } catch (Exception ex) { } }
protected void btnMultipleUpdateOut_Click(object sender, EventArgs e) { try { Business obj = new Business(); string EmpID = hdnMultipleEmpID.Value.ToString().Trim(); int offset = Convert.ToInt32(hdnMultipleOffset.Value.Trim()); DateTime StartDate = GeneralFunction.GetFirstDayOfWeekDate(Convert.ToDateTime(Session["TodayDate"].ToString())); DateTime EndDate = GeneralFunction.GetLastDayOfWeekDate(Convert.ToDateTime(Session["TodayDate"].ToString())); string empname = Session["EmpName"].ToString().Trim(); string timezone = ""; if (Convert.ToInt32(Session["TimeZoneID"]) == 2) { timezone = "Eastern Standard Time"; } else { timezone = "India Standard Time"; } DateTime ISTTime = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(timezone)); var CurentDatetime = ISTTime; int LocationID = Convert.ToInt32(ddlLocation.SelectedItem.Value); int len = Convert.ToInt32(hdnMultipleLength.Value); if (len == 0) { string signInnotes = ""; string signinTime = ""; int loguserId = Convert.ToInt32(hdnMultipleEditLogUserID.Value); if (txtMultipleSignIn.Text != "") { if (loguserId != 0) { signInnotes = "Sign in time changed by " + empname + " at -" + ISTTime.ToString("MM/dd/yyyy hh:mm:ss") + "\n"; signinTime = Convert.ToDateTime(txtMultipleSignIn.Text).AddHours(-offset).ToString().Trim(); // signinTime = Convert.ToDateTime(hdnMultipleSignInTime.Value).ToString("MM/dd/yyyy") + " " + txtMultipleSignIn.Text; } else { signinTime = Convert.ToDateTime(txtMultipleSignIn.Text).AddHours(-offset).ToString().Trim(); //signinTime = Convert.ToDateTime(hdnMultipleSignInTime.Value).ToString("MM/dd/yyyy") + " " + txtMultipleSignIn.Text; signInnotes = "Sign in time added by " + empname + " at -" + ISTTime.ToString("MM/dd/yyyy hh:mm:ss") + "\n to " + txtMultipleSignIn.Text; } string Signoutnotes = "Sign out time changed by " + empname + " at -" + ISTTime.ToString("MM/dd/yyyy hh:mm:ss") + "\n"; string signOutTime = "01/01/1900"; if (txtMultipleSignOut.Text != "") { // signOutTime = Convert.ToDateTime(hdnMultipleSignInTime.Value).ToString("MM/dd/yyyy") + " " + txtMultipleSignOut.Text; signOutTime = Convert.ToDateTime(txtMultipleSignOut.Text).AddHours(-offset).ToString(); } bool bnew = obj.UpdateSignInSignOut(EmpID, loguserId, signinTime, signOutTime, signInnotes, Signoutnotes); } else { bool bnew = obj.UpdateSignInSignOutDelete(loguserId); } } else { string multiplesignIns = hdnMultipleSignIns.Value; string[] multipleSet = multiplesignIns.Split('*'); for (int i = 0; i < multipleSet.Length - 1; i++) { string[] singleSet = multipleSet[i].Split('-'); int loguserID = Convert.ToInt32(singleSet[0].ToString()); string signIn = singleSet[1].ToString(); string signOut = singleSet[2].ToString(); string signInTime = "01/01/1900"; string signInnotes = ""; string Signoutnotes = ""; if (signIn != "N/A" && signIn != "") { // signInTime = Convert.ToDateTime(hdnMultipleSignInTime.Value).ToString("MM/dd/yyyy") + " " + signIn; signInTime = Convert.ToDateTime(signIn).AddHours(-offset).ToString().Trim(); signInnotes = "Sign in time changed by " + empname + " at -" + ISTTime.ToString("MM/dd/yyyy hh:mm:ss") + "\n"; string signOutTime = "01/01/1900"; if (signOut != "N/A") { //signOutTime = Convert.ToDateTime(hdnMultipleSignInTime.Value).ToString("MM/dd/yyyy") + " " + signOut; signOutTime = Convert.ToDateTime(signOut).AddHours(-offset).ToString().Trim(); Signoutnotes = "Sign out time changed by " + empname + " at -" + ISTTime.ToString("MM/dd/yyyy hh:mm:ss") + "\n"; } bool bnew = obj.UpdateSignInSignOut(EmpID, loguserID, signInTime, signOutTime, signInnotes, Signoutnotes); } else { bool bnew = obj.UpdateSignInSignOutDelete(loguserID); } } } DataTable ds = GetReportAdmin(StartDate, EndDate, LocationID, Convert.ToInt32(ddlShift.SelectedItem.Value)); if (ds.Rows.Count > 2) { Session["AtnAdminDetails"] = ds; grdAttandence.DataSource = ds; grdAttandence.DataBind(); grdWeeklyAttendance.DataSource = null; grdWeeklyAttendance.DataBind(); grdMonthlyAttendance.DataSource = null; grdMonthlyAttendance.DataBind(); lblGrdNodata.Text = ""; dvNodata.Style["display"] = "none"; } else { dvNodata.Style["display"] = "block"; lblGrdNodata.Text = "No data found"; lblGrdNodata.Visible = true; grdAttandence.DataSource = null; grdAttandence.DataBind(); grdWeeklyAttendance.DataSource = null; grdWeeklyAttendance.DataBind(); grdMonthlyAttendance.DataSource = null; grdMonthlyAttendance.DataBind(); } mdlMultipleEditEditPopUp.Hide(); } catch (Exception ex) { } }