Example #1
0
        public IList <HRMemberLeaveAccountEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <HRMemberLeaveAccountEntity> hRMemberLeaveAccountEntityList = new List <HRMemberLeaveAccountEntity>();

            try
            {
                if (pageSize == -1)
                {
                    pageSize = 1000000000;
                }

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = HRMemberLeaveAccountEntity.FLD_NAME_MemberLeaveAccountID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

                startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1;

                hRMemberLeaveAccountEntityList = FCCHRMemberLeaveAccount.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

                if (hRMemberLeaveAccountEntityList != null && hRMemberLeaveAccountEntityList.Count > 0)
                {
                    totalRowCount = hRMemberLeaveAccountEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(hRMemberLeaveAccountEntityList ?? new List <HRMemberLeaveAccountEntity>());
        }
        private void SaveHRMemberLeaveAccountEntity()
        {
            if (IsValid)
            {
                try
                {
                    HRMemberLeaveAccountEntity hRMemberLeaveAccountEntity = BuildHRMemberLeaveAccountEntity();

                    Int64 result = -1;

                    if (hRMemberLeaveAccountEntity.IsNew)
                    {
                        result = FCCHRMemberLeaveAccount.GetFacadeCreate().Add(hRMemberLeaveAccountEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRMemberLeaveAccountEntity.FLD_NAME_MemberLeaveAccountID, hRMemberLeaveAccountEntity.MemberLeaveAccountID.ToString(), SQLMatchType.Equal);
                        result = FCCHRMemberLeaveAccount.GetFacadeCreate().Update(hRMemberLeaveAccountEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _MemberLeaveAccountID       = 0;
                        _HRMemberLeaveAccountEntity = new HRMemberLeaveAccountEntity();
                        PrepareInitialView();
                        BindHRMemberLeaveAccountList();

                        if (hRMemberLeaveAccountEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Member Leave Account Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Member Leave Account Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (hRMemberLeaveAccountEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Member Leave Account Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Member Leave Account Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvHRMemberLeaveAccount_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 MemberLeaveAccountID;

            Int64.TryParse(e.CommandArgument.ToString(), out MemberLeaveAccountID);

            if (MemberLeaveAccountID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _MemberLeaveAccountID = MemberLeaveAccountID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(HRMemberLeaveAccountEntity.FLD_NAME_MemberLeaveAccountID, MemberLeaveAccountID.ToString(), SQLMatchType.Equal);

                        HRMemberLeaveAccountEntity hRMemberLeaveAccountEntity = new HRMemberLeaveAccountEntity();


                        result = FCCHRMemberLeaveAccount.GetFacadeCreate().Delete(hRMemberLeaveAccountEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _MemberLeaveAccountID       = 0;
                            _HRMemberLeaveAccountEntity = new HRMemberLeaveAccountEntity();
                            PrepareInitialView();
                            BindHRMemberLeaveAccountList();

                            MiscUtil.ShowMessage(lblMessage, "Member Leave Account has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Member Leave Account.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Example #4
0
        private Decimal?GetToalLeaveEarned()
        {
            Int64   fiscalYearID     = MiscUtil.GetActiveFiscalYear();
            Decimal?totalLeaveEarned = 0;

            String fe = "EmployeeID = " + OverviewEmployeeID + " and FiscalYearID = " + fiscalYearID + "";


            IList <HRMemberLeaveAccountEntity> list = FCCHRMemberLeaveAccount.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

            if (list != null && list.Count > 0)
            {
                totalLeaveEarned = list.AsEnumerable().Sum(x => x.EarnedDays);
            }

            return(totalLeaveEarned);
        }
Example #5
0
        public IList <HRMemberLeaveAccountEntity> GetData()
        {
            IList <HRMemberLeaveAccountEntity> hRMemberLeaveAccountEntityList = new List <HRMemberLeaveAccountEntity>();

            try
            {
                hRMemberLeaveAccountEntityList = FCCHRMemberLeaveAccount.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

                if (hRMemberLeaveAccountEntityList != null && hRMemberLeaveAccountEntityList.Count > 0)
                {
                    totalRowCount = hRMemberLeaveAccountEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(hRMemberLeaveAccountEntityList ?? new List <HRMemberLeaveAccountEntity>());
        }