private void GetSalarySessionStartDateAndEndDate(Int64 salarySessionID) { MDSalarySessionEntity entity = FCCMDSalarySession.GetFacadeCreate().GetByID(salarySessionID); lblStartDate.Text = entity.SessionStartDate.ToString().Trim(); lblEndDate.Text = entity.SessionEndDate.ToString().Trim(); }
public IList <MDSalarySessionEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <MDSalarySessionEntity> mDSalarySessionEntityList = new List <MDSalarySessionEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = MDSalarySessionEntity.FLD_NAME_SalarySessionID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; mDSalarySessionEntityList = FCCMDSalarySession.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (mDSalarySessionEntityList != null && mDSalarySessionEntityList.Count > 0) { totalRowCount = mDSalarySessionEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(mDSalarySessionEntityList ?? new List <MDSalarySessionEntity>()); }
private void ReGenerateWorkingDays() { if (ddlSalarySessionID != null && ddlSalarySessionID.Items.Count > 0) { MDSalarySessionEntity mDSalarySessionEntity = FCCMDSalarySession.GetFacadeCreate().GetByID(Int64.Parse(ddlSalarySessionID.SelectedValue)); if (mDSalarySessionEntity != null && mDSalarySessionEntity.SalarySessionID > 0) { TimeSpan dt = mDSalarySessionEntity.SessionEndDate - mDSalarySessionEntity.SessionStartDate; Double totalDays = dt.TotalDays + 1; Double holiDay = 0.0; Double workDay = 0.0; IList <HRWorkingDayEntity> lst = new List <HRWorkingDayEntity>(); for (Int32 i = 0; i < totalDays; i++) { HRWorkingDayEntity ent = new HRWorkingDayEntity(); ent.Date = mDSalarySessionEntity.SessionStartDate.AddDays(i); ent.FiscalYearID = mDSalarySessionEntity.FiscalYearID; ent.SalarySessionID = mDSalarySessionEntity.SalarySessionID; ent.WorkingDay = mDSalarySessionEntity.SessionStartDate.AddDays(i); switch (ent.Date.DayOfWeek) { //Default Weekend case DayOfWeek.Friday: ent.AttendanceLeaveAndHolidayCategoryID = MasterDataConstants.MDAttendanceLeaveAndHolidayCategory.HOLIDAY; holiDay++; break; //Others Holiday will come here. default: ent.AttendanceLeaveAndHolidayCategoryID = MasterDataConstants.MDAttendanceLeaveAndHolidayCategory.WORK_DAY; workDay++; break; } ent.Note = String.Empty; ent.Year = ent.Date.Year; ent.Month = ent.Date.Month; ent.Day = ent.Date.Day; ent.IsRemoved = false; lst.Add(ent); } lblTotalDay.Text = totalDays.ToString().Trim(); lblHoliday.Text = holiDay.ToString().Trim(); lblWorkingDay.Text = workDay.ToString().Trim(); lvHRWorkingDay.DataSource = lst; lvHRWorkingDay.DataBind(); BuildAttendanceLeaveAndHolidayCategoryDropDownList(); } } }
private void SaveMDSalarySessionEntity() { if (IsValid) { try { MDSalarySessionEntity mDSalarySessionEntity = BuildMDSalarySessionEntity(); Int64 result = -1; if (mDSalarySessionEntity.IsNew) { result = FCCMDSalarySession.GetFacadeCreate().Add(mDSalarySessionEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDSalarySessionEntity.FLD_NAME_SalarySessionID, mDSalarySessionEntity.SalarySessionID.ToString(), SQLMatchType.Equal); result = FCCMDSalarySession.GetFacadeCreate().Update(mDSalarySessionEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _SalarySessionID = 0; _MDSalarySessionEntity = new MDSalarySessionEntity(); PrepareInitialView(); BindMDSalarySessionList(); if (mDSalarySessionEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Salary Session Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "Salary Session Information has been updated successfully.", false); } Response.Redirect("~/HR/HRWorkingDay.aspx"); } else { if (mDSalarySessionEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add Salary Session Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update Salary Session Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
private Boolean ValidationInput() { Boolean flag = true; #region Check Balance Decimal?totalLeaveEarned = GetToalLeaveEarned(); Decimal?totalLeaveEnjoyed = GetToalLeaveEnjoyed() + Decimal.Parse(txtTotalLeaveDays.Text); if (totalLeaveEarned > 0 && totalLeaveEarned <= totalLeaveEnjoyed) { //MiscUtil.ShowMessage(lblMessage, "Sorry you do not have sufficient balance to take a leave please ask your HOD for extra leave.", true); this.messageDetails.Text = "Sorry you do not have sufficient balance to take a leave please ask your HOD for extra leave."; this.MPE.Show(); flag = false; } #endregion String fe = "SessionStartDate<= '" + MiscUtil.ParseToDateTime(txtRequestStartDate.Text) + "' and SessionEndDate>='" + MiscUtil.ParseToDateTime(txtRequestEndDate.Text) + "'"; IList <MDSalarySessionEntity> lstMDSalarySession = FCCMDSalarySession.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (lstMDSalarySession != null && lstMDSalarySession.Count > 0) { ViewState["SalarySessionID"] = lstMDSalarySession[0].SalarySessionID; } else { //MiscUtil.ShowMessage(lblMessage, "Sorry your Request start and end date is not under any session please choose.", true); this.messageDetails.Text = "Sorry your Request Start or End Date did not match with our month. May be they are under two different month. So please check the date."; this.MPE.Show(); flag = false; } if (flag) { String fe_alreadyRequested1 = "(RequestStartDate >= '" + MiscUtil.ParseToDateTime(txtRequestStartDate.Text) + "' and RequestEndDate <='" + MiscUtil.ParseToDateTime(txtRequestEndDate.Text) + "' OR RequestEndDate >= '" + MiscUtil.ParseToDateTime(txtRequestStartDate.Text) + "' and RequestStartDate <='" + MiscUtil.ParseToDateTime(txtRequestEndDate.Text) + "')"; String fe_alreadyRequested2 = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeLeaveApplicationEntity.FLD_NAME_EmployeeID, OverviewEmployeeID.ToString(), SQLMatchType.Equal); String fe_alreadyRequested = SqlExpressionBuilder.PrepareFilterExpression(fe_alreadyRequested1, SQLJoinType.AND, fe_alreadyRequested2); IList <HREmployeeLeaveApplicationEntity> lstHREmployeeLeaveApplication = FCCHREmployeeLeaveApplication.GetFacadeCreate().GetIL(null, null, String.Empty, fe_alreadyRequested, DatabaseOperationType.LoadWithFilterExpression); if (lstHREmployeeLeaveApplication != null && lstHREmployeeLeaveApplication.Count > 0) { //MiscUtil.ShowMessage(lblMessage, "Sorry You already have leave in this session please take carefully", true); this.messageDetails.Text = "Sorry You already have leave in this date. Please Check."; this.MPE.Show(); flag = false; } } return(flag); }
protected void lvMDSalarySession_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 SalarySessionID; Int64.TryParse(e.CommandArgument.ToString(), out SalarySessionID); if (SalarySessionID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _SalarySessionID = SalarySessionID; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(MDSalarySessionEntity.FLD_NAME_SalarySessionID, SalarySessionID.ToString(), SQLMatchType.Equal); MDSalarySessionEntity mDSalarySessionEntity = new MDSalarySessionEntity(); result = FCCMDSalarySession.GetFacadeCreate().Delete(mDSalarySessionEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _SalarySessionID = 0; _MDSalarySessionEntity = new MDSalarySessionEntity(); PrepareInitialView(); BindMDSalarySessionList(); MiscUtil.ShowMessage(lblMessage, "Salary Session has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete Salary Session.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
public IList <MDSalarySessionEntity> GetData() { IList <MDSalarySessionEntity> mDSalarySessionEntityList = new List <MDSalarySessionEntity>(); try { mDSalarySessionEntityList = FCCMDSalarySession.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (mDSalarySessionEntityList != null && mDSalarySessionEntityList.Count > 0) { totalRowCount = mDSalarySessionEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(mDSalarySessionEntityList ?? new List <MDSalarySessionEntity>()); }
private void GenerateWorkingDays() { if (ddlSalarySessionID != null && ddlSalarySessionID.Items.Count > 0) { MDSalarySessionEntity mDSalarySessionEntity = FCCMDSalarySession.GetFacadeCreate().GetByID(Int64.Parse(ddlSalarySessionID.SelectedValue)); if (mDSalarySessionEntity != null && mDSalarySessionEntity.SalarySessionID > 0) { TimeSpan dt = mDSalarySessionEntity.SessionEndDate - mDSalarySessionEntity.SessionStartDate; Double totalDays = dt.TotalDays + 1; Double holiDay = 0.0; Double workDay = 0.0; IList <HRWorkingDayEntity> lst = new List <HRWorkingDayEntity>(); for (Int32 i = 0; i < totalDays; i++) { HRWorkingDayEntity ent = new HRWorkingDayEntity(); ent.Date = mDSalarySessionEntity.SessionStartDate.AddDays(i); ent.FiscalYearID = mDSalarySessionEntity.FiscalYearID; ent.SalarySessionID = mDSalarySessionEntity.SalarySessionID; ent.WorkingDay = mDSalarySessionEntity.SessionStartDate.AddDays(i); switch (ent.Date.DayOfWeek) { //Default Weekend case DayOfWeek.Friday: ent.AttendanceLeaveAndHolidayCategoryID = MasterDataConstants.MDAttendanceLeaveAndHolidayCategory.HOLIDAY; holiDay++; break; //Others Holiday will come here. default: ent.AttendanceLeaveAndHolidayCategoryID = MasterDataConstants.MDAttendanceLeaveAndHolidayCategory.WORK_DAY; workDay++; break; } ent.Note = String.Empty; ent.Year = ent.Date.Year; ent.Month = ent.Date.Month; ent.Day = ent.Date.Day; ent.IsRemoved = false; lst.Add(ent); } btnReGenerate.Enabled = false; #region HasList String fe = "FiscalYearID = " + Int64.Parse(ddlFiscalYearID.SelectedValue) + " and SalarySessionID=" + Int64.Parse(ddlSalarySessionID.SelectedValue) + ""; IList <HRWorkingDayEntity> hRWorkingDayList = FCCHRWorkingDay.GetFacadeCreate().GetIL(1000, 1, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (hRWorkingDayList != null && hRWorkingDayList.Count > 0) { lst = hRWorkingDayList; holiDay = 0.0; workDay = 0.0; foreach (HRWorkingDayEntity entity in hRWorkingDayList) { if (entity.AttendanceLeaveAndHolidayCategoryID == MasterDataConstants.MDAttendanceLeaveAndHolidayCategory.HOLIDAY) { holiDay++; } else if (entity.AttendanceLeaveAndHolidayCategoryID == MasterDataConstants.MDAttendanceLeaveAndHolidayCategory.WORK_DAY) { workDay++; } } btnSubmit.Text = "Update"; btnReGenerate.Enabled = true; } #endregion lblTotalDay.Text = totalDays.ToString().Trim(); lblHoliday.Text = holiDay.ToString().Trim(); lblWorkingDay.Text = workDay.ToString().Trim(); lvHRWorkingDay.DataSource = lst; lvHRWorkingDay.DataBind(); BuildAttendanceLeaveAndHolidayCategoryDropDownList(); } } }