示例#1
0
        public IList <MDLoanCategoryEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <MDLoanCategoryEntity> mDLoanCategoryEntityList = new List <MDLoanCategoryEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDLoanCategoryEntity.FLD_NAME_LoanCategoryID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDLoanCategoryEntityList = FCCMDLoanCategory.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDLoanCategoryEntityList ?? new List <MDLoanCategoryEntity>());
        }
        private void SaveMDLoanCategoryEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDLoanCategoryEntity mDLoanCategoryEntity = BuildMDLoanCategoryEntity();

                    Int64 result = -1;

                    if (mDLoanCategoryEntity.IsNew)
                    {
                        result = FCCMDLoanCategory.GetFacadeCreate().Add(mDLoanCategoryEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDLoanCategoryEntity.FLD_NAME_LoanCategoryID, mDLoanCategoryEntity.LoanCategoryID.ToString(), SQLMatchType.Equal);
                        result = FCCMDLoanCategory.GetFacadeCreate().Update(mDLoanCategoryEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _LoanCategoryID       = 0;
                        _MDLoanCategoryEntity = new MDLoanCategoryEntity();
                        PrepareInitialView();
                        BindMDLoanCategoryList();

                        if (mDLoanCategoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Loan Category Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Loan Category Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDLoanCategoryEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Loan Category Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Loan Category Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvMDLoanCategory_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 LoanCategoryID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDLoanCategoryEntity.FLD_NAME_LoanCategoryID, LoanCategoryID.ToString(), SQLMatchType.Equal);

                        MDLoanCategoryEntity mDLoanCategoryEntity = new MDLoanCategoryEntity();


                        result = FCCMDLoanCategory.GetFacadeCreate().Delete(mDLoanCategoryEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _LoanCategoryID       = 0;
                            _MDLoanCategoryEntity = new MDLoanCategoryEntity();
                            PrepareInitialView();
                            BindMDLoanCategoryList();

                            MiscUtil.ShowMessage(lblMessage, "Loan Category has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Loan Category.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
示例#4
0
        public IList <MDLoanCategoryEntity> GetData()
        {
            IList <MDLoanCategoryEntity> mDLoanCategoryEntityList = new List <MDLoanCategoryEntity>();

            try
            {
                mDLoanCategoryEntityList = FCCMDLoanCategory.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDLoanCategoryEntityList ?? new List <MDLoanCategoryEntity>());
        }