Пример #1
0
        public IList <MDCurrencyEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <MDCurrencyEntity> mDCurrencyEntityList = new List <MDCurrencyEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDCurrencyEntity.FLD_NAME_CurrencyID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDCurrencyEntityList = FCCMDCurrency.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDCurrencyEntityList ?? new List <MDCurrencyEntity>());
        }
Пример #2
0
        private void SaveMDCurrencyEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDCurrencyEntity mDCurrencyEntity = BuildMDCurrencyEntity();

                    Int64 result = -1;

                    if (mDCurrencyEntity.IsNew)
                    {
                        result = FCCMDCurrency.GetFacadeCreate().Add(mDCurrencyEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDCurrencyEntity.FLD_NAME_CurrencyID, mDCurrencyEntity.CurrencyID.ToString(), SQLMatchType.Equal);
                        result = FCCMDCurrency.GetFacadeCreate().Update(mDCurrencyEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _CurrencyID       = 0;
                        _MDCurrencyEntity = new MDCurrencyEntity();
                        PrepareInitialView();
                        BindMDCurrencyList();

                        if (mDCurrencyEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Currency Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Currency Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDCurrencyEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Currency Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Currency Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Пример #3
0
        protected void lvMDCurrency_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 CurrencyID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDCurrencyEntity.FLD_NAME_CurrencyID, CurrencyID.ToString(), SQLMatchType.Equal);

                        MDCurrencyEntity mDCurrencyEntity = new MDCurrencyEntity();


                        result = FCCMDCurrency.GetFacadeCreate().Delete(mDCurrencyEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _CurrencyID       = 0;
                            _MDCurrencyEntity = new MDCurrencyEntity();
                            PrepareInitialView();
                            BindMDCurrencyList();

                            MiscUtil.ShowMessage(lblMessage, "Currency has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Currency.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Пример #4
0
        public IList <MDCurrencyEntity> GetData()
        {
            IList <MDCurrencyEntity> mDCurrencyEntityList = new List <MDCurrencyEntity>();

            try
            {
                mDCurrencyEntityList = FCCMDCurrency.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDCurrencyEntityList ?? new List <MDCurrencyEntity>());
        }