Beispiel #1
0
        public IList <CMNFavoriteEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <CMNFavoriteEntity> cMNFavoriteEntityList = new List <CMNFavoriteEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = CMNFavoriteEntity.FLD_NAME_FavoriteID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                cMNFavoriteEntityList = FCCCMNFavorite.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(cMNFavoriteEntityList ?? new List <CMNFavoriteEntity>());
        }
Beispiel #2
0
        private void SaveCMNFavoriteEntity()
        {
            if (IsValid)
            {
                try
                {
                    CMNFavoriteEntity cMNFavoriteEntity = BuildCMNFavoriteEntity();

                    Int64 result = -1;

                    if (cMNFavoriteEntity.IsNew)
                    {
                        result = FCCCMNFavorite.GetFacadeCreate().Add(cMNFavoriteEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMNFavoriteEntity.FLD_NAME_FavoriteID, cMNFavoriteEntity.FavoriteID.ToString(), SQLMatchType.Equal);
                        result = FCCCMNFavorite.GetFacadeCreate().Update(cMNFavoriteEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _FavoriteID        = 0;
                        _CMNFavoriteEntity = new CMNFavoriteEntity();
                        PrepareInitialView();
                        BindCMNFavoriteList();

                        if (cMNFavoriteEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "C MNFavorite Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "C MNFavorite Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cMNFavoriteEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add C MNFavorite Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update C MNFavorite Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Beispiel #3
0
        protected void lvCMNFavorite_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 FavoriteID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CMNFavoriteEntity.FLD_NAME_FavoriteID, FavoriteID.ToString(), SQLMatchType.Equal);

                        CMNFavoriteEntity cMNFavoriteEntity = new CMNFavoriteEntity();


                        result = FCCCMNFavorite.GetFacadeCreate().Delete(cMNFavoriteEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _FavoriteID        = 0;
                            _CMNFavoriteEntity = new CMNFavoriteEntity();
                            PrepareInitialView();
                            BindCMNFavoriteList();

                            MiscUtil.ShowMessage(lblMessage, "C MNFavorite has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete C MNFavorite.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Beispiel #4
0
        public IList <CMNFavoriteEntity> GetData()
        {
            IList <CMNFavoriteEntity> cMNFavoriteEntityList = new List <CMNFavoriteEntity>();

            try
            {
                cMNFavoriteEntityList = FCCCMNFavorite.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(cMNFavoriteEntityList ?? new List <CMNFavoriteEntity>());
        }