private void GetPettyCashDetails() { try { Attendance.BAL.Report obj = new Report(); DataSet ds = obj.GetPettyCashDetails(Session["LocationName"].ToString()); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { grdPettyCashDet.DataSource = ds.Tables[0]; grdPettyCashDet.DataBind(); grdExpenseDetails.DataSource = ds.Tables[0]; grdExpenseDetails.DataBind(); } } } catch (Exception ex) { } }
protected void btnSave_Click(object sender, EventArgs e) { try { Attendance.Entities.PettyCashInfo objInfo = new Attendance.Entities.PettyCashInfo(); objInfo.AccountName = txtName.Text==""?"":GeneralFunction.ToProper(txtName.Text); objInfo.AmountType = ddlIncomeType.SelectedItem.Text; objInfo.AccountDate = txtDate.Text == "" ? Convert.ToDateTime("01/01/1900") : Convert.ToDateTime(txtDate.Text); objInfo.InitialAmoun = txtIncome.Text; objInfo.FromWhom = txtFrmWhom.Text == "" ? "" : GeneralFunction.ToProper(txtFrmWhom.Text); objInfo.ChequeNum = txtChequeNum.Text; objInfo.ExpenseAmount = txtExpenseAmnt.Text; objInfo.ExpenseDate = txtExpenseDate.Text == "" ? Convert.ToDateTime("01/01/1900") : Convert.ToDateTime(txtExpenseDate.Text); objInfo.Expensetype = txtExpenseType.Text; objInfo.ExpenseSubType = txtExpenseSubType.Text; objInfo.ExpenseManName = txtServiceName.Text == "" ? "" : GeneralFunction.ToProper(txtServiceName.Text); objInfo.BillNum = txtBillNum.Text; objInfo.VoucherNum = txtVoucherNum.Text; objInfo.Notes = txtNotes.Text == "" ? "" : GeneralFunction.ToProperNotes(txtNotes.Text); string Locationname = Session["LocationName"].ToString(); int UserID = Convert.ToInt32(Session["UserID"]); Attendance.BAL.Report obj = new Report(); bool bnew = obj.SavePettyCashDetails(objInfo, UserID, Locationname); if (bnew) { System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "alert('Saved successfully..');", true); GetPettyCashDetails(); } } catch (Exception ex) { } }
protected void btnGo_Click(object sender, EventArgs e) { try { int userid = Convert.ToInt32(Session["UserID"]); DateTime StartDate = Convert.ToDateTime(txtFromDate.Text); DateTime EndTime = Convert.ToDateTime(txtToDate.Text); ViewState["StartRptDt"] = StartDate; ViewState["EndRptDt"] = EndTime; Attendance.BAL.Report obj = new Report(); DateTime Count = obj.GetFreezedDate(EndTime, Session["LocationName"].ToString()); if (Count.ToString("MM/dd/yyyy") != "01/01/1900") { lblFreeze.Text = ""; } else { lblFreeze.Text = "This is tentative attendance report.Some or part of the attendance not yet freezed"; } GetReport(StartDate, EndTime, userid); BindListOfNewEmployee(); BindListofChanges(); } catch (Exception ex) { } }
protected void ddlReportType_SelectedIndexChanged(object sender, EventArgs e) { try { int userid = Convert.ToInt32(Session["UserID"]); // string IsAdmin = Session["IsAdmin"].ToString(); if (ddlReportType.SelectedItem.Value == "2") { DateTime todayDate = Convert.ToDateTime(Session["TodayBannerDate"]); // DateTime startOfMonth = new DateTime(todayDate.Year, todayDate.Month, 1); DateTime startDate = GeneralFunction.GetFirstDayOfWeekDate(todayDate); DateTime StartDate = startDate.AddDays(1 - startDate.Day); ViewState["StartMonth"] = StartDate.AddMonths(-6); ViewState["CurrentMonth"] = StartDate.AddMonths(-6); hdnMonthlyStartDt.Value = StartDate.AddMonths(-6).ToString(); DateTime endDate = StartDate.AddSeconds(-1); ViewState["CrntMonthEnd"] = endDate; DataTable dt = GetMonthlyreport(StartDate.AddMonths(-6), endDate); btnFreeze.Visible = false; lblFreeze.Visible = false; if (dt.Rows.Count > 0) { grdAttandence.DataSource = null; grdAttandence.DataBind(); grdWeeklyAttendance.DataSource = null; grdWeeklyAttendance.DataBind(); grdMonthlyAttendance.DataSource = dt; grdMonthlyAttendance.DataBind(); } } if (ddlReportType.SelectedItem.Value == "1") { DateTime todayDate = Convert.ToDateTime(Session["TodayDate1"]); // DateTime startOfMonth = new DateTime(todayDate.Year, todayDate.Month, 1); DateTime startDate = GeneralFunction.GetFirstDayOfWeekDate(todayDate); DateTime StartDate = startDate.AddDays(-21); ViewState["TodayDate1"] = StartDate; ViewState["CurrentWeek"] = StartDate; hdnWeeklyStartDt.Value = StartDate.ToString(); DateTime endDate = startDate.AddDays(6); ViewState["CrntWkEnd"] = endDate; DataTable dt = GetWeeklyReport(StartDate, endDate); btnFreeze.Visible = false; lblFreeze.Visible = false; if (GeneralFunction.GetFirstDayOfWeekDate(endDate).ToString("MM/dd/yyyy") == GeneralFunction.GetFirstDayOfWeekDate(DateTime.Now).ToString("MM/dd/yyyy")) { btnNext.CssClass = "btn btn-danger btn-small disabled"; btnNext.Enabled = false; } else { btnNext.CssClass = "btn btn-danger btn-small enabled"; btnNext.Enabled = true; } if (dt.Rows.Count > 0) { grdAttandence.DataSource = null; grdAttandence.DataBind(); grdWeeklyAttendance.DataSource = dt; grdWeeklyAttendance.DataBind(); grdMonthlyAttendance.DataSource = null; grdMonthlyAttendance.DataBind(); } } if (ddlReportType.SelectedItem.Value == "0") { DateTime TodayDate = Convert.ToDateTime(Session["TodayDate"]); DateTime StartDate = GeneralFunction.GetFirstDayOfWeekDate(TodayDate); DateTime EndDate = GeneralFunction.GetLastDayOfWeekDate(TodayDate); if (GeneralFunction.GetFirstDayOfWeekDate(TodayDate).ToString("MM/dd/yyyy") == GeneralFunction.GetFirstDayOfWeekDate(DateTime.Now).ToString("MM/dd/yyyy")) { btnNext.CssClass = "btn btn-danger btn-small disabled"; btnNext.Enabled = false; } else { btnNext.CssClass = "btn btn-danger btn-small enabled"; btnNext.Enabled = true; } btnFreeze.Visible = true; lblFreeze.Visible = true; // DateTime TodayDate = Convert.ToDateTime(Session["TodayDate"]); DateTime StartOfMonth = StartDate.AddDays(-1); DateTime FreezeDate = StartOfMonth; Attendance.BAL.Report obj = new Report(); // int CNT = obj.GetFreezedDate(FreezeDate); DateTime CNT = obj.GetFreezedDate(FreezeDate, ddlLocation.SelectedItem.Text.ToString().Trim()); lblFreezedate.Text = FreezeDate.ToString("MM/dd/yyyy"); hdnFreeze.Value = FreezeDate.ToString("MM/dd/yyyy"); if (CNT.ToString("MM/dd/yyyy") != "01/01/1900") { lblFreeze.Text = "Attendance freezed until " + CNT.ToString("MM/dd/yyyy"); ViewState["FreezeDate"] = CNT.ToString("MM/dd/yyyy"); btnFreeze.CssClass = "btn btn-warning btn-small disabled"; btnFreeze.Enabled = false; } else { lblFreeze.Visible = false; btnFreeze.CssClass = "btn btn-warning btn-small enabled"; btnFreeze.Enabled = true; } DataTable ds = GetReportAdmin(StartDate, EndDate, Convert.ToInt32(ddlLocation.SelectedValue)); Session["AtnAdminDetails"] = ds; grdAttandence.DataSource = ds; grdAttandence.DataBind(); grdWeeklyAttendance.DataSource = null; grdWeeklyAttendance.DataBind(); grdMonthlyAttendance.DataSource = null; grdMonthlyAttendance.DataBind(); } } catch (Exception ex) { } }
private DataTable GetWeeklyReport(DateTime startdate, DateTime enddate) { DataTable dtAttandence = new DataTable(); try { lblWeekReportheading.Text = "Weekly summary attendance report"; DateTime endOfMonth = GeneralFunction.GetFirstDayOfWeekDate(enddate); lblWeekReport.Text = "( Wk of " + startdate.ToString("MM/dd/yyyy") + " - Wk of " + endOfMonth.ToString("MM/dd/yyyy") + " )"; dtAttandence.Columns.Add("empid", typeof(string)); dtAttandence.Columns.Add("Empname", typeof(string)); dtAttandence.Columns.Add("StatingDate", typeof(string)); dtAttandence.Columns.Add("TermDate", typeof(string)); dtAttandence.Columns.Add("TermReason", typeof(string)); dtAttandence.Rows.Add(); Attendance.BAL.Report obj = new Report(); DataSet ds = obj.GetActiveUsersAdmin(startdate, enddate, ViewState["Location"].ToString().Trim()); for (int j = 0; j < 4; j++) { DataSet dsResult = obj.GetWeeklyReportAdmin(startdate, startdate.AddDays(6), ViewState["Location"].ToString().Trim()); if (ds.Tables[0].Rows.Count > 0) { dtAttandence.Columns.Add("Week" + (j + 1), typeof(string)); dtAttandence.Columns.Add("Days" + (j + 1), typeof(string)); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (j == 0) { dtAttandence.Rows.Add(); } dtAttandence.Rows[i]["empid"] = ds.Tables[0].Rows[i]["empid"].ToString(); dtAttandence.Rows[i]["empname"] = ds.Tables[0].Rows[i]["firstName"].ToString() + " " + ds.Tables[0].Rows[i]["lastname"].ToString(); dtAttandence.Rows[i]["StatingDate"] = ds.Tables[0].Rows[i]["Startdate"].ToString() == "NULL" ? "" : ds.Tables[0].Rows[i]["Startdate"].ToString(); dtAttandence.Rows[i]["TermDate"] = ds.Tables[0].Rows[i]["Termdate"].ToString() == "NULL" ? "" : ds.Tables[0].Rows[i]["Termdate"].ToString(); if (dsResult.Tables.Count > 0) { if (dsResult.Tables[0].Rows.Count > 1) { DataTable dt = dsResult.Tables[0]; DataView dv = dt.DefaultView; DataTable dtname = new DataTable(); dv.RowFilter = "empid='" + ds.Tables[0].Rows[i]["empid"].ToString() + "'"; dtname = dv.ToTable(); if (dtname.Rows.Count > 0) { // dtAttandence.Rows[i]["Week" + (j + 1)] = dtname.Rows[0]["weeklyhrs"].ToString(); dtAttandence.Rows[i]["Week" + (j + 1)] = dtname.Rows[0]["weeklyhrs"].ToString() == "NULL" ? "" : dtname.Rows[0]["weeklyhrs"].ToString() == "" ? "" : GeneralFunction.CalNumericToint(Convert.ToDouble(dtname.Rows[0]["weeklyhrs"].ToString())).ToString(); dtAttandence.Rows[i]["Days" + (j + 1)] = dtname.Rows[0]["days"].ToString() == "NULL" ? 0 : dtname.Rows[0]["days"].ToString() == "" ? 0 : Convert.ToInt32(dtname.Rows[0]["days"].ToString()); } } } } startdate = startdate.AddDays(7); enddate = startdate.AddDays(6); } } int TotalHrs1 = 0; int TotalHrs2 = 0; int TotalHrs3 = 0; int TotalHrs4 = 0; int TotalDays = 0; int Days1 = 0; int Days2 = 0; int Days3 = 0; int Days4 = 0; dtAttandence.Columns.Add("Totalhrs"); dtAttandence.Columns.Add("Days"); for (int i = 0; i < dtAttandence.Rows.Count - 1; i++) { TotalHrs1 = TotalHrs1 + ((dtAttandence.Rows[i]["Week1"].ToString() == "Null") ? 0 : (dtAttandence.Rows[i]["Week1"].ToString() == "") ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week1"])); TotalHrs2 = TotalHrs2 + (dtAttandence.Rows[i]["Week2"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Week2"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week2"])); TotalHrs3 = TotalHrs3 + ((dtAttandence.Rows[i]["Week3"].ToString() == "Null" ? 0 : (dtAttandence.Rows[i]["Week3"].ToString() == "") ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week3"]))); TotalHrs4 = TotalHrs4 + (dtAttandence.Rows[i]["Week4"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Week4"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week4"])); int WeekHrs = ((dtAttandence.Rows[i]["Week1"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Week1"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week1"])) + (dtAttandence.Rows[i]["Week2"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Week2"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week2"])) + (dtAttandence.Rows[i]["Week3"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Week3"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week3"])) + (dtAttandence.Rows[i]["Week4"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Week4"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Week4"]))); dtAttandence.Rows[i]["Totalhrs"] = WeekHrs == 0 ? "" : GeneralFunction.ConverttoTime(WeekHrs).ToString(); dtAttandence.Rows[i]["Days"] = (dtAttandence.Rows[i]["Days1"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days1"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days1"])) + (dtAttandence.Rows[i]["Days2"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days2"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days2"])) + (dtAttandence.Rows[i]["Days3"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days3"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days3"])) + (dtAttandence.Rows[i]["Days4"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days4"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days4"])); Days1 += dtAttandence.Rows[i]["Days1"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days1"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days1"]); Days2 += dtAttandence.Rows[i]["Days2"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days2"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days2"]); Days3 += dtAttandence.Rows[i]["Days3"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days3"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days3"]); Days4 += dtAttandence.Rows[i]["Days4"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days4"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days4"]); TotalDays += dtAttandence.Rows[i]["Days"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days"].ToString()); } dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Week1"] = TotalHrs1 == 0 ? "" : TotalHrs1.ToString(); dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Week2"] = TotalHrs2 == 0 ? "" : TotalHrs2.ToString(); dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Week3"] = TotalHrs3 == 0 ? "" : TotalHrs3.ToString(); dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Week4"] = TotalHrs4 == 0 ? "" : TotalHrs4.ToString(); int SUM = TotalHrs1 + TotalHrs2 + TotalHrs3 + TotalHrs4; dtAttandence.Rows[dtAttandence.Rows.Count - 1]["empid"] = "<b>Totals</b>"; dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Days"] = TotalDays; dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Days1"] = Days1; dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Days2"] = Days2; dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Days3"] = Days3; dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Days4"] = Days4; dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Totalhrs"] = SUM == 0 ? "" : GeneralFunction.ConverttoTime(SUM).ToString(); } catch (Exception ex) { } return dtAttandence; }
private void getLocations() { try { Attendance.BAL.Report obj = new Report(); DataTable dt = obj.GetLocations(); ddlLocation.DataSource = dt; ddlLocation.DataTextField = "LocationName"; ddlLocation.DataValueField = "LocationId"; ddlLocation.DataBind(); } catch (Exception ex) { } }
private void GetSchedules() { try { Attendance.BAL.Report obj = new Report(); DataTable dt = obj.GetAllScheduleTypes(); ddlSchedule.DataSource = dt; ddlSchedule.DataTextField = "ScheduleType"; ddlSchedule.DataValueField = "ScheduleID"; ddlSchedule.DataBind(); } catch (Exception ex) { } }
private void GetUserDetails(int sort,string Location) { try { Attendance.BAL.Report obj = new Report(); DataTable dt = obj.GetUsers(Location.Trim(), sort); Session["AllusersData"] = dt; if (dt.Rows.Count > 0) { if (sort == 0) { lblTotal.Text = "Total employee: " + dt.Rows[0]["TotalCount"].ToString() + " " + " " + " " + " " + "Active employee: " + dt.Rows[0]["ActiveCount"].ToString() + " " + " " + " " + " " + "Incative employee: " + dt.Rows[0]["InactiveCount"].ToString(); } else if (sort == 1) { lblTotal.Text = "Total employee: " + dt.Rows[0]["TotalCount"].ToString() + " " + " " + " " + " " + "Active employee: " + dt.Rows[0]["ActiveCount"].ToString() + " " + " " + " " + " " + "Incative employee: " + dt.Rows[0]["InactiveCount"].ToString(); } else { lblTotal.Text = "Total employee: " + dt.Rows[0]["TotalCount"].ToString() + " " + " " + " " + " " + "Active employee: " + dt.Rows[0]["ActiveCount"].ToString() + " " + " " + " " + " " + "Incative employee: " + dt.Rows[0]["InactiveCount"].ToString(); } grdUsers.DataSource = dt; grdUsers.DataBind(); BizUtility.GridSortInitail("Ascending", "Firstname", grdUsers, 0, dt); } } catch (Exception ex) { } }
private void Getdepartments() { try { Attendance.BAL.Report obj = new Report(); DataTable dt = obj.GetAllDepartments(); ddlDeptment.DataSource = dt; ddlDeptment.DataTextField = "Deptname"; ddlDeptment.DataValueField = "DeptID"; ddlDeptment.DataBind(); ddlEditDepart.DataSource = dt; ddlEditDepart.DataTextField = "Deptname"; ddlEditDepart.DataValueField = "DeptID"; ddlEditDepart.DataBind(); } catch (Exception ex) { } }
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) { } }
protected void btnCurrent_Click(object sender, EventArgs e) { try { int userid = Convert.ToInt32(Session["UserID"]); string Ismanage = Session["IsManage"].ToString(); string IsAdmin = Session["IsAdmin"].ToString(); if (ddlReportType.SelectedValue == "0") { DateTime StartDate = Convert.ToDateTime(ViewState["CurrentStart"].ToString()); DateTime EndDate = Convert.ToDateTime(ViewState["CurrentEnd"].ToString()); Session["TodayDate"] = StartDate; if (GeneralFunction.GetFirstDayOfWeekDate(StartDate).ToString("MM/dd/yyyy") == GeneralFunction.GetFirstDayOfWeekDate(DateTime.Now).ToString("MM/dd/yyyy")) { btnNext.CssClass = "btn btn-danger btn-small disabled"; btnNext.Enabled = false; } else { btnNext.CssClass = "btn btn-danger btn-small enabled"; btnNext.Enabled = true; } DataTable ds = new DataTable(); lblReport.Text = "Report type"; ddlReportType.Visible = true; lblReport.Visible = true; btnFreeze.Visible = true; lblFreeze.Visible = true; DateTime TodayDate = Convert.ToDateTime(Session["TodayDate"]); DateTime StartOfMonth = GeneralFunction.GetFirstDayOfWeekDate(TodayDate); DateTime FreezeDate = StartOfMonth.AddDays(-1); Attendance.BAL.Report obj = new Report(); // int CNT = obj.GetFreezedDate(FreezeDate); DateTime CNT = obj.GetFreezedDate(FreezeDate, Session["LocationName"].ToString().Trim(), Convert.ToInt32(ddlShift.SelectedValue)); lblFreezedate.Text = FreezeDate.ToString("MM/dd/yyyy"); hdnFreeze.Value = FreezeDate.ToString("MM/dd/yyyy"); if (CNT.ToString("MM/dd/yyyy") != "01/01/1900") { lblFreeze.Text = "Attendance freezed until " + CNT.ToString("MM/dd/yyyy"); ViewState["FreezeDate"] = CNT.ToString("MM/dd/yyyy"); btnFreeze.CssClass = "btn btn-warning btn-small disabled"; btnFreeze.Enabled = false; } else { lblFreeze.Visible = false; btnFreeze.CssClass = "btn btn-warning btn-small enabled"; btnFreeze.Enabled = true; } ds = GetReport(StartDate, EndDate, userid, Convert.ToInt32(ddlShift.SelectedItem.Value)); if (ds.Rows.Count > 1) { Session["AtnDetails"] = ds; grdAttandence.DataSource = ds; grdAttandence.DataBind(); grdWeeklyAttendance.DataSource = null; grdWeeklyAttendance.DataBind(); dvNodata.Style["display"] = "none"; lblGrdNodata.Text = ""; } else { grdAttandence.DataSource = null; grdAttandence.DataBind(); grdWeeklyAttendance.DataSource = null; grdWeeklyAttendance.DataBind(); dvNodata.Style["display"] = "block"; lblGrdNodata.Text = "No data found"; } } else if (ddlReportType.SelectedValue == "1") { ViewState["TodayDate1"] = ViewState["CurrentWeek"]; DateTime startWeek = Convert.ToDateTime(ViewState["CurrentWeek"]); DateTime EndWeek = Convert.ToDateTime(ViewState["CrntWkEnd"]); hdnWeeklyStartDt.Value = startWeek.ToString(); if (GeneralFunction.GetFirstDayOfWeekDate(EndWeek).ToString("MM/dd/yyyy") == GeneralFunction.GetFirstDayOfWeekDate(DateTime.Now).ToString("MM/dd/yyyy")) { btnNext.CssClass = "btn btn-danger btn-small disabled"; btnNext.Enabled = false; } else { btnNext.CssClass = "btn btn-danger btn-small enabled"; btnNext.Enabled = true; } lblReport.Text = "Report type"; ddlReportType.Visible = true; lblReport.Visible = true; DataTable dt = GetWeeklyReport(startWeek, EndWeek, userid, Convert.ToInt32(ddlShift.SelectedItem.Value)); if (dt.Rows.Count > 1) { btnFreeze.Visible = false; lblFreeze.Visible = false; grdAttandence.DataSource = null; grdAttandence.DataBind(); grdMonthlyAttendance.DataSource = null; grdMonthlyAttendance.DataBind(); grdWeeklyAttendance.DataSource = dt; grdWeeklyAttendance.DataBind(); dvNodata.Style["display"] = "none"; lblGrdNodata.Text = ""; } else { grdAttandence.DataSource = null; grdAttandence.DataBind(); grdWeeklyAttendance.DataSource = null; grdWeeklyAttendance.DataBind(); dvNodata.Style["display"] = "block"; lblGrdNodata.Text = "No data found"; } } else if (ddlReportType.SelectedItem.Value == "2") { DateTime StartDate = Convert.ToDateTime(ViewState["CurrentMonth"]); ViewState["StartMonth"] = StartDate; hdnMonthlyStartDt.Value = StartDate.ToString(); DateTime endDate = Convert.ToDateTime(ViewState["CrntMonthEnd"]); DataTable dt = GetMonthlyreport(StartDate, endDate, userid, Convert.ToInt32(ddlShift.SelectedItem.Value)); btnFreeze.Visible = false; lblFreeze.Visible = false; if (endDate.ToString("MM/dd/yyyy") == (DateTime.Now.AddDays(1 - DateTime.Now.Day)).AddDays(-1).ToString("MM/dd/yyyy")) { btnNext.CssClass = "btn btn-danger btn-small disabled"; btnNext.Enabled = false; } else { btnNext.CssClass = "btn btn-danger btn-small enabled"; btnNext.Enabled = true; } if (dt.Rows.Count > 1) { grdAttandence.DataSource = null; grdAttandence.DataBind(); grdWeeklyAttendance.DataSource = null; grdWeeklyAttendance.DataBind(); grdMonthlyAttendance.DataSource = dt; grdMonthlyAttendance.DataBind(); dvNodata.Style["display"] = "none"; lblGrdNodata.Text = ""; } else { grdAttandence.DataSource = null; grdAttandence.DataBind(); grdWeeklyAttendance.DataSource = null; grdWeeklyAttendance.DataBind(); grdMonthlyAttendance.DataSource = null; grdMonthlyAttendance.DataBind(); dvNodata.Style["display"] = "block"; lblGrdNodata.Text = "No data found"; } } } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { if (Session["IsAdmin"] != null && Session["UserID"] != null) { if (!IsPostBack) { comanyname.Text = CommonFiles.ComapnyName; 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; lblDate2.Text = CurentDatetime.ToString("dddd MMMM dd yyyy, hh:mm:ss tt "); lblTimeZoneName.Text = Session["TimeZoneName"].ToString().Trim(); lblHeadSchedule.Text = Session["ScheduleInOut"].ToString(); lblEmployyName.Text = Session["EmpName"].ToString().Trim(); Photo.Src = Session["Photo"].ToString().Trim(); lblLocation.Text = Session["LocationName"].ToString(); lblShiftName.Text = "-" + Session["ShiftName"].ToString(); GetShifts(lblLocation.Text.ToString()); ddlShift.SelectedIndex = ddlShift.Items.IndexOf(ddlShift.Items.FindByValue(Session["ShiftID"].ToString())); DateTime TodayDate = Convert.ToDateTime(Session["TodayBannerDate"]); getLocations(); ddlLocation.SelectedIndex = ddlLocation.Items.IndexOf(ddlLocation.Items.FindByText(lblLocation.Text.Trim())); if (Session["IsAdmin"].ToString() == "True") { ddlLocation.Enabled = true; } else { ddlLocation.Enabled = false; } Report obj = new Report(); DataSet ds=obj.GetFinalPayrollDate(Convert.ToInt32(ddlLocation.SelectedItem.Value)); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { DateTime StartDate = Convert.ToDateTime(ds.Tables[0].Rows[0]["FinalMonth"].ToString()+ "/01/" + ds.Tables[0].Rows[0]["FinalYear"].ToString()); ViewState["PaidStartDate"] = StartDate.ToString("MM/dd/yyyy"); ViewState["CurrentStDt"] = StartDate.ToString("MM/dd/yyyy"); DateTime EndDate = StartDate.AddMonths(1).AddSeconds(-1); ViewState["PaidEndDate"] = EndDate.ToString("MM/dd/yyyy"); ViewState["CurrentEndDt"] = EndDate.ToString("MM/dd/yyyy"); GetpaidLeavesData(Convert.ToInt32(ddlLocation.SelectedItem.Value), StartDate, EndDate,Convert.ToInt32(ddlShift.SelectedValue)); if (StartDate.ToString("MM/dd/yyyy") == Convert.ToDateTime(ViewState["CurrentStDt"]).ToString("MM/dd/yyyy")) { btnNext.CssClass = "btn btn-danger btn-small disabled"; btnNext.Enabled = false; } else { btnNext.CssClass = "btn btn-danger btn-small enabled"; btnNext.Enabled = true; } } else { lblNodata.Visible = true; dvlblNodata.Style["display"] = "block"; lblNodata.Text = "No data found"; lblTotal.Text = ""; grdUsers.DataSource = null; grdUsers.DataBind(); } } else { lblNodata.Visible = true; dvlblNodata.Style["display"] = "block"; lblNodata.Text = "No data found"; lblTotal.Text = ""; grdUsers.DataSource = null; grdUsers.DataBind(); } } } else { Response.Redirect("Default.aspx"); } }
protected void ddlShift_SelectedIndexChanged(object sender, EventArgs e) { try { if (ViewState["PaidStartDate"] == null) { Report obj = new Report(); DataSet ds = obj.GetFinalPayrollDate(Convert.ToInt32(ddlLocation.SelectedItem.Value)); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { DateTime StartDate = Convert.ToDateTime(ds.Tables[0].Rows[0]["FinalMonth"].ToString() + "/01/" + ds.Tables[0].Rows[0]["FinalYear"].ToString()); ViewState["PaidStartDate"] = StartDate.ToString("MM/dd/yyyy"); ViewState["CurrentStDt"] = StartDate.ToString("MM/dd/yyyy"); DateTime EndDate = StartDate.AddMonths(1).AddSeconds(-1); ViewState["PaidEndDate"] = EndDate.ToString("MM/dd/yyyy"); ViewState["CurrentEndDt"] = EndDate.ToString("MM/dd/yyyy"); GetpaidLeavesData(Convert.ToInt32(ddlLocation.SelectedItem.Value), StartDate, EndDate, Convert.ToInt32(ddlShift.SelectedValue)); if (StartDate.ToString("MM/dd/yyyy") == Convert.ToDateTime(ViewState["CurrentStDt"]).ToString("MM/dd/yyyy")) { btnNext.CssClass = "btn btn-danger btn-small disabled"; btnNext.Enabled = false; } else { btnNext.CssClass = "btn btn-danger btn-small enabled"; btnNext.Enabled = true; } } } } else { DateTime StartDate = Convert.ToDateTime(ViewState["PaidStartDate"]); DateTime EndDate = Convert.ToDateTime(ViewState["PaidEndDate"]); GetpaidLeavesData(Convert.ToInt32(ddlLocation.SelectedItem.Value), StartDate, EndDate, Convert.ToInt32(ddlShift.SelectedValue)); } } catch (Exception ex) { } }
private void GetEditHistory(DateTime startDate, DateTime Enddate) { Attendance.BAL.Report obj = new Report(); DataSet ds = obj.GetPayrollEdithistory(startDate, Enddate); Session["EditHistory"] = ds; // lblWeekPayrollReport.Text = "( " + StartDate.ToString("MM/dd/yyyy") + " - " + EndTime.ToString("MM/dd/yyyy") + " )"; //grdPayRoll.DataSource = ds.Tables[0]; //grdPayRoll.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["LocationName"] != null) { if (!IsPostBack) { comanyname.Text = CommonFiles.ComapnyName; 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; lblDate2.Text = CurentDatetime.ToString("dddd MMMM dd yyyy, hh:mm:ss tt "); lblTimeZoneName.Text = Session["TimeZoneName"].ToString().Trim(); lblHeadSchedule.Text = Session["ScheduleInOut"].ToString(); lblEmployyName.Text = Session["EmpName"].ToString().Trim(); Photo.Src = Session["Photo"].ToString().Trim(); lblLocation.Text = Session["LocationName"].ToString(); DateTime TodayDate = Convert.ToDateTime(Session["TodayBannerDate"]); DateTime StartDate = GeneralFunction.GetFirstDayOfWeekDate(TodayDate); DateTime EndDate = StartDate.AddDays(-14); ViewState["StartRptDt"] = EndDate; ViewState["EndRptDt"] = StartDate.AddDays(-1); txtToDate.Text = StartDate.AddDays(-1).ToString("MM/dd/yyyy"); txtFromDate.Text = EndDate.ToString("MM/dd/yyyy"); int userid = Convert.ToInt32(Session["UserID"]); Attendance.BAL.Report obj = new Report(); DateTime Count = obj.GetFreezedDate(EndDate, Session["LocationName"].ToString()); if (Count.ToString("MM/dd/yyyy") != "01/01/1900") { lblFreeze.Text = ""; } else { lblFreeze.Text = "This is tentative attendance report.Some or part of the attendance not yet freezed"; } GetReport(EndDate, StartDate.AddDays(-1), userid); BindListOfNewEmployee(); BindListofChanges(); } } else { Response.Redirect("Default.aspx"); } }
protected void btnPrevious_Click(object sender, EventArgs e) { try { if (ddlReportType.SelectedItem.Value == "0") { int userid = Convert.ToInt32(Session["UserID"]); DateTime TodayDate = Convert.ToDateTime(Session["TodayDate"]); DateTime PrevWeek = TodayDate.AddDays(-7); Session["TodayDate"] = PrevWeek.ToString(); if (GeneralFunction.GetFirstDayOfWeekDate(PrevWeek).ToString("MM/dd/yyyy") == GeneralFunction.GetFirstDayOfWeekDate(DateTime.Now).ToString("MM/dd/yyyy")) { btnNext.CssClass = "btn btn-danger btn-small disabled"; btnNext.Enabled = false; } else { btnNext.CssClass = "btn btn-danger btn-small enabled"; btnNext.Enabled = true; } DateTime PreWeekStart = GeneralFunction.GetFirstDayOfWeekDate(PrevWeek); DateTime PreWeekEnd = GeneralFunction.GetLastDayOfWeekDate(PrevWeek); //DataTable ds = GetReport(PreWeekStart, PreWeekEnd, userid); string Ismanage = Session["IsManage"].ToString(); string IsAdmin = Session["IsAdmin"].ToString(); DataTable ds = new DataTable(); if (Ismanage == "False") { ds = GetReportSingle(PreWeekStart, PreWeekEnd, userid); Session["AtnDetails"] = ds; if (ds.Rows.Count > 0) { grdAttandence.DataSource = null; grdAttandence.DataBind(); grdMonthlyAttendance.DataSource = null; grdMonthlyAttendance.DataBind(); grdAttendanceSingle.DataSource = ds; grdAttendanceSingle.DataBind(); lnkUserMangement.ForeColor = System.Drawing.Color.Gray; lnkUserMangement.Enabled = false; ddlLocation.Visible = false; lblGrdLocaton.Visible = false; lnkPayroll.ForeColor = System.Drawing.Color.Gray; lnkPayroll.Enabled = false; // lnkUserMangement.Style["display"] = "none"; } } else { btnFreeze.Visible = true; lblFreeze.Visible = true; // DateTime TodayDate = Convert.ToDateTime(Session["TodayDate"]); DateTime StartOfMonth = PreWeekStart.AddDays(-1); DateTime FreezeDate = StartOfMonth; Attendance.BAL.Report obj = new Report(); // int CNT = obj.GetFreezedDate(FreezeDate); DateTime CNT = obj.GetFreezedDate(FreezeDate, Session["LocationName"].ToString().Trim()); lblFreezedate.Text = FreezeDate.ToString("MM/dd/yyyy"); hdnFreeze.Value = FreezeDate.ToString("MM/dd/yyyy"); if (CNT.ToString("MM/dd/yyyy") != "01/01/1900") { lblFreeze.Text = "Attendance freezed until " + CNT.ToString("MM/dd/yyyy"); ViewState["FreezeDate"] = CNT.ToString("MM/dd/yyyy"); btnFreeze.CssClass = "btn btn-warning btn-small disabled"; btnFreeze.Enabled = false; } else { lblFreeze.Visible = false; btnFreeze.CssClass = "btn btn-warning btn-small enabled"; btnFreeze.Enabled = true; } ds = GetReport(PreWeekStart, PreWeekEnd, userid); Session["AtnDetails"] = ds; grdAttandence.DataSource = ds; grdAttandence.DataBind(); grdAttendanceSingle.DataSource = null; grdAttendanceSingle.DataBind(); grdMonthlyAttendance.DataSource = null; grdMonthlyAttendance.DataBind(); } } else if (ddlReportType.SelectedItem.Value == "1") { btnFreeze.Visible = false; lblFreeze.Visible = false; int userid = Convert.ToInt32(Session["UserID"]); DateTime todayDate = Convert.ToDateTime(ViewState["TodayDate1"]); ViewState["TodayDate1"] = todayDate.AddDays(-28); // DateTime startOfMonth = new DateTime(todayDate.Year, todayDate.Month, 1); DateTime startDate = GeneralFunction.GetFirstDayOfWeekDate(todayDate.AddDays(-28)); DateTime StartDate = startDate; hdnWeeklyStartDt.Value = StartDate.ToString(); DateTime endDate = todayDate.AddDays(-1); if (GeneralFunction.GetFirstDayOfWeekDate(startDate).ToString("MM/dd/yyyy") == GeneralFunction.GetFirstDayOfWeekDate(DateTime.Now).ToString("MM/dd/yyyy")) { btnNext.CssClass = "btn btn-danger btn-small disabled"; btnNext.Enabled = false; } else { btnNext.CssClass = "btn btn-danger btn-small enabled"; btnNext.Enabled = true; } DataTable dt = GetWeeklyReport(StartDate, endDate, userid); if (dt.Rows.Count > 0) { grdAttandence.DataSource = null; grdAttandence.DataBind(); grdWeeklyAttendance.DataSource = dt; grdWeeklyAttendance.DataBind(); grdMonthlyAttendance.DataSource = null; grdMonthlyAttendance.DataBind(); } } else if (ddlReportType.SelectedItem.Value == "2") { int userid = Convert.ToInt32(Session["UserID"]); DateTime startDate = Convert.ToDateTime(ViewState["StartMonth"]); DateTime StartDate = startDate.AddMonths(-6); hdnMonthlyStartDt.Value = StartDate.ToString(); DateTime endDate = startDate.AddSeconds(-1); ViewState["StartMonth"] = StartDate; DataTable dt = GetMonthlyreport(StartDate, endDate, userid); btnFreeze.Visible = false; lblFreeze.Visible = false; if (endDate.ToString("MM/dd/yyyy") == (DateTime.Now.AddDays(1 - DateTime.Now.Day)).AddDays(-1).ToString("MM/dd/yyyy")) { btnNext.CssClass = "btn btn-danger btn-small disabled"; btnNext.Enabled = false; } else { btnNext.CssClass = "btn btn-danger btn-small enabled"; btnNext.Enabled = true; } if (dt.Rows.Count > 0) { grdAttandence.DataSource = null; grdAttandence.DataBind(); grdWeeklyAttendance.DataSource = null; grdWeeklyAttendance.DataBind(); grdMonthlyAttendance.DataSource = dt; grdMonthlyAttendance.DataBind(); } } } catch (Exception ex) { } }
protected void grdAttandence_RowDataBound(object sender, GridViewRowEventArgs e) { try { Report obj = new Report(); if (e.Row.RowType == DataControlRowType.DataRow) { string s = string.Empty; string sTable = string.Empty; string sMonMultiple = "0"; string sTueMultiple = "0"; string sWedMultiple = "0"; string sThuMultiple = "0"; string sFriMultiple = "0"; string sSatMultiple = "0"; string sSunMultiple = "0"; var dt = new List<Attendance.Entities.MultipleLogininfo>(); Label lblStartDate = (Label)e.Row.FindControl("lblStartDate"); Label lblTermDate = (Label)e.Row.FindControl("lblTermDate"); Label lblPName = (Label)e.Row.FindControl("lblPName"); Label lblName = (Label)e.Row.FindControl("lblName"); string tip = CreateNameTable(lblPName.Text.Trim(), Convert.ToDateTime(lblStartDate.Text).ToString("MM/dd/yyyy"), Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy")); lblName.Attributes.Add("class", "tooltip2"); lblName.Attributes.Add("title", tip); Label lblMonScIn = (Label)e.Row.FindControl("lblMonScIn"); Label lblTueScIn = (Label)e.Row.FindControl("lblTueScIn"); Label lblWedScIn = (Label)e.Row.FindControl("lblWedScIn"); Label lblThuScIn = (Label)e.Row.FindControl("lblThuScIn"); Label lblFriScIn = (Label)e.Row.FindControl("lblFriScIn"); Label lblSatScIn = (Label)e.Row.FindControl("lblSatScIn"); Label lblSunScIn = (Label)e.Row.FindControl("lblSunScIn"); Label lblMonScOut = (Label)e.Row.FindControl("lblMonScOut"); Label lblTueScOut = (Label)e.Row.FindControl("lblTueScOut"); Label lblWedScOut = (Label)e.Row.FindControl("lblWedScOut"); Label lblThuScOut = (Label)e.Row.FindControl("lblThuScOut"); Label lblFriScOut = (Label)e.Row.FindControl("lblFriScOut"); Label lblSatScOut = (Label)e.Row.FindControl("lblSatScOut"); Label lblSunScOut = (Label)e.Row.FindControl("lblSunScOut"); HiddenField hdnSunLunch = (HiddenField)e.Row.FindControl("hdnSunLunch"); HiddenField hdnMonLunch = (HiddenField)e.Row.FindControl("hdnMonLunch"); HiddenField hdnTueLunch = (HiddenField)e.Row.FindControl("hdnTueLunch"); HiddenField hdnWedLunch = (HiddenField)e.Row.FindControl("hdnWedLunch"); HiddenField hdnThuLunch = (HiddenField)e.Row.FindControl("hdnThuLunch"); HiddenField hdnFriLunch = (HiddenField)e.Row.FindControl("hdnFriLunch"); HiddenField hdnSatLunch = (HiddenField)e.Row.FindControl("hdnSatLunch"); string lunchTip1 = CreateLunchTable(hdnSunLunch.Value.Trim()); lblSunScIn.Attributes.Add("class", "tooltip2"); lblSunScIn.Attributes.Add("title", lunchTip1); lblSunScOut.Attributes.Add("class", "tooltip2"); lblSunScOut.Attributes.Add("title", lunchTip1); lunchTip1 = CreateLunchTable(hdnMonLunch.Value.Trim()); lblMonScIn.Attributes.Add("class", "tooltip2"); lblMonScIn.Attributes.Add("title", lunchTip1); lblMonScOut.Attributes.Add("class", "tooltip2"); lblMonScOut.Attributes.Add("title", lunchTip1); lunchTip1 = CreateLunchTable(hdnTueLunch.Value.Trim()); lblTueScIn.Attributes.Add("class", "tooltip2"); lblTueScIn.Attributes.Add("title", lunchTip1); lblTueScOut.Attributes.Add("class", "tooltip2"); lblTueScOut.Attributes.Add("title", lunchTip1); lunchTip1 = CreateLunchTable(hdnWedLunch.Value.Trim()); lblWedScIn.Attributes.Add("class", "tooltip2"); lblWedScIn.Attributes.Add("title", lunchTip1); lblWedScOut.Attributes.Add("class", "tooltip2"); lblWedScOut.Attributes.Add("title", lunchTip1); lunchTip1 = CreateLunchTable(hdnSatLunch.Value.Trim()); lblSatScIn.Attributes.Add("class", "tooltip2"); lblSatScIn.Attributes.Add("title", lunchTip1); lblSatScOut.Attributes.Add("class", "tooltip2"); lblSatScOut.Attributes.Add("title", lunchTip1); lunchTip1 = CreateLunchTable(hdnThuLunch.Value.Trim()); lblThuScIn.Attributes.Add("class", "tooltip2"); lblThuScIn.Attributes.Add("title", lunchTip1); lblThuScOut.Attributes.Add("class", "tooltip2"); lblThuScOut.Attributes.Add("title", lunchTip1); lunchTip1 = CreateLunchTable(hdnFriLunch.Value.Trim()); lblFriScIn.Attributes.Add("class", "tooltip2"); lblFriScIn.Attributes.Add("title", lunchTip1); lblFriScOut.Attributes.Add("class", "tooltip2"); lblFriScOut.Attributes.Add("title", lunchTip1); Label lblID = (Label)e.Row.FindControl("lblID"); string empid = lblID.Text.Trim(); if ((Convert.ToDateTime(lblStartDate.Text).ToString("MM/dd/yyyy") != "01/01/1900" && Convert.ToDateTime(ViewState["MonDate"]) < Convert.ToDateTime(lblStartDate.Text))) { lblMonScIn.Text = ""; lblMonScOut.Text = ""; } if (Convert.ToDateTime(lblStartDate.Text).ToString("MM/dd/yyyy") != "01/01/1900" && Convert.ToDateTime(ViewState["TueDate"]) < Convert.ToDateTime(lblStartDate.Text)) { lblTueScIn.Text = ""; lblTueScOut.Text = ""; } if (Convert.ToDateTime(lblStartDate.Text).ToString("MM/dd/yyyy") != "01/01/1900" && Convert.ToDateTime(ViewState["WedDate"]) < Convert.ToDateTime(lblStartDate.Text)) { lblWedScIn.Text = ""; lblWedScOut.Text = ""; } if (Convert.ToDateTime(lblStartDate.Text).ToString("MM/dd/yyyy") != "01/01/1900" && Convert.ToDateTime(ViewState["ThuDate"]) < Convert.ToDateTime(lblStartDate.Text)) { lblThuScIn.Text = ""; lblThuScOut.Text = ""; } if (Convert.ToDateTime(lblStartDate.Text).ToString("MM/dd/yyyy") != "01/01/1900" && Convert.ToDateTime(ViewState["FriDate"]) < Convert.ToDateTime(lblStartDate.Text)) { lblFriScIn.Text = ""; lblFriScOut.Text = ""; } if (Convert.ToDateTime(lblStartDate.Text).ToString("MM/dd/yyyy") != "01/01/1900" && Convert.ToDateTime(ViewState["SatDate"]) < Convert.ToDateTime(lblStartDate.Text)) { lblSatScIn.Text = ""; lblSatScOut.Text = ""; } if (Convert.ToDateTime(lblStartDate.Text).ToString("MM/dd/yyyy") != "01/01/1900" && Convert.ToDateTime(ViewState["SunDate"]) < Convert.ToDateTime(lblStartDate.Text)) { lblSunScIn.Text = ""; lblSunScOut.Text = ""; } if ((Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") != "01/01/1900" && Convert.ToDateTime(ViewState["MonDate"]) > Convert.ToDateTime(lblTermDate.Text))) { lblMonScIn.Text = ""; lblMonScOut.Text = ""; } if (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") != "01/01/1900" && Convert.ToDateTime(ViewState["TueDate"]) > Convert.ToDateTime(lblTermDate.Text)) { lblTueScIn.Text = ""; lblTueScOut.Text = ""; } if (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") != "01/01/1900" && Convert.ToDateTime(ViewState["WedDate"]) > Convert.ToDateTime(lblTermDate.Text)) { lblWedScIn.Text = ""; lblWedScOut.Text = ""; } if (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") != "01/01/1900" && Convert.ToDateTime(ViewState["ThuDate"]) > Convert.ToDateTime(lblTermDate.Text)) { lblThuScIn.Text = ""; lblThuScOut.Text = ""; } if (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") != "01/01/1900" && Convert.ToDateTime(ViewState["FriDate"]) > Convert.ToDateTime(lblTermDate.Text)) { lblFriScIn.Text = ""; lblFriScOut.Text = ""; } if (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") != "01/01/1900" && Convert.ToDateTime(ViewState["SatDate"]) > Convert.ToDateTime(lblTermDate.Text)) { lblSatScIn.Text = ""; lblSatScOut.Text = ""; } if (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") != "01/01/1900" && Convert.ToDateTime(ViewState["SunDate"]) > Convert.ToDateTime(lblTermDate.Text)) { lblSunScIn.Text = ""; lblSunScOut.Text = ""; } LinkButton lblMonIn = (LinkButton)e.Row.FindControl("lblMonIn"); lblMonIn.Text = lblMonIn.Text == "" ? "" : Convert.ToDateTime(lblMonIn.Text).ToString("hh:mm tt"); lblMonIn.Attributes.Add("date", Convert.ToDateTime(ViewState["MonDate"]).ToString("MM/dd/yyyy")); if (lblMonIn.Text == "") { if ((Convert.ToDateTime(ViewState["MonDate"]) >= Convert.ToDateTime(lblStartDate.Text)) && (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") == "01/01/1900" || Convert.ToDateTime(ViewState["MonDate"]) <= Convert.ToDateTime(lblTermDate.Text))) { if ((Convert.ToDateTime(Convert.ToDateTime(Session["TodayBannerDate"]).ToString("MM/dd/yyyy"))) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["MonDate"])).ToString("MM/dd/yyyy")) && (Convert.ToDateTime((Convert.ToDateTime(ViewState["MonDate"])).ToString("MM/dd/yyyy")) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FreezeDate"])).ToString("MM/dd/yyyy")))) { lblMonIn.Text = "N/A"; } } } HiddenField hdnMonSignInFlag = (HiddenField)e.Row.FindControl("hdnMonSignInFlag"); if (hdnMonSignInFlag.Value == "True") { e.Row.Cells[3].BackColor = System.Drawing.Color.Moccasin; lblMonIn.CssClass.Replace("greenTag", ""); //lblMonIn.ForeColor = System.Drawing.Color.Moccasin ; } HiddenField hdnMonSigninNotes = (HiddenField)e.Row.FindControl("hdnMonSigninNotes"); HiddenField hdnMonMultiple = (HiddenField)e.Row.FindControl("hdnMonMultiple"); if (hdnMonMultiple.Value == "True") { lblMonIn.CssClass = "multipleLogin"; dt = obj.GetMultipleDetailsByEmpID(Convert.ToDateTime(ViewState["MonDate"]), empid); s = CreateMultipleTable(dt); sMonMultiple = CreateMultipleString(dt); dt = null; } sTable = CreateSignInTable(lblName.Text, (hdnMonSigninNotes.Value), s); s = ""; if (sTable != "") { lblMonIn.Attributes.Add("rel", "tooltip"); lblMonIn.Attributes.Add("title", sTable); e.Row.Cells[3].CssClass = "greenTag"; } lblMonIn.Attributes.Add("sMultiple", sMonMultiple); lblMonIn.Attributes.Add("date", Convert.ToDateTime(ViewState["MonDate"]).ToString("MM/dd/yyyy")); LinkButton lblMonOut = (LinkButton)e.Row.FindControl("lblMonOut"); lblMonIn.Text = lblMonIn.Text == "" ? "" : lblMonIn.Text + (lblMonOut.Text == "" ? "" : lblMonOut.Text == "N/A" ? " - N/A" : " - " + Convert.ToDateTime(lblMonOut.Text).ToString("hh:mm tt")); if (lblMonOut.Text == "") { if ((Convert.ToDateTime(ViewState["MonDate"]) >= Convert.ToDateTime(lblStartDate.Text)) && (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") == "01/01/1900" || Convert.ToDateTime(ViewState["MonDate"]) <= Convert.ToDateTime(lblTermDate.Text))) { if ((Convert.ToDateTime(Convert.ToDateTime(Session["TodayBannerDate"]).ToString("MM/dd/yyyy"))) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["MonDate"])).ToString("MM/dd/yyyy")) && (Convert.ToDateTime((Convert.ToDateTime(ViewState["MonDate"])).ToString("MM/dd/yyyy")) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FreezeDate"])).ToString("MM/dd/yyyy")))) { lblMonIn.Text = lblMonIn.Text == "" ? "" : lblMonIn.Text + " - N/A"; } } } HiddenField hdnMonFreeze = (HiddenField)e.Row.FindControl("hdnMonFreeze"); if (hdnMonFreeze.Value == "True") { lblMonIn.Enabled = false; lblMonIn.ForeColor = System.Drawing.Color.Black; lblMonOut.Enabled = false; lblMonOut.ForeColor = System.Drawing.Color.Black; } LinkButton lblTueIn = (LinkButton)e.Row.FindControl("lblTueIn"); lblTueIn.Text = lblTueIn.Text == "" ? "" : Convert.ToDateTime(lblTueIn.Text).ToString("hh:mm tt"); if (lblTueIn.Text == "") { if ((Convert.ToDateTime(ViewState["TueDate"]) >= Convert.ToDateTime(lblStartDate.Text)) && (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") == "01/01/1900" || Convert.ToDateTime(ViewState["TueDate"]) <= Convert.ToDateTime(lblTermDate.Text))) { if ((Convert.ToDateTime(Convert.ToDateTime(Session["TodayBannerDate"]).ToString("MM/dd/yyyy"))) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["TueDate"])).ToString("MM/dd/yyyy")) && (Convert.ToDateTime((Convert.ToDateTime(ViewState["TueDate"])).ToString("MM/dd/yyyy")) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FreezeDate"])).ToString("MM/dd/yyyy")))) { lblTueIn.Text = "N/A"; } } } HiddenField hdnTueSignInFlag = (HiddenField)e.Row.FindControl("hdnTueSignInFlag"); if (hdnTueSignInFlag.Value == "True") { e.Row.Cells[6].BackColor = System.Drawing.Color.Moccasin; //lblTueIn.ForeColor = System.Drawing.Color.Moccasin ; lblTueIn.CssClass.Replace("greenTag", ""); } HiddenField hdnTueSigninNotes = (HiddenField)e.Row.FindControl("hdnTueSigninNotes"); HiddenField hdnTueMultiple = (HiddenField)e.Row.FindControl("hdnTueMultiple"); if (hdnTueMultiple.Value == "True") { lblTueIn.CssClass = "multipleLogin"; // lblMonIn.CssClass = "multipleLogin"; dt = obj.GetMultipleDetailsByEmpID(Convert.ToDateTime(ViewState["TueDate"]), empid); s = CreateMultipleTable(dt); sTueMultiple = CreateMultipleString(dt); dt = null; } sTable = CreateSignInTable(lblName.Text, (hdnTueSigninNotes.Value), s); s = ""; if (sTable != "") { lblTueIn.Attributes.Add("rel", "tooltip"); lblTueIn.Attributes.Add("title", sTable); e.Row.Cells[6].CssClass = "greenTag"; } lblTueIn.Attributes.Add("sMultiple", sTueMultiple); lblTueIn.Attributes.Add("Date", Convert.ToDateTime(ViewState["TueDate"].ToString()).ToString("MM/dd/yyyy")); LinkButton lblTueOut = (LinkButton)e.Row.FindControl("lblTueOut"); lblTueIn.Text = lblTueIn.Text == "" ? "" : lblTueIn.Text + (lblTueOut.Text == "" ? "" : lblTueOut.Text == "N/A" ? " - N/A" : " - " + Convert.ToDateTime(lblTueOut.Text).ToString("hh:mm tt")); if (lblTueOut.Text == "") { if ((Convert.ToDateTime(ViewState["TueDate"]) >= Convert.ToDateTime(lblStartDate.Text)) && (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") == "01/01/1900" || Convert.ToDateTime(ViewState["TueDate"]) <= Convert.ToDateTime(lblTermDate.Text))) { if ((Convert.ToDateTime(Convert.ToDateTime(Session["TodayBannerDate"]).ToString("MM/dd/yyyy"))) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["TueDate"])).ToString("MM/dd/yyyy")) && (Convert.ToDateTime((Convert.ToDateTime(ViewState["TueDate"])).ToString("MM/dd/yyyy")) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FreezeDate"])).ToString("MM/dd/yyyy")))) { lblTueIn.Text = lblTueIn.Text == "" ? "" : lblTueIn.Text + " - N/A"; } } } HiddenField hdnTueFreeze = (HiddenField)e.Row.FindControl("hdnTueFreeze"); if (hdnTueFreeze.Value == "True") { lblTueIn.Enabled = false; lblTueIn.ForeColor = System.Drawing.Color.Black; lblTueOut.Enabled = false; lblTueOut.ForeColor = System.Drawing.Color.Black; } LinkButton lblWedIn = (LinkButton)e.Row.FindControl("lblWedIn"); lblWedIn.Text = lblWedIn.Text == "" ? "" : Convert.ToDateTime(lblWedIn.Text).ToString("hh:mm tt"); if (lblWedIn.Text == "") { if ((Convert.ToDateTime(ViewState["WedDate"]) >= Convert.ToDateTime(lblStartDate.Text)) && (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") == "01/01/1900" || Convert.ToDateTime(ViewState["WedDate"]) <= Convert.ToDateTime(lblTermDate.Text))) { if ((Convert.ToDateTime(Convert.ToDateTime(Session["TodayBannerDate"]).ToString("MM/dd/yyyy"))) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["WedDate"])).ToString("MM/dd/yyyy")) && (Convert.ToDateTime((Convert.ToDateTime(ViewState["WedDate"])).ToString("MM/dd/yyyy")) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FreezeDate"])).ToString("MM/dd/yyyy")))) { lblWedIn.Text = "N/A"; } } } HiddenField hdnWedSignInFlag = (HiddenField)e.Row.FindControl("hdnWedSignInFlag"); if (hdnWedSignInFlag.Value == "True") { e.Row.Cells[9].BackColor = System.Drawing.Color.Moccasin; lblWedIn.CssClass.Replace("greenTag", ""); // lblWedIn.ForeColor = System.Drawing.Color.Moccasin ; } HiddenField hdnWedSignInNotes = (HiddenField)e.Row.FindControl("hdnWedSignInNotes"); HiddenField hdnWedMultiple = (HiddenField)e.Row.FindControl("hdnWedMultiple"); if (hdnWedMultiple.Value == "True") { lblWedIn.CssClass = "multipleLogin"; // lblMonIn.CssClass = "multipleLogin"; dt = obj.GetMultipleDetailsByEmpID(Convert.ToDateTime(ViewState["WedDate"]), empid); s = CreateMultipleTable(dt); sWedMultiple = CreateMultipleString(dt); dt = null; } sTable = CreateSignInTable(lblName.Text, (hdnWedSignInNotes.Value), s); s = ""; if (sTable != "") { lblWedIn.Attributes.Add("rel", "tooltip"); lblWedIn.Attributes.Add("title", sTable); e.Row.Cells[9].CssClass = "greenTag"; } lblWedIn.Attributes.Add("sMultiple", sWedMultiple); lblWedIn.Attributes.Add("Date", Convert.ToDateTime(ViewState["WedDate"].ToString()).ToString("MM/dd/yyyy")); LinkButton lblWedOut = (LinkButton)e.Row.FindControl("lblWedOut"); lblWedIn.Text = lblWedIn.Text == "" ? "" : lblWedIn.Text + (lblWedOut.Text == "" ? "" : lblWedOut.Text == "N/A" ? " - N/A" : " - " + Convert.ToDateTime(lblWedOut.Text).ToString("hh:mm tt")); if (lblWedOut.Text == "") { if ((Convert.ToDateTime(ViewState["WedDate"]) >= Convert.ToDateTime(lblStartDate.Text)) && (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") == "01/01/1900" || Convert.ToDateTime(ViewState["WedDate"]) <= Convert.ToDateTime(lblTermDate.Text))) { if ((Convert.ToDateTime(Convert.ToDateTime(Session["TodayBannerDate"]).ToString("MM/dd/yyyy"))) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["WedDate"])).ToString("MM/dd/yyyy")) && (Convert.ToDateTime((Convert.ToDateTime(ViewState["WedDate"])).ToString("MM/dd/yyyy")) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FreezeDate"])).ToString("MM/dd/yyyy")))) { lblWedIn.Text = lblWedIn.Text == "" ? "" : lblWedIn.Text + " - N/A"; } } } HiddenField hdnWedFreeze = (HiddenField)e.Row.FindControl("hdnWedFreeze"); if (hdnWedFreeze.Value == "True") { lblWedIn.Enabled = false; lblWedIn.ForeColor = System.Drawing.Color.Black; lblWedOut.Enabled = false; lblWedOut.ForeColor = System.Drawing.Color.Black; } LinkButton lblThuIn = (LinkButton)e.Row.FindControl("lblThuIn"); lblThuIn.Text = lblThuIn.Text == "" ? "" : Convert.ToDateTime(lblThuIn.Text).ToString("hh:mm tt"); if (lblThuIn.Text == "") { if ((Convert.ToDateTime(ViewState["ThuDate"]) >= Convert.ToDateTime(lblStartDate.Text)) && (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") == "01/01/1900" || Convert.ToDateTime(ViewState["ThuDate"]) <= Convert.ToDateTime(lblTermDate.Text))) { if ((Convert.ToDateTime(Convert.ToDateTime(Session["TodayBannerDate"]).ToString("MM/dd/yyyy"))) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["ThuDate"])).ToString("MM/dd/yyyy")) && (Convert.ToDateTime((Convert.ToDateTime(ViewState["ThuDate"])).ToString("MM/dd/yyyy")) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FreezeDate"])).ToString("MM/dd/yyyy")))) { lblThuIn.Text = "N/A"; } } } HiddenField hdnThuSignInFlag = (HiddenField)e.Row.FindControl("hdnThuSignInFlag"); if (hdnThuSignInFlag.Value == "True") { e.Row.Cells[12].BackColor = System.Drawing.Color.Moccasin; lblThuIn.Attributes["class"] = ""; //lblThuIn.ForeColor = System.Drawing.Color.Moccasin ; } HiddenField hdnThuSignInNotes = (HiddenField)e.Row.FindControl("hdnThuSignInNotes"); HiddenField hdnThuMultiple = (HiddenField)e.Row.FindControl("hdnThuMultiple"); if (hdnThuMultiple.Value == "True") { lblThuIn.CssClass = "multipleLogin"; // lblMonIn.CssClass = "multipleLogin"; dt = obj.GetMultipleDetailsByEmpID(Convert.ToDateTime(ViewState["ThuDate"]), empid); s = CreateMultipleTable(dt); sThuMultiple = CreateMultipleString(dt); dt = null; } sTable = CreateSignInTable(lblName.Text, (hdnThuSignInNotes.Value), s); s = ""; if (sTable != "") { lblThuIn.Attributes.Add("rel", "tooltip"); lblThuIn.Attributes.Add("title", sTable); e.Row.Cells[12].CssClass = "greenTag"; } lblThuIn.Attributes.Add("sMultiple", sThuMultiple); lblThuIn.Attributes.Add("Date", Convert.ToDateTime(ViewState["ThuDate"].ToString()).ToString("MM/dd/yyyy")); LinkButton lblThuOut = (LinkButton)e.Row.FindControl("lblThuOut"); lblThuIn.Text = lblThuIn.Text == "" ? "" : lblThuIn.Text + (lblThuOut.Text == "" ? "" : lblThuOut.Text == "N/A" ? " - N/A" : " - " + Convert.ToDateTime(lblThuOut.Text).ToString("hh:mm tt")); if (lblThuOut.Text == "") { if ((Convert.ToDateTime(ViewState["ThuDate"]) >= Convert.ToDateTime(lblStartDate.Text)) && (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") == "01/01/1900" || Convert.ToDateTime(ViewState["ThuDate"]) <= Convert.ToDateTime(lblTermDate.Text))) { if ((Convert.ToDateTime(Convert.ToDateTime(Session["TodayBannerDate"]).ToString("MM/dd/yyyy"))) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["ThuDate"])).ToString("MM/dd/yyyy")) && (Convert.ToDateTime((Convert.ToDateTime(ViewState["ThuDate"])).ToString("MM/dd/yyyy")) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FreezeDate"])).ToString("MM/dd/yyyy")))) { lblThuIn.Text = lblThuIn.Text == "" ? "" : lblThuIn.Text + " - N/A"; } } } HiddenField hdnThuFreeze = (HiddenField)e.Row.FindControl("hdnThuFreeze"); if (hdnThuFreeze.Value == "True") { lblThuIn.Enabled = false; lblThuIn.ForeColor = System.Drawing.Color.Black; lblThuOut.Enabled = false; lblThuOut.ForeColor = System.Drawing.Color.Black; } LinkButton lblFriIn = (LinkButton)e.Row.FindControl("lblFriIn"); lblFriIn.Text = lblFriIn.Text == "" ? "" : Convert.ToDateTime(lblFriIn.Text).ToString("hh:mm"); if (lblFriIn.Text == "") { if ((Convert.ToDateTime(ViewState["FriDate"]) >= Convert.ToDateTime(lblStartDate.Text)) && (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") == "01/01/1900" || Convert.ToDateTime(ViewState["FriDate"]) <= Convert.ToDateTime(lblTermDate.Text))) { if ((Convert.ToDateTime(Convert.ToDateTime(Session["TodayBannerDate"]).ToString("MM/dd/yyyy"))) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FriDate"])).ToString("MM/dd/yyyy")) && (Convert.ToDateTime((Convert.ToDateTime(ViewState["FriDate"])).ToString("MM/dd/yyyy")) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FreezeDate"])).ToString("MM/dd/yyyy")))) { lblFriIn.Text = "N/A"; } } } HiddenField hdnFriSignInFlag = (HiddenField)e.Row.FindControl("hdnFriSignInFlag"); if (hdnFriSignInFlag.Value == "True") { e.Row.Cells[15].BackColor = System.Drawing.Color.Moccasin; lblFriIn.CssClass.Replace("greenTag", ""); } HiddenField hdnFriSignInNotes = (HiddenField)e.Row.FindControl("hdnFriSignInNotes"); HiddenField hdnFriMultiple = (HiddenField)e.Row.FindControl("hdnFriMultiple"); if (hdnFriMultiple.Value == "True") { lblFriIn.CssClass = "multipleLogin"; // lblMonIn.CssClass = "multipleLogin"; dt = obj.GetMultipleDetailsByEmpID(Convert.ToDateTime(ViewState["FriDate"]), empid); s = CreateMultipleTable(dt); sFriMultiple = CreateMultipleString(dt); dt = null; } sTable = CreateSignInTable(lblName.Text, (hdnFriSignInNotes.Value), s); s = ""; if (sTable != "") { lblFriIn.Attributes.Add("rel", "tooltip"); lblFriIn.Attributes.Add("title", sTable); e.Row.Cells[15].CssClass = "greenTag"; } lblFriIn.Attributes.Add("sMultiple", sFriMultiple); lblFriIn.Attributes.Add("Date", Convert.ToDateTime(ViewState["FriDate"].ToString()).ToString("MM/dd/yyyy")); LinkButton lblFriOut = (LinkButton)e.Row.FindControl("lblFriOut"); lblFriIn.Text = lblFriIn.Text == "" ? "" : lblFriIn.Text + (lblFriOut.Text == "" ? "" : lblFriOut.Text == "N/A" ? " - N/A" : " - " + Convert.ToDateTime(lblFriOut.Text).ToString("hh:mm tt")); if (lblFriOut.Text == "") { if ((Convert.ToDateTime(ViewState["FriDate"]) >= Convert.ToDateTime(lblStartDate.Text)) && (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") == "01/01/1900" || Convert.ToDateTime(ViewState["FriDate"]) <= Convert.ToDateTime(lblTermDate.Text))) { if ((Convert.ToDateTime(Convert.ToDateTime(Session["TodayBannerDate"]).ToString("MM/dd/yyyy"))) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FriDate"])).ToString("MM/dd/yyyy")) && (Convert.ToDateTime((Convert.ToDateTime(ViewState["FriDate"])).ToString("MM/dd/yyyy")) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FreezeDate"])).ToString("MM/dd/yyyy")))) { lblFriIn.Text = lblFriIn.Text == "" ? "" : lblFriIn.Text + " - N/A"; } } } HiddenField hdnFriFreeze = (HiddenField)e.Row.FindControl("hdnFriFreeze"); if (hdnFriFreeze.Value == "True") { lblFriIn.Enabled = false; lblFriIn.ForeColor = System.Drawing.Color.Black; lblFriOut.Enabled = false; lblFriOut.ForeColor = System.Drawing.Color.Black; } LinkButton lblSatIn = (LinkButton)e.Row.FindControl("lblSatIn"); lblSatIn.Text = lblSatIn.Text == "" ? "" : Convert.ToDateTime(lblSatIn.Text).ToString("hh:mm tt"); HiddenField hdnSatSignInFlag = (HiddenField)e.Row.FindControl("hdnSatSignInFlag"); if (lblSatIn.Text == "") { if ((Convert.ToDateTime(ViewState["SatDate"]) >= Convert.ToDateTime(lblStartDate.Text)) && (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") == "01/01/1900" || Convert.ToDateTime(ViewState["SatDate"]) <= Convert.ToDateTime(lblTermDate.Text))) { if ((Convert.ToDateTime(Convert.ToDateTime(Session["TodayBannerDate"]).ToString("MM/dd/yyyy"))) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["SatDate"])).ToString("MM/dd/yyyy")) && (Convert.ToDateTime((Convert.ToDateTime(ViewState["SatDate"])).ToString("MM/dd/yyyy")) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FreezeDate"])).ToString("MM/dd/yyyy")))) { lblSatIn.Text = "N/A"; } } } if (hdnSatSignInFlag.Value == "True") { e.Row.Cells[18].BackColor = System.Drawing.Color.Moccasin; lblSatIn.CssClass.Replace("greenTag", ""); } HiddenField hdnSatSignInNotes = (HiddenField)e.Row.FindControl("hdnSatSignInNotes"); //lblSatIn.ForeColor = System.Drawing.Color.Moccasin ; HiddenField hdnSatMultiple = (HiddenField)e.Row.FindControl("hdnSatMultiple"); if (hdnSatMultiple.Value == "True") { lblSatIn.CssClass = "multipleLogin"; dt = obj.GetMultipleDetailsByEmpID(Convert.ToDateTime(ViewState["SatDate"]), empid); s = CreateMultipleTable(dt); sSatMultiple = CreateMultipleString(dt); dt = null; } sTable = CreateSignInTable(lblName.Text, (hdnSatSignInNotes.Value), s); s = ""; if (sTable != "") { lblSatIn.Attributes.Add("rel", "tooltip"); lblSatIn.Attributes.Add("title", sTable); e.Row.Cells[18].CssClass = "greenTag"; } lblSatIn.Attributes.Add("sMultiple", sSatMultiple); lblSatIn.Attributes.Add("Date", Convert.ToDateTime(ViewState["SatDate"].ToString()).ToString("MM/dd/yyyy")); LinkButton lblSatOut = (LinkButton)e.Row.FindControl("lblSatOut"); lblSatIn.Text = lblSatIn.Text == "" ? "" : lblSatIn.Text + (lblSatOut.Text == "" ? "" : lblSatOut.Text == "N/A" ? " - N/A" : " - " + Convert.ToDateTime(lblSatOut.Text).ToString("hh:mm tt")); if (lblSatOut.Text == "") { if ((Convert.ToDateTime(ViewState["SatDate"]) >= Convert.ToDateTime(lblStartDate.Text)) && (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") == "01/01/1900" || Convert.ToDateTime(ViewState["SatDate"]) <= Convert.ToDateTime(lblTermDate.Text))) { if ((Convert.ToDateTime(Convert.ToDateTime(Session["TodayBannerDate"]).ToString("MM/dd/yyyy"))) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["SatDate"])).ToString("MM/dd/yyyy")) && (Convert.ToDateTime((Convert.ToDateTime(ViewState["SatDate"])).ToString("MM/dd/yyyy")) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FreezeDate"])).ToString("MM/dd/yyyy")))) { lblSatIn.Text = lblSatIn.Text == "" ? "" : lblSatIn.Text + " - N/A"; } } } HiddenField hdnSatFreeze = (HiddenField)e.Row.FindControl("hdnSatFreeze"); if (hdnSatFreeze.Value == "True") { lblSatIn.Enabled = false; lblSatIn.ForeColor = System.Drawing.Color.Black; lblSatOut.Enabled = false; lblSatOut.ForeColor = System.Drawing.Color.Black; } LinkButton lblSunIn = (LinkButton)e.Row.FindControl("lblSunIn"); lblSunIn.Text = lblSunIn.Text == "" ? "" : Convert.ToDateTime(lblSunIn.Text).ToString("hh:mm tt"); if (lblSunIn.Text == "") { if ((Convert.ToDateTime(ViewState["SunDate"]) >= Convert.ToDateTime(lblStartDate.Text)) && (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") == "01/01/1900" || Convert.ToDateTime(ViewState["SunDate"]) <= Convert.ToDateTime(lblTermDate.Text))) { if ((Convert.ToDateTime(Convert.ToDateTime(Session["TodayBannerDate"]).ToString("MM/dd/yyyy"))) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["SunDate"])).ToString("MM/dd/yyyy")) && (Convert.ToDateTime((Convert.ToDateTime(ViewState["SunDate"])).ToString("MM/dd/yyyy")) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FreezeDate"])).ToString("MM/dd/yyyy")))) { lblSunIn.Text = "N/A"; } } } HiddenField hdnSunSignInFlag = (HiddenField)e.Row.FindControl("hdnSunSignInFlag"); HiddenField hdnSunSignInNotes = (HiddenField)e.Row.FindControl("hdnSunSignInNotes"); if (hdnSunSignInNotes.Value.Trim() == "True") { e.Row.Cells[21].BackColor = System.Drawing.Color.Moccasin; lblSunIn.Attributes["class"] = ""; // lblSunIn.ForeColor = System.Drawing.Color.Moccasin ; } HiddenField hdnSunMultiple = (HiddenField)e.Row.FindControl("hdnSunMultiple"); if (hdnSunMultiple.Value == "True") { lblSunIn.CssClass = "multipleLogin"; // lblMonIn.CssClass = "multipleLogin"; dt = obj.GetMultipleDetailsByEmpID(Convert.ToDateTime(ViewState["SunDate"]), empid); s = CreateMultipleTable(dt); sSunMultiple = CreateMultipleString(dt); dt = null; } sTable = CreateSignInTable(lblName.Text, (hdnSunSignInNotes.Value), s); s = ""; if (sTable != "") { lblSunIn.Attributes.Add("rel", "tooltip"); lblSunIn.Attributes.Add("title", sTable); e.Row.Cells[21].CssClass = "greenTag"; } lblSunIn.Attributes.Add("sMultiple", sSunMultiple); lblSunIn.Attributes.Add("Date", Convert.ToDateTime(ViewState["SunDate"].ToString()).ToString("MM/dd/yyyy")); LinkButton lblSunOut = (LinkButton)e.Row.FindControl("lblSunOut"); lblSunIn.Text = lblSunIn.Text == "" ? "" : lblSunIn.Text + (lblSunOut.Text == "" ? "" : lblSunOut.Text == "N/A" ? " - N/A" : " - " + Convert.ToDateTime(lblSunOut.Text).ToString("hh:mm tt")); if (lblSunOut.Text == "") { if ((Convert.ToDateTime(ViewState["SunDate"]) >= Convert.ToDateTime(lblStartDate.Text)) && (Convert.ToDateTime(lblTermDate.Text).ToString("MM/dd/yyyy") == "01/01/1900" || Convert.ToDateTime(ViewState["SunDate"]) <= Convert.ToDateTime(lblTermDate.Text))) { if ((Convert.ToDateTime(Convert.ToDateTime(Session["TodayBannerDate"]).ToString("MM/dd/yyyy"))) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["SunDate"])).ToString("MM/dd/yyyy")) && (Convert.ToDateTime((Convert.ToDateTime(ViewState["SunDate"])).ToString("MM/dd/yyyy")) >= Convert.ToDateTime((Convert.ToDateTime(ViewState["FreezeDate"])).ToString("MM/dd/yyyy")))) { lblSunIn.Text = lblSunIn.Text == "" ? "" : lblSunIn.Text + " - N/A"; } } } HiddenField hdnSunFreeze = (HiddenField)e.Row.FindControl("hdnSunFreeze"); if (hdnSunFreeze.Value == "True") { lblSunIn.Enabled = false; lblSunIn.ForeColor = System.Drawing.Color.Black; lblSunOut.Enabled = false; lblSunOut.ForeColor = System.Drawing.Color.Black; } Label lblMonHours = (Label)e.Row.FindControl("lblMonHours"); lblMonHours.Text = lblMonHours.Text == "N/A" ? "" : lblMonHours.Text == "" ? "" : GeneralFunction.CalDoubleToTime((Convert.ToDouble(lblMonHours.Text))); Label lblTueHours = (Label)e.Row.FindControl("lblTueHours"); lblTueHours.Text = lblTueHours.Text == "N/A" ? "" : lblTueHours.Text == "" ? "" : GeneralFunction.CalDoubleToTime((Convert.ToDouble(lblTueHours.Text))); Label lblWedHours = (Label)e.Row.FindControl("lblWedHours"); lblWedHours.Text = lblWedHours.Text == "N/A" ? "" : lblWedHours.Text == "" ? "" : GeneralFunction.CalDoubleToTime((Convert.ToDouble(lblWedHours.Text))); Label lblThuHours = (Label)e.Row.FindControl("lblThuHours"); lblThuHours.Text = lblThuHours.Text == "N/A" ? "" : lblThuHours.Text == "" ? "" : GeneralFunction.CalDoubleToTime((Convert.ToDouble(lblThuHours.Text))); Label lblFriHours = (Label)e.Row.FindControl("lblFriHours"); lblFriHours.Text = lblFriHours.Text == "N/A" ? "" : lblFriHours.Text == "" ? "" : GeneralFunction.CalDoubleToTime((Convert.ToDouble(lblFriHours.Text))); Label lblSatHours = (Label)e.Row.FindControl("lblSatHours"); lblSatHours.Text = lblSatHours.Text == "N/A" ? "" : lblSatHours.Text == "" ? "" : GeneralFunction.CalDoubleToTime((Convert.ToDouble(lblSatHours.Text))); Label lblSunHours = (Label)e.Row.FindControl("lblSunHours"); lblSunHours.Text = lblSunHours.Text == "N/A" ? "" : lblSunHours.Text == "" ? "" : GeneralFunction.CalDoubleToTime((Convert.ToDouble(lblSunHours.Text))); Label lblTotalHours = (Label)e.Row.FindControl("lblTotalHours"); lblTotalHours.Text = lblTotalHours.Text == "0" ? "" : GeneralFunction.CalDoubleToTime(Convert.ToDouble(lblTotalHours.Text)); } } catch (Exception ex) { } }
protected void btnUpdate_Click(object sender, EventArgs e) { Attendance.Entities.UserInfo objInfo = new UserInfo(); string timezone = ""; try { 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; hdnToday.Value = ISTTime.ToString("MM/dd/yyyy"); btnUpdate.Attributes.Add("Enabled", "False"); int UserID = Convert.ToInt32(Session["UserID"]); int EmployeeID = Convert.ToInt32(hdnUserID.Value); objInfo.Firstname = txtEditFirstname.Text == "" ? "" : GeneralFunction.ToProper(txtEditFirstname.Text.Trim()); objInfo.Lastname = txtEditLastname.Text == "" ? "" : GeneralFunction.ToProper(txtEditLastname.Text.Trim()); objInfo.BLastname = txtEditBLname.Text == "" ? txtEditFirstname.Text.Trim() : GeneralFunction.ToProper(txtEditBLname.Text.Trim()); objInfo.BFirstname = txtEditBFname.Text == "" ? txtEditLastname.Text.Trim() : GeneralFunction.ToProper(txtEditBFname.Text.Trim()); string PhotoLink = imgPhoto.ImageUrl.Replace("~/Photos/", "").Trim(); try { if (photoUpload1.HasFile) { string filePhotoName = photoUpload1.FileName; string Photoextension = System.IO.Path.GetExtension(filePhotoName); if (Photoextension == ".jpg" || Photoextension == ".png" || Photoextension == ".jpeg" || Photoextension == ".JPG" || Photoextension == ".PNG" || Photoextension == ".JPEG") { string SaveFileLoc = Server.MapPath("~/Photos/"); if (System.IO.Directory.Exists(SaveFileLoc) == false) { System.IO.Directory.CreateDirectory(SaveFileLoc); } string FileNameSaveData = SaveFileLoc + (objInfo.Firstname.Trim() + objInfo.Lastname.Trim()).Trim() + ".jpeg"; PhotoLink = (objInfo.Firstname.Trim() + objInfo.Lastname.Trim()).Trim() + ".jpeg"; photoUpload1.SaveAs(FileNameSaveData); Bitmap oBitmap = default(Bitmap); oBitmap = new Bitmap(FileNameSaveData); Graphics oGraphic = default(Graphics); int newwidthimg = 140; // Here create a new bitmap object of the same height and width of the image. // float AspectRatio = (float)oBitmap.Size.Width / (float)oBitmap.Size.Height; int newHeight = 140; Bitmap bmpNew = new Bitmap(newwidthimg, newHeight); oGraphic = Graphics.FromImage(bmpNew); oGraphic.CompositingQuality = CompositingQuality.HighQuality; oGraphic.SmoothingMode = SmoothingMode.HighQuality; oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic; oGraphic.DrawImage(oBitmap, new Rectangle(0, 0, bmpNew.Width, bmpNew.Height), 0, 0, oBitmap.Width, oBitmap.Height, GraphicsUnit.Pixel); // Release the lock on the image file. Of course, // image from the image file is existing in Graphics object oBitmap.Dispose(); oBitmap = bmpNew; //SolidBrush oBrush = new SolidBrush(Color.Black); //Font ofont = new Font("Arial", 8); //oGraphic.DrawString("Some text to write", ofont, oBrush, 10, 10); //oGraphic.Dispose(); //ofont.Dispose(); //oBrush.Dispose(); oBitmap.Save(FileNameSaveData, ImageFormat.Jpeg); oBitmap.Dispose(); } } } catch (Exception ex) { System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "alert('File access denied');", true); } //objInfo.Lastname = GeneralFunction.ToProper(txtEditLastname.Text.Trim()); objInfo.ScheduleID = Convert.ToInt32(ddlSchedule.SelectedItem.Value); objInfo.EmpTypeID = Convert.ToInt32(ddlEmpType.SelectedItem.Value); objInfo.Deptname = ddlEditDepart.SelectedItem.Text.ToString(); objInfo.Designation = GeneralFunction.ToProper(txtEditDesg.Text.Trim()); objInfo.StartDt = txtEditStartDate.Text == "" ? Convert.ToDateTime("01/01/1900") : Convert.ToDateTime(txtEditStartDate.Text); objInfo.TermDt = txtEditTermDate.Text == "" ? Convert.ToDateTime("01/01/1900") : Convert.ToDateTime(txtEditTermDate.Text); objInfo.TermReason = txtEdit1TermReason.Text.Trim(); if (rdEditActiveFalse.Checked == true) { objInfo.IsActive = false; } else { objInfo.IsActive = true; objInfo.TermDt = Convert.ToDateTime("01/01/1900"); objInfo.TermReason = ""; } Attendance.BAL.Report obj = new Report(); String strHostName = Request.UserHostAddress.ToString(); string strIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString(); bool bnew = obj.UpdateUser(objInfo, EmployeeID, UserID, PhotoLink, strIp); if (bnew) { btnUpdate.Enabled = true; btnEditCancel.Enabled = true; mdlEditPopup.Hide(); txtEdit1TermReason.Text = ""; txtEditTermDate.Text = ""; txtEditDesg.Text = ""; txtEditEmpID.Text = ""; txtEditFirstname.Text = ""; txtEditLastname.Text = ""; txtEditStartDate.Text = ""; ddlEditDepart.SelectedIndex = 0; ddlEmpType.SelectedIndex = 0; ddlSchedule.SelectedIndex = 0; GetEmpDet(EmployeeID); } } catch (Exception ex) { } }
protected void btnAdd_Click(object sender, EventArgs e) { Attendance.Entities.UserInfo objInfo = new UserInfo(); Attendance.Entities.EmergencyContactInfo objContactInfo = new EmergencyContactInfo(); try { Attendance.BAL.Report obj = new Report(); objInfo.Firstname = txtAddFirstName.Text == "" ? "" : GeneralFunction.ToProper(txtAddFirstName.Text.Trim()).Trim(); objInfo.Lastname = txtAddLastName.Text == "" ? "" : GeneralFunction.ToProper(txtAddLastName.Text.Trim()).Trim(); string PhotoLink = "defaultUSer.jpg"; try { if (photoUpload.HasFile) { string filePhotoName = photoUpload.FileName; string Photoextension = System.IO.Path.GetExtension(filePhotoName); if (Photoextension == ".jpg" || Photoextension == ".png" || Photoextension == ".jpeg" || Photoextension == ".JPG" || Photoextension == ".PNG" || Photoextension == ".JPEG") { string SaveFileLoc = Server.MapPath("~/Photos/"); if (System.IO.Directory.Exists(SaveFileLoc) == false) { System.IO.Directory.CreateDirectory(SaveFileLoc); } string FileNameSaveData = SaveFileLoc + (objInfo.Firstname.Trim() + objInfo.Lastname.Trim()).Trim() + ".jpeg"; PhotoLink = (objInfo.Firstname.Trim() + objInfo.Lastname.Trim()).Trim() + ".jpeg"; photoUpload.SaveAs(FileNameSaveData); Bitmap oBitmap = default(Bitmap); oBitmap = new Bitmap(FileNameSaveData); Graphics oGraphic = default(Graphics); int newwidthimg = 140; // Here create a new bitmap object of the same height and width of the image. //float AspectRatio = (float)oBitmap.Size.Width / (float)oBitmap.Size.Height; //int newHeight = Convert.ToInt32(newwidthimg / AspectRatio); int newHeight = 140; Bitmap bmpNew = new Bitmap(newwidthimg, newHeight); oGraphic = Graphics.FromImage(bmpNew); oGraphic.CompositingQuality = CompositingQuality.HighQuality; oGraphic.SmoothingMode = SmoothingMode.HighQuality; oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic; oGraphic.DrawImage(oBitmap, new Rectangle(0, 0, bmpNew.Width, bmpNew.Height), 0, 0, oBitmap.Width, oBitmap.Height, GraphicsUnit.Pixel); // Release the lock on the image file. Of course, // image from the image file is existing in Graphics object oBitmap.Dispose(); oBitmap = bmpNew; //SolidBrush oBrush = new SolidBrush(Color.Black); //Font ofont = new Font("Arial", 8); //oGraphic.DrawString("Some text to write", ofont, oBrush, 10, 10); //oGraphic.Dispose(); //ofont.Dispose(); //oBrush.Dispose(); oBitmap.Save(FileNameSaveData, ImageFormat.Jpeg); oBitmap.Dispose(); } } } catch (Exception ex) { System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "alert('File access denied');", true); } int UserID = Convert.ToInt32(Session["UserID"]); //objInfo.EmpID = txtAddEmpID.Text.Trim(); objInfo.Deptname = ddlDeptment.SelectedItem.Text.ToString(); objInfo.Designation = txtDesignation.Text == "" ? "" : GeneralFunction.ToProper(txtDesignation.Text.Trim()); objInfo.ScheduleID = Convert.ToInt32(ddlSchedule.SelectedItem.Value); objInfo.StartDt = txtStartDt.Text == "" ? Convert.ToDateTime("01/01/1900") : Convert.ToDateTime(txtStartDt.Text); if (rdActiveFalse.Checked == true) { objInfo.IsActive = false; } else { objInfo.IsActive = true; } if (rdGenderMale.Checked == true) { objInfo.Gender = "Male"; } else { objInfo.Gender = "Female"; } if (rdMarriedSingle.Checked == true) { objInfo.MaritalID = 1; } else { objInfo.MaritalID = 2; } objInfo.DateOfBirth = txtDateOfBirth.Text.ToString() == "" ? Convert.ToDateTime("01/01/1900") : Convert.ToDateTime(txtDateOfBirth.Text); objInfo.Phone = txtEmpPhone.Text; objInfo.Mobile = txtEmpMobile.Text; objInfo.BusinessEmail = txtBusinessEmail.Text; objInfo.PersonalEmail = txtPersonalEmail.Text; objInfo.WageID = Convert.ToInt32(ddlWagetype.SelectedItem.Value); objInfo.Salary = txtsalary.Text.Trim(); objInfo.Deductions = Convert.ToInt32(ddlDeductions.SelectedItem.Value); objInfo.County = txtCounty.Text.Trim(); objContactInfo.Person1 = txtCn1Name.Text.ToString() == "" ? "" : GeneralFunction.ToProper(txtCn1Name.Text.ToString().Trim()); objContactInfo.P1Address1 = GeneralFunction.ToProperNotes(txtCn1Address1.Text.ToString().Trim()); objContactInfo.P1Address2 = GeneralFunction.ToProperNotes(txtCn1Address2.Text.ToString().Trim()); objContactInfo.Phone1 = txtCn1Phone.Text.ToString().Trim(); objContactInfo.Relation1 = GeneralFunction.ToProperNotes(txtCn1Relation.Text.ToString().Trim()); objContactInfo.Email1 = txtCn1Email.Text.ToString().Trim(); objContactInfo.StateID1 = Convert.ToInt32(ddlCn1State.SelectedItem.Value); // objContactInfo.Zip1 = txtCn1Zip.Text.Trim(); if (txtCn1Zip.Text != "" && txtCn1Zip.Text.Trim().Length == 4) { objContactInfo.Zip1 = "0" + txtCn1Zip.Text.Trim(); } else { objContactInfo.Zip1 = txtCn1Zip.Text.Trim(); } objContactInfo.Person2 = txtCn2Name.Text.ToString() == "" ? "" : GeneralFunction.ToProper(txtCn2Name.Text.ToString().Trim()); objContactInfo.P2Address1 = GeneralFunction.ToProperNotes((txtCn2Address1.Text.ToString().Trim())); objContactInfo.P2Address2 = GeneralFunction.ToProperNotes(txtCn2Address2.Text.ToString().Trim()); objContactInfo.Phone2 = txtCn2Phone.Text.ToString().Trim(); objContactInfo.Relation2 = GeneralFunction.ToProperNotes(txtCn2Relation.Text.ToString().Trim()); objContactInfo.Email2 = txtCn2Email.Text.ToString().Trim(); objContactInfo.StateID2 = Convert.ToInt32(ddlCn2State.SelectedItem.Value); if (txtCn2Zip.Text != "" && txtCn2Zip.Text.Trim().Length == 4) { objContactInfo.Zip2 = "0" + txtCn2Zip.Text.Trim(); } else { objContactInfo.Zip2 = txtCn2Zip.Text.Trim(); } objContactInfo.Person3 = txtCn3Name.Text.ToString() == "" ? "" : GeneralFunction.ToProper(txtCn3Name.Text.ToString().Trim()); objContactInfo.P3Address1 = GeneralFunction.ToProperNotes(txtCn3Address1.Text.ToString().Trim()); objContactInfo.P3Address2 = GeneralFunction.ToProperNotes(txtCn3Address2.Text.ToString().Trim()); objContactInfo.Phone3 = txtCn3Phone.Text.ToString().Trim(); objContactInfo.Relation3 = GeneralFunction.ToProperNotes(txtCn3Relation.Text.ToString().Trim()); objContactInfo.Email3 = txtCn3Email.Text.ToString().Trim(); objContactInfo.StateID3 = Convert.ToInt32(ddlCn3State.SelectedItem.Value); if (txtCn3Zip.Text != "" && txtCn3Zip.Text.Trim().Length == 4) { objContactInfo.Zip3 = "0" + txtCn3Zip.Text.Trim(); } else { objContactInfo.Zip3 = txtCn3Zip.Text.Trim(); } string LocationName = ddlLocation.SelectedItem.Text.ToString().Trim(); if (LocationName.Trim().ToUpper() == "INBH" || LocationName.Trim().ToUpper() == "INDG") { objInfo.SSN = ""; } else { objInfo.SSN = txtEmpSSN.Text.Trim(); } objInfo.Address1 = GeneralFunction.ToProperNotes(txtEmpAddress1.Text.ToString().Trim()); objInfo.Address2 = GeneralFunction.ToProperNotes(txtEmpAddress2.Text.ToString().Trim()); objInfo.StateID = Convert.ToInt32(ddlEmpState.SelectedItem.Value); if (txtEmpZip.Text != "" && txtEmpZip.Text.Trim().Length == 4) { objInfo.Zip = "0" + txtEmpZip.Text.Trim(); } else { objInfo.Zip = txtEmpZip.Text.Trim(); } objInfo.DriverLicense = txtEmpDriveLicense.Text.Trim(); objInfo.EmpTypeID = Convert.ToInt32(ddlEmpType.SelectedItem.Value); if (objInfo.SSN != "") { if (obj.CheckUniqueSSN(objInfo.SSN.Trim())) { bool bnew = obj.AddUser(objInfo, objContactInfo, UserID, LocationName, PhotoLink); if (bnew) { txtAddFirstName.Text = ""; txtAddLastName.Text = ""; txtBusinessEmail.Text = ""; txtDateOfBirth.Text = ""; txtDesignation.Text = ""; txtEmpAddress1.Text = ""; txtEmpAddress2.Text = ""; txtEmpDriveLicense.Text = ""; txtEmpMobile.Text = ""; txtEmpPhone.Text = ""; txtEmpSSN.Text = ""; txtEmpZip.Text = ""; txtCn1Address1.Text = ""; txtCn1Address2.Text = ""; txtCn1Email.Text = ""; txtCn1Name.Text = ""; txtCn1Phone.Text = ""; txtCn1Relation.Text = ""; txtCn2Address1.Text = ""; txtCn2Address2.Text = ""; txtCn2Email.Text = ""; txtCn2Name.Text = ""; txtCn2Phone.Text = ""; txtCn2Relation.Text = ""; txtCn3Address1.Text = ""; txtCn3Address2.Text = ""; txtCn3Email.Text = ""; txtCn3Name.Text = ""; txtCn3Phone.Text = ""; txtCn3Relation.Text = ""; ddlDeptment.SelectedIndex = 0; ddlEmpState.SelectedIndex = 0; ddlEmpType.SelectedIndex = 0; ddlSchedule.SelectedIndex = 0; mdlAddPopUp.Hide(); GetUserDetails(Convert.ToInt32(Session["SortBy"]),ddlLocation.SelectedItem.Text.ToString().Trim()); } } else { lblError.Visible = true; lblError.Text = "Employee details are not added. SSN is already existed"; txtEmpSSN.Text = ""; txtEmpSSN.Focus(); mdlAddPopUp.Show(); } } else { bool bnew = obj.AddUser(objInfo, objContactInfo, UserID, LocationName, PhotoLink); if (bnew) { txtAddFirstName.Text = ""; txtAddLastName.Text = ""; txtBusinessEmail.Text = ""; txtDateOfBirth.Text = ""; txtDesignation.Text = ""; txtEmpAddress1.Text = ""; txtEmpAddress2.Text = ""; txtEmpDriveLicense.Text = ""; txtEmpMobile.Text = ""; txtEmpPhone.Text = ""; txtEmpSSN.Text = ""; txtEmpZip.Text = ""; txtCn1Address1.Text = ""; txtCn1Address2.Text = ""; txtCn1Email.Text = ""; txtCn1Name.Text = ""; txtCn1Phone.Text = ""; txtCn1Relation.Text = ""; txtCn2Address1.Text = ""; txtCn2Address2.Text = ""; txtCn2Email.Text = ""; txtCn2Name.Text = ""; txtCn2Phone.Text = ""; txtCn2Relation.Text = ""; txtCn3Address1.Text = ""; txtCn3Address2.Text = ""; txtCn3Email.Text = ""; txtCn3Name.Text = ""; txtCn3Phone.Text = ""; txtCn3Relation.Text = ""; ddlDeptment.SelectedIndex = 0; ddlEmpState.SelectedIndex = 0; ddlEmpType.SelectedIndex = 0; ddlSchedule.SelectedIndex = 0; mdlAddPopUp.Hide(); GetUserDetails(Convert.ToInt32(Session["SortBy"]),ddlLocation.SelectedItem.Text.ToString()); } } } catch (Exception ex) { //System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "alert('"+ex.ToString()+"');", true); } }
protected void btnSalEdit_Click(object sender, EventArgs e) { try { Attendance.Entities.UserInfo objInfo = new UserInfo(); objInfo.WageID = Convert.ToInt32(ddlEditWage.SelectedIndex); objInfo.Deductions = Convert.ToInt32(ddlDeductions.SelectedIndex); objInfo.Salary = txtEditSal.Text.Trim(); if (rdSingle.Checked) { objInfo.MaritalID = 1; } else { objInfo.MaritalID = 2; } int UserID = Convert.ToInt32(Session["UserID"]); int EmployeeID = Convert.ToInt32(hdnUserID.Value); String strHostName = Request.UserHostAddress.ToString(); string strIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString(); Attendance.BAL.Report obj = new Report(); bool bnew = obj.UpdateUserSalTaxDetails(objInfo, EmployeeID, UserID, strIp); ddlDeductions.SelectedIndex = 0; txtEditSal.Text = ""; ddlEditWage.SelectedIndex = 0; rdSingle.Checked = true; //Page.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true); GetEmpDet(EmployeeID); mdlEditSalTaxPopup.Hide(); } catch (Exception ex) { } }
private void GetEmployeeTypes() { try { Attendance.BAL.Report obj = new Report(); DataTable dt = obj.GetAllEmployeetypes(); ddlEmpType.DataSource = dt; ddlEmpType.DataTextField = "EmpType"; ddlEmpType.DataValueField = "EmpTypeID"; ddlEmpType.DataBind(); } catch (Exception ex) { } }
protected void btnUpdateEmergency_Click(object sender, EventArgs e) { try { Attendance.Entities.EmergencyContactInfo objContactInfo = new EmergencyContactInfo(); int UserID = Convert.ToInt32(Session["UserID"]); int EmployeeID = Convert.ToInt32(hdnUserID.Value); String strHostName = Request.UserHostAddress.ToString(); string strIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString(); objContactInfo.Person1 = txtCn1Name.Text.ToString() == "" ? "" : GeneralFunction.ToProper(txtCn1Name.Text.ToString().Trim()); objContactInfo.P1Address1 = GeneralFunction.ToProperNotes(txtCn1Address1.Text.ToString().Trim()); objContactInfo.P1Address2 = GeneralFunction.ToProperNotes(txtCn1Address2.Text.ToString().Trim()); objContactInfo.Phone1 = txtCn1Phone.Text.ToString().Trim(); objContactInfo.Relation1 = GeneralFunction.ToProperNotes(txtCn1Relation.Text.ToString().Trim()); objContactInfo.Email1 = txtCn1Email.Text.ToString().Trim(); objContactInfo.StateID1 = Convert.ToInt32(ddlCn1State.SelectedItem.Value); // objContactInfo.Zip1 = txtCn1Zip.Text.Trim(); if (txtCn1Zip.Text != "" && txtCn1Zip.Text.Trim().Length == 4) { objContactInfo.Zip1 = "0" + txtCn1Zip.Text.Trim(); } else { objContactInfo.Zip1 = txtCn1Zip.Text.Trim(); } objContactInfo.Person2 = txtCn2Name.Text.ToString() == "" ? "" : GeneralFunction.ToProper(txtCn2Name.Text.ToString().Trim()); objContactInfo.P2Address1 = GeneralFunction.ToProperNotes((txtCn2Address1.Text.ToString().Trim())); objContactInfo.P2Address2 = GeneralFunction.ToProperNotes(txtCn2Address2.Text.ToString().Trim()); objContactInfo.Phone2 = txtCn2Phone.Text.ToString().Trim(); objContactInfo.Relation2 = GeneralFunction.ToProperNotes(txtCn2Relation.Text.ToString().Trim()); objContactInfo.Email2 = txtCn2Email.Text.ToString().Trim(); objContactInfo.StateID2 = Convert.ToInt32(ddlCn2State.SelectedItem.Value); if (txtCn2Zip.Text != "" && txtCn2Zip.Text.Trim().Length == 4) { objContactInfo.Zip2 = "0" + txtCn2Zip.Text.Trim(); } else { objContactInfo.Zip2 = txtCn2Zip.Text.Trim(); } objContactInfo.Person3 = txtCn3Name.Text.ToString() == "" ? "" : GeneralFunction.ToProper(txtCn3Name.Text.ToString().Trim()); objContactInfo.P3Address1 = GeneralFunction.ToProperNotes(txtCn3Address1.Text.ToString().Trim()); objContactInfo.P3Address2 = GeneralFunction.ToProperNotes(txtCn3Address2.Text.ToString().Trim()); objContactInfo.Phone3 = txtCn3Phone.Text.ToString().Trim(); objContactInfo.Relation3 = GeneralFunction.ToProperNotes(txtCn3Relation.Text.ToString().Trim()); objContactInfo.Email3 = txtCn3Email.Text.ToString().Trim(); objContactInfo.StateID3 = Convert.ToInt32(ddlCn3State.SelectedItem.Value); if (txtCn3Zip.Text != "" && txtCn3Zip.Text.Trim().Length == 4) { objContactInfo.Zip3 = "0" + txtCn3Zip.Text.Trim(); } else { objContactInfo.Zip3 = txtCn3Zip.Text.Trim(); } Attendance.BAL.Report obj = new Report(); obj.UpdateEmergencyDetails(objContactInfo, UserID, EmployeeID, strIp); //Page.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true); GetEmpDet(EmployeeID); mdlEditEmergContactDet.Hide(); } catch (Exception ex) { } }
private void GetStates(string Location) { try { int locationid = 0; if (Location.Trim() == "INDG" || Location.Trim() == "INBH") { locationid = 1; } else { locationid = 2; } Attendance.BAL.Report obj = new Report(); DataTable dt = obj.GetAllStates(locationid); ddlEmpState.DataSource = dt; ddlEmpState.DataTextField = "StateName"; ddlEmpState.DataValueField = "StateID"; ddlEmpState.DataBind(); ddlCn1State.DataSource = dt; ddlCn1State.DataTextField = "StateName"; ddlCn1State.DataValueField = "StateID"; ddlCn1State.DataBind(); ddlCn2State.DataSource = dt; ddlCn2State.DataTextField = "StateName"; ddlCn2State.DataValueField = "StateID"; ddlCn2State.DataBind(); ddlCn3State.DataSource = dt; ddlCn3State.DataTextField = "StateName"; ddlCn3State.DataValueField = "StateID"; ddlCn3State.DataBind(); } catch (Exception ex) { } }
protected void btnUpdatePersonal_Click(object sender, EventArgs e) { try { Attendance.Entities.UserInfo objInfo = new UserInfo(); int UserID = Convert.ToInt32(Session["UserID"]); int EmployeeID = Convert.ToInt32(hdnUserID.Value); String strHostName = Request.UserHostAddress.ToString(); string strIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString(); if (rdMale.Checked == true) { objInfo.Gender = "Male"; } else { objInfo.Gender = "Female"; } objInfo.DateOfBirth = txtDatBirth.Text.ToString() == "" ? Convert.ToDateTime("01/01/1900") : Convert.ToDateTime(Convert.ToDateTime(txtDatBirth.Text.Trim()).ToString("MM/dd/yyyy")); objInfo.Phone = txtEmpPhone.Text; objInfo.Mobile = txtEmpMobile.Text; objInfo.BusinessEmail = txtBusinessEmail.Text; objInfo.PersonalEmail = txtPersonalEmail.Text; string LocationName = ViewState["Location"].ToString().Trim(); if (LocationName.Trim().ToUpper() == "INBH" || LocationName.Trim().ToUpper() == "INDG") { objInfo.SSN = ""; } else { objInfo.SSN = txtSSN.Text.Trim(); } objInfo.Address1 = GeneralFunction.ToProperNotes(txtAddress1.Text.ToString().Trim()); objInfo.Address2 = GeneralFunction.ToProperNotes(txtAddress2.Text.ToString().Trim()); objInfo.StateID = Convert.ToInt32(ddlState.SelectedItem.Value); objInfo.County = txtCounty.Text; if (txtZip.Text != "" && txtZip.Text.Trim().Length == 4) { objInfo.Zip = "0" + txtZip.Text.Trim(); } else { objInfo.Zip = txtZip.Text.Trim(); } objInfo.DriverLicense = txtDriving.Text.Trim(); Attendance.BAL.Report obj = new Report(); obj.UpdatePersonalDetails(objInfo, UserID, EmployeeID, strIp); GetEmpDet(EmployeeID); mdlEditPersonalDetails.Hide(); } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { if (Session["TodayBannerDate"] != null) { comanyname.Text = CommonFiles.ComapnyName; if (!IsPostBack) { 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; lblDate2.Text = CurentDatetime.ToString("dddd MMMM dd yyyy, hh:mm:ss tt "); hdnTodaydt.Value = CurentDatetime.ToString("MM/dd/yyyy"); lblTimeZoneName.Text = Session["TimeZoneName"].ToString().Trim(); lblLocation.Text = Session["LocationName"].ToString(); lblHeadSchedule.Text = Session["ScheduleInOut"].ToString(); getLocations(); ViewState["Location"] = Session["LocationName"].ToString(); ddlLocation.SelectedIndex = ddlLocation.Items.IndexOf(ddlLocation.Items.FindByText(lblLocation.Text.Trim())); lblEmployyName.Text = Session["EmpName"].ToString().Trim(); Photo.Src = Session["Photo"].ToString().Trim(); Session["TodayDate"] = Session["TodayBannerDate"]; DateTime TodayDate = Convert.ToDateTime(Session["TodayDate"]); Session["TodayDate1"] = Convert.ToDateTime(Session["TodayDate"]); if (GeneralFunction.GetFirstDayOfWeekDate(TodayDate).ToString("MM/dd/yyyy") == GeneralFunction.GetFirstDayOfWeekDate(DateTime.Now).ToString("MM/dd/yyyy")) { btnNext.CssClass = "btn btn-danger btn-small disabled"; btnNext.Enabled = false; } else { btnNext.CssClass = "btn btn-danger btn-small enabled"; btnNext.Enabled = true; } DateTime StartDate = GeneralFunction.GetFirstDayOfWeekDate(TodayDate); DateTime EndDate = GeneralFunction.GetLastDayOfWeekDate(TodayDate); ViewState["CurrentStart"] = StartDate; ViewState["CurrentEnd"] = EndDate; int userid = Convert.ToInt32(Session["UserID"]); string Ismanage = Session["IsManage"].ToString(); string IsAdmin = Session["IsAdmin"].ToString(); btnFreeze.Visible = true; lblFreeze.Visible = true; // DateTime TodayDate = Convert.ToDateTime(Session["TodayDate"]); DateTime StartOfMonth = StartDate.AddDays(-1); DateTime FreezeDate = StartOfMonth; lblFreezedate.Text = FreezeDate.ToString("MM/dd/yyyy"); hdnFreeze.Value = FreezeDate.ToString("MM/dd/yyyy"); Attendance.BAL.Report obj = new Report(); //int CNT = obj.GetFreezedDate(FreezeDate); DateTime CNT = obj.GetFreezedDate(FreezeDate, ddlLocation.SelectedItem.Text.ToString().Trim()); lblFreezedate.Text = FreezeDate.ToString("MM/dd/yyyy"); hdnFreeze.Value = FreezeDate.ToString("MM/dd/yyyy"); if (CNT.ToString("MM/dd/yyyy") != "01/01/1900") { lblFreeze.Text = "Attendance freezed until " + CNT.ToString("MM/dd/yyyy"); ViewState["FreezeDate"] = CNT.ToString("MM/dd/yyyy"); btnFreeze.CssClass = "btn btn-warning btn-small disabled"; btnFreeze.Enabled = false; } else { lblFreeze.Visible = false; btnFreeze.CssClass = "btn btn-warning btn-small enabled"; btnFreeze.Enabled = true; } DataTable ds = new DataTable(); ds = GetReportAdmin(StartDate, EndDate, Convert.ToInt32(ddlLocation.SelectedValue)); lblGrdLocaton.Visible = true; ddlLocation.Visible = true; Session["AtnAdminDetails"] = ds; if (ds.Rows.Count > 0) { grdAttandence.DataSource = ds; grdAttandence.DataBind(); } } } else { Response.Redirect("Default.aspx"); } }
private void GetSchedules() { try { Attendance.BAL.Report obj = new Report(); DataTable dt = obj.GetAllScheduleTypes(); ddlSchedule.DataSource = dt; ddlSchedule.DataTextField = "ScheduleType"; ddlSchedule.DataValueField = "ScheduleID"; // ddlSchedule.Items.Add(new ListItem("Select", "0")); ddlSchedule.DataBind(); ddlSchedule.Items.Insert(0, new ListItem("Select", "0")); } catch (Exception ex) { } }
private DataTable GetMonthlyreport(DateTime startdate, DateTime endMonth) { DataTable dtAttandence = new DataTable(); try { lblWeekReportheading.Text = "Monthly summary attendance report"; lblWeekReport.Text = "( " + startdate.ToString("MM/dd/yyyy") + " - " + endMonth.ToString("MM/dd/yyyy") + " )"; dtAttandence.Columns.Add("empid", typeof(string)); dtAttandence.Columns.Add("Empname", typeof(string)); dtAttandence.Columns.Add("StatingDate", typeof(string)); dtAttandence.Columns.Add("TermDate", typeof(string)); dtAttandence.Columns.Add("TermReason", typeof(string)); dtAttandence.Columns.Add("Days", typeof(int)); dtAttandence.Rows.Add(); Attendance.BAL.Report obj = new Report(); DateTime enddate = startdate.AddMonths(1).AddSeconds(-1); DataSet ds = obj.GetActiveUsersAdmin(startdate, endMonth, ViewState["Location"].ToString().Trim()); for (int j = 0; j < 6; j++) { DataSet dsResult = obj.GetWeeklyReportAdmin(startdate, enddate, ViewState["Location"].ToString().Trim()); if (ds.Tables[0].Rows.Count > 0) { dtAttandence.Columns.Add("Month" + (j + 1), typeof(string)); dtAttandence.Columns.Add("Days" + (j + 1), typeof(string)); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (j == 0) { dtAttandence.Rows.Add(); } dtAttandence.Rows[i]["empid"] = ds.Tables[0].Rows[i]["empid"].ToString(); dtAttandence.Rows[i]["empname"] = ds.Tables[0].Rows[i]["firstName"].ToString() + " " + ds.Tables[0].Rows[i]["lastname"].ToString(); dtAttandence.Rows[i]["StatingDate"] = ds.Tables[0].Rows[i]["Startdate"].ToString(); dtAttandence.Rows[i]["TermDate"] = ds.Tables[0].Rows[i]["Termdate"].ToString(); if (dsResult.Tables.Count > 0) { if (dsResult.Tables[0].Rows.Count > 1) { DataTable dt = dsResult.Tables[0]; DataView dv = dt.DefaultView; DataTable dtname = new DataTable(); dv.RowFilter = "empid='" + ds.Tables[0].Rows[i]["empid"].ToString() + "'"; dtname = dv.ToTable(); if (dtname.Rows.Count > 0) { // dtAttandence.Rows[i]["Month" + (j + 1)] = dtname.Rows[0]["weeklyhrs"].ToString(); dtAttandence.Rows[i]["Month" + (j + 1)] = dtname.Rows[0]["weeklyhrs"].ToString() == "NULL" ? "" : dtname.Rows[0]["weeklyhrs"].ToString() == "" ? "" : GeneralFunction.CalNumericToint(Convert.ToDouble(dtname.Rows[0]["weeklyhrs"].ToString())).ToString(); dtAttandence.Rows[i]["Days" + (j + 1)] = dtname.Rows[0]["days"].ToString() == "NULL" ? 0 : dtname.Rows[0]["days"].ToString() == "" ? 0 : Convert.ToInt32(dtname.Rows[0]["days"].ToString()); } } } } startdate = enddate.AddSeconds(1); enddate = startdate.AddMonths(1).AddSeconds(-1); } } int TotalHrs1 = 0; int TotalHrs2 = 0; int TotalHrs3 = 0; int TotalHrs4 = 0; int TotalHrs5 = 0; int TotalHrs6 = 0; int TotalDays = 0; int Days1 = 0; int Days2 = 0; int Days3 = 0; int Days4 = 0; int Days5 = 0; int Days6 = 0; dtAttandence.Columns.Add("Totalhrs"); for (int i = 0; i < dtAttandence.Rows.Count - 1; i++) { TotalHrs1 = TotalHrs1 + ((dtAttandence.Rows[i]["Month1"].ToString() == "Null") ? 0 : (dtAttandence.Rows[i]["Month1"].ToString() == "") ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month1"])); TotalHrs2 = TotalHrs2 + (dtAttandence.Rows[i]["Month2"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month2"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month2"])); TotalHrs3 = TotalHrs3 + ((dtAttandence.Rows[i]["Month3"].ToString() == "Null" ? 0 : (dtAttandence.Rows[i]["Month3"].ToString() == "") ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month3"]))); TotalHrs4 = TotalHrs4 + (dtAttandence.Rows[i]["Month4"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month4"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month4"])); TotalHrs5 = TotalHrs5 + (dtAttandence.Rows[i]["Month5"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month5"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month5"])); TotalHrs6 = TotalHrs6 + (dtAttandence.Rows[i]["Month6"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month6"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month6"])); int WeekHrs = ((dtAttandence.Rows[i]["Month1"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month1"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month1"]))) + (dtAttandence.Rows[i]["Month2"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month2"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month2"])) + (dtAttandence.Rows[i]["Month3"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month3"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month3"])) + (dtAttandence.Rows[i]["Month4"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month4"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month4"])) + (dtAttandence.Rows[i]["Month5"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month5"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month5"])) + (dtAttandence.Rows[i]["Month6"].ToString() == "Null" ? 0 : dtAttandence.Rows[i]["Month6"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Month6"])); dtAttandence.Rows[i]["Totalhrs"] = WeekHrs == 0 ? "" : GeneralFunction.ConverttoTime(WeekHrs); dtAttandence.Rows[i]["Days"] = (dtAttandence.Rows[i]["Days1"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days1"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days1"])) + (dtAttandence.Rows[i]["Days2"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days2"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days2"])) + (dtAttandence.Rows[i]["Days3"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days3"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days3"])) + (dtAttandence.Rows[i]["Days4"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days4"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days4"])) + (dtAttandence.Rows[i]["Days5"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days5"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days5"])) + (dtAttandence.Rows[i]["Days6"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days6"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days6"])); Days1 += dtAttandence.Rows[i]["Days1"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days1"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days1"]); Days2 += dtAttandence.Rows[i]["Days2"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days2"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days2"]); Days3 += dtAttandence.Rows[i]["Days3"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days3"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days3"]); Days4 += dtAttandence.Rows[i]["Days4"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days4"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days4"]); Days5 += dtAttandence.Rows[i]["Days5"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days5"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days5"]); Days6 += dtAttandence.Rows[i]["Days6"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days6"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days6"]); TotalDays += dtAttandence.Rows[i]["Days"].ToString() == "NULL" ? 0 : dtAttandence.Rows[i]["Days"].ToString() == "" ? 0 : Convert.ToInt32(dtAttandence.Rows[i]["Days"].ToString()); } dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Month1"] = TotalHrs1 == 0 ? "" : TotalHrs1.ToString(); dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Month2"] = TotalHrs2 == 0 ? "" : TotalHrs2.ToString(); dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Month3"] = TotalHrs3 == 0 ? "" : TotalHrs3.ToString(); dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Month4"] = TotalHrs4 == 0 ? "" : TotalHrs4.ToString(); dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Month5"] = TotalHrs5 == 0 ? "" : TotalHrs5.ToString(); dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Month6"] = TotalHrs6 == 0 ? "" : TotalHrs6.ToString(); dtAttandence.Rows[dtAttandence.Rows.Count - 1]["empid"] = "<b>Totals</b>"; dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Days"] = TotalDays; int sum = TotalHrs1 + TotalHrs2 + TotalHrs3 + TotalHrs4 + TotalHrs5 + TotalHrs6; dtAttandence.Rows[dtAttandence.Rows.Count - 1]["Totalhrs"] = sum == 0 ? "" : GeneralFunction.ConverttoTime(sum); } catch (Exception ex) { } return dtAttandence; }
private void BindScheduleData(int LocationID,int scheduleTypeID, DateTime startDate, DateTime EndDate) { Report obj = new Report(); try { DataSet ds = obj.GetEmpScheduleDet(LocationID, scheduleTypeID, startDate, EndDate); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { if (ddlScheduleType.SelectedValue == "2") { grdVariable.DataSource = ds.Tables[0]; grdVariable.DataBind(); dvVariable.Style["display"] = "block"; dvDefault.Style["display"] = "none"; grdDefault.DataSource = null; grdDefault.DataBind(); } else { grdDefault.DataSource = ds.Tables[0]; grdDefault.DataBind(); grdVariable.DataSource = null; grdVariable.DataBind(); dvVariable.Style["display"] = "none"; dvDefault.Style["display"] = "block"; } } } } catch (Exception ex) { } }
protected void btnFreeze_Click(object sender, EventArgs e) { try { int userid = Convert.ToInt32(Session["UserID"]); string Ismanage = Session["IsManage"].ToString(); string location = ViewState["Location"].ToString(); Attendance.BAL.Report obj = new Report(); // DateTime TodayDate = Convert.ToDateTime(Session["TodayDate"]); // DateTime StartOfMonth = GeneralFunction.GetFirstDayOfWeekDate(TodayDate); DateTime FreezeDate = Convert.ToDateTime(hdnFreeze.Value); bool bnew = obj.UpdateFreeze(userid, location, FreezeDate); if (bnew) { // mdlFeeze.Hide(); System.Web.UI.ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "Script", "alert('Attendance is freezed upto " + FreezeDate.ToString("MM/dd/yyyy") + " ');", true); } } catch (Exception ex) { } }
private void GetReport(DateTime StartDate, DateTime EndTime, int userid) { try { Attendance.BAL.Report obj = new Report(); DataSet ds = obj.GetPayrollReport(StartDate, EndTime, userid); lblWeekPayrollReport.Text = "( " + StartDate.ToString("MM/dd/yyyy") + " - " + EndTime.ToString("MM/dd/yyyy") + " )"; GetEditHistory(StartDate, EndTime); grdPayRoll.DataSource = ds.Tables[0]; grdPayRoll.DataBind(); } catch (Exception ex) { } }