public IList <ACFiscalYearEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression) { IList <ACFiscalYearEntity> aCFiscalYearEntityList = new List <ACFiscalYearEntity>(); try { if (pageSize == -1) { pageSize = 1000000000; } if (String.IsNullOrEmpty(sortExpression)) { sortExpression = ACFiscalYearEntity.FLD_NAME_FiscalYearID + " " + SQLConstants.SORT_ORDER_DESCENDING; } startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1; aCFiscalYearEntityList = FCCACFiscalYear.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression); if (aCFiscalYearEntityList != null && aCFiscalYearEntityList.Count > 0) { totalRowCount = aCFiscalYearEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(aCFiscalYearEntityList ?? new List <ACFiscalYearEntity>()); }
private Int64 GetFiscalYear() { Int64 fiscalyearID = 0; IList <ACFiscalYearEntity> lst = FCCACFiscalYear.GetFacadeCreate().GetIL(null, null, String.Empty, String.Empty, DatabaseOperationType.Load); ACFiscalYearEntity ent = lst.Where(x => x.IsClosed == false).Single(); return(fiscalyearID = ent.FiscalYearID); }
private void CalculateLeave() { if (chbxFilter.Checked) { HREmployeeEntity hREmployeeEntity = FCCHREmployee.GetFacadeCreate().GetByID(Int64.Parse(ddlEmployeeID.SelectedValue)); ACFiscalYearEntity aCFiscalYearEntity = FCCACFiscalYear.GetFacadeCreate().GetByID(Int64.Parse(ddlFiscalYearID.SelectedValue)); MDLeaveCategoryEntity mDLeaveCategoryEntity = FCCMDLeaveCategory.GetFacadeCreate().GetByID(Int64.Parse(ddlLeaveCategoryID.SelectedValue)); IList <MDLeavePolicyEntity> mDLeavePolicyList = FCCMDLeavePolicy.GetFacadeCreate().GetIL(1000, 1, String.Empty, String.Empty, DatabaseOperationType.Load); Decimal leaveInDays = 0; if (mDLeavePolicyList.Count > 0 && mDLeavePolicyList != null) { mDLeavePolicyList[0] = mDLeavePolicyList.Single(x => (x.LeaveCategoryID == mDLeaveCategoryEntity.LeaveCategoryID && x.FiscalYearID == aCFiscalYearEntity.FiscalYearID && x.EmployeeJobTypeID == hREmployeeEntity.EmployeeJobTypeID)); if (mDLeavePolicyList[0].LeaveCategoryID == mDLeaveCategoryEntity.LeaveCategoryID && mDLeavePolicyList[0].FiscalYearID == aCFiscalYearEntity.FiscalYearID) { leaveInDays = mDLeavePolicyList[0].LeaveInDays; } if (hREmployeeEntity.EmployeeJobTypeID == MasterDataConstants.MDEmployeeJobType.FULLTIME && hREmployeeEntity.ConfirmDate <= aCFiscalYearEntity.BeginDate) { txtEarnedDays.Text = leaveInDays.ToString().Trim();; } else if (hREmployeeEntity.EmployeeJobTypeID == MasterDataConstants.MDEmployeeJobType.PARTTIMENOTLESS75PERCENT) { txtEarnedDays.Text = leaveInDays.ToString().Trim(); } else if (hREmployeeEntity.EmployeeJobTypeID == MasterDataConstants.MDEmployeeJobType.FULLTIME && hREmployeeEntity.ConfirmDate == null) { txtEarnedDays.Text = "0.0"; } else if (hREmployeeEntity.EmployeeJobTypeID == MasterDataConstants.MDEmployeeJobType.PARTTIMENOTLESS50PERCENT) { txtEarnedDays.Text = leaveInDays.ToString().Trim(); } else if (hREmployeeEntity.EmployeeJobTypeID == MasterDataConstants.MDEmployeeJobType.FULLTIME && (hREmployeeEntity.ConfirmDate <= aCFiscalYearEntity.BeginDate && hREmployeeEntity.ConfirmDate >= aCFiscalYearEntity.EndDate)) { DateTime s = aCFiscalYearEntity.EndDate; DateTime e = (DateTime)hREmployeeEntity.ConfirmDate; Decimal Month = s.Subtract(e).Days / (365 / 12); Month = (leaveInDays / 12) * Month; txtEarnedDays.Text = Month.ToString().Trim();; } else { txtEarnedDays.Text = "0"; } } else { MiscUtil.ShowMessage(lblMessage, "There is no policy in this fiscal year and may be not active please insert data in Leave Policy.", false); } } else { txtEarnedDays.Text = String.Empty; } }
private void SaveACFiscalYearEntity() { if (IsValid) { try { ACFiscalYearEntity aCFiscalYearEntity = BuildACFiscalYearEntity(); Int64 result = -1; if (aCFiscalYearEntity.IsNew) { result = FCCACFiscalYear.GetFacadeCreate().Add(aCFiscalYearEntity, DatabaseOperationType.Add, TransactionRequired.No); } else { String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(ACFiscalYearEntity.FLD_NAME_FiscalYearID, aCFiscalYearEntity.FiscalYearID.ToString(), SQLMatchType.Equal); result = FCCACFiscalYear.GetFacadeCreate().Update(aCFiscalYearEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No); } if (result > 0) { _FiscalYearID = 0; _ACFiscalYearEntity = new ACFiscalYearEntity(); PrepareInitialView(); BindACFiscalYearList(); if (aCFiscalYearEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "A CFiscal Year Information has been added successfully.", false); } else { MiscUtil.ShowMessage(lblMessage, "A CFiscal Year Information has been updated successfully.", false); } } else { if (aCFiscalYearEntity.IsNew) { MiscUtil.ShowMessage(lblMessage, "Failed to add A CFiscal Year Information.", false); } else { MiscUtil.ShowMessage(lblMessage, "Failed to update A CFiscal Year Information.", false); } } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } }
private void BuildBudgetWizard() { if (ddlFiscalYearID != null && ddlFiscalYearID.Items.Count > 0) { if (ddlAccountID != null && ddlAccountID.Items.Count > 0 && ddlAccountID.SelectedValue != "$$OPTGROUP$$OPTGROUP$$") { String fe1 = SqlExpressionBuilder.PrepareFilterExpression(ACBudgetEntity.FLD_NAME_FiscalYearID, ddlFiscalYearID.SelectedValue.ToString(), SQLMatchType.Equal); String fe2 = SqlExpressionBuilder.PrepareFilterExpression(ACBudgetEntity.FLD_NAME_AccountID, ddlAccountID.SelectedValue.ToString(), SQLMatchType.Equal); String fe = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2); IList <ACBudgetEntity> lst = FCCACBudget.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression); if (lst != null && lst.Count > 0) { BindList(); } else { ACFiscalYearEntity aCFisalYearEntitiy = FCCACFiscalYear.GetFacadeCreate().GetByID(Int64.Parse(ddlFiscalYearID.SelectedValue)); if (aCFisalYearEntitiy != null && aCFisalYearEntitiy.FiscalYearID > 0) { DateTime beginDate = aCFisalYearEntitiy.BeginDate; while (beginDate <= aCFisalYearEntitiy.EndDate) { try { ACBudgetEntity aCBudgetEntity = new ACBudgetEntity(); aCBudgetEntity.FiscalYearID = Int64.Parse(ddlFiscalYearID.SelectedValue); aCBudgetEntity.AccountID = Int64.Parse(ddlAccountID.SelectedValue); aCBudgetEntity.Period = beginDate; aCBudgetEntity.Amount = 0; FCCACBudget.GetFacadeCreate().Add(aCBudgetEntity, DatabaseOperationType.Add, TransactionRequired.No); beginDate = beginDate.AddMonths(1); } catch (Exception) { throw; } } BindList(); } } BuildBudgetLabel(); } } }
protected void lvACFiscalYear_ItemCommand(object sender, ListViewCommandEventArgs e) { Int64 FiscalYearID; Int64.TryParse(e.CommandArgument.ToString(), out FiscalYearID); if (FiscalYearID > 0) { if (string.Equals(e.CommandName, "EditItem")) { _FiscalYearID = FiscalYearID; PrepareEditView(); cpeEditor.Collapsed = false; cpeEditor.ClientState = "false"; } else if (string.Equals(e.CommandName, "DeleteItem")) { try { Int64 result = -1; String fe = SqlExpressionBuilder.PrepareFilterExpression(ACFiscalYearEntity.FLD_NAME_FiscalYearID, FiscalYearID.ToString(), SQLMatchType.Equal); ACFiscalYearEntity aCFiscalYearEntity = new ACFiscalYearEntity(); result = FCCACFiscalYear.GetFacadeCreate().Delete(aCFiscalYearEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No); if (result == 0) { _FiscalYearID = 0; _ACFiscalYearEntity = new ACFiscalYearEntity(); PrepareInitialView(); BindACFiscalYearList(); MiscUtil.ShowMessage(lblMessage, "A CFiscal Year has been successfully deleted.", true); } else { MiscUtil.ShowMessage(lblMessage, "Failed to delete A CFiscal Year.", true); } } catch (Exception ex) { MiscUtil.ShowMessage(lblMessage, ex.Message, true); } } } }
public IList <ACFiscalYearEntity> GetData() { IList <ACFiscalYearEntity> aCFiscalYearEntityList = new List <ACFiscalYearEntity>(); try { aCFiscalYearEntityList = FCCACFiscalYear.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load); if (aCFiscalYearEntityList != null && aCFiscalYearEntityList.Count > 0) { totalRowCount = aCFiscalYearEntityList[0].TotalRowCount; } } catch (Exception ex) { } return(aCFiscalYearEntityList ?? new List <ACFiscalYearEntity>()); }
private HREmployeeLeaveApplicationEntity BuildHREmployeeLeaveApplicationEntity() { HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity = CurrentHREmployeeLeaveApplicationEntity; hREmployeeLeaveApplicationEntity.EmployeeID = OverviewEmployeeID; if (txtApplicationDate.Text.Trim().IsNotNullOrEmpty()) { hREmployeeLeaveApplicationEntity.ApplicationDate = DateTime.Parse(txtApplicationDate.Text); } if (txtRequestStartDate.Text.Trim().IsNotNullOrEmpty()) { hREmployeeLeaveApplicationEntity.RequestStartDate = MiscUtil.ParseToDateTime(txtRequestStartDate.Text); } if (txtRequestEndDate.Text.Trim().IsNotNullOrEmpty()) { hREmployeeLeaveApplicationEntity.RequestEndDate = MiscUtil.ParseToDateTime(txtRequestEndDate.Text); } if (!txtTotalLeaveDays.Text.Trim().IsNullOrEmpty()) { hREmployeeLeaveApplicationEntity.TotalLeaveDays = Decimal.Parse(txtTotalLeaveDays.Text.Trim()); } //hREmployeeLeaveApplicationEntity.Description = txtDescription.Text.Trim(); if (ddlLeavePurpose.Items.Count > 0) { if (ddlLeavePurpose.SelectedValue == "0") { hREmployeeLeaveApplicationEntity.Description = null; } else { hREmployeeLeaveApplicationEntity.Description = ddlLeavePurpose.SelectedValue; } } //hREmployeeLeaveApplicationEntity.LeaveLocation = txtLeaveLocation.Text.Trim(); if (ddlLeaveLocation.Items.Count > 0) { if (ddlLeaveLocation.SelectedValue == "0") { hREmployeeLeaveApplicationEntity.LeaveLocation = null; } else { hREmployeeLeaveApplicationEntity.LeaveLocation = ddlLeaveLocation.SelectedValue; } } if (ddlBackupEmployeeID.Items.Count > 0) { if (ddlBackupEmployeeID.SelectedValue == "0") { hREmployeeLeaveApplicationEntity.BackupEmployeeID = null; } else { hREmployeeLeaveApplicationEntity.BackupEmployeeID = Int64.Parse(ddlBackupEmployeeID.SelectedValue); } } if (ddlLeaveApplicationApplicationStatusID.Items.Count > 0) { if (ddlLeaveApplicationApplicationStatusID.SelectedValue == "0") { } else { hREmployeeLeaveApplicationEntity.LeaveApplicationApplicationStatusID = Int64.Parse(ddlLeaveApplicationApplicationStatusID.SelectedValue); } } #region Active FiscalYearID IList <ACFiscalYearEntity> listACFiscalYear = FCCACFiscalYear.GetFacadeCreate().GetIL(10000, 1, String.Empty, String.Empty, DatabaseOperationType.Load); ACFiscalYearEntity aCFiscalYearEntity = listACFiscalYear.Where(x => x.IsClosed == false).Single(); //if (listACFiscalYear.Count > 0 && listACFiscalYear[0].IsClosed == false) if (listACFiscalYear.Count > 0) { hREmployeeLeaveApplicationEntity.FiscalYearID = aCFiscalYearEntity.FiscalYearID; } #endregion return(hREmployeeLeaveApplicationEntity); }