public IList <ACPettyCashEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <ACPettyCashEntity> aCPettyCashEntityList = new List <ACPettyCashEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = ACPettyCashEntity.FLD_NAME_ACPettyCashID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                aCPettyCashEntityList = FCCACPettyCash.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(aCPettyCashEntityList ?? new List <ACPettyCashEntity>());
        }
Exemple #2
0
        private void SaveACPettyCashEntity()
        {
            if (IsValid)
            {
                try
                {
                    ACPettyCashEntity aCPettyCashEntity = BuildACPettyCashEntity();

                    Int64 result = -1;

                    if (aCPettyCashEntity.IsNew)
                    {
                        result = FCCACPettyCash.GetFacadeCreate().Add(aCPettyCashEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(ACPettyCashEntity.FLD_NAME_ACPettyCashID, aCPettyCashEntity.ACPettyCashID.ToString(), SQLMatchType.Equal);
                        result = FCCACPettyCash.GetFacadeCreate().Update(aCPettyCashEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _ACPettyCashID     = 0;
                        _ACPettyCashEntity = new ACPettyCashEntity();
                        PrepareInitialView();
                        BindACPettyCashList();

                        if (aCPettyCashEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "A CPetty Cash Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "A CPetty Cash Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (aCPettyCashEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add A CPetty Cash Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update A CPetty Cash Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Exemple #3
0
        protected void lvACPettyCash_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ACPettyCashID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(ACPettyCashEntity.FLD_NAME_ACPettyCashID, ACPettyCashID.ToString(), SQLMatchType.Equal);

                        ACPettyCashEntity aCPettyCashEntity = new ACPettyCashEntity();


                        result = FCCACPettyCash.GetFacadeCreate().Delete(aCPettyCashEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _ACPettyCashID     = 0;
                            _ACPettyCashEntity = new ACPettyCashEntity();
                            PrepareInitialView();
                            BindACPettyCashList();

                            MiscUtil.ShowMessage(lblMessage, "A CPetty Cash has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete A CPetty Cash.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <ACPettyCashEntity> GetData()
        {
            IList <ACPettyCashEntity> aCPettyCashEntityList = new List <ACPettyCashEntity>();

            try
            {
                aCPettyCashEntityList = FCCACPettyCash.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(aCPettyCashEntityList ?? new List <ACPettyCashEntity>());
        }