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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDScheduleCategoryEntity.FLD_NAME_ScheduleCategoryID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDScheduleCategoryEntityList = FCCMDScheduleCategory.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDScheduleCategoryEntityList ?? new List <MDScheduleCategoryEntity>());
        }
        private void SaveMDScheduleCategoryEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDScheduleCategoryEntity mDScheduleCategoryEntity = BuildMDScheduleCategoryEntity();

                    Int64 result = -1;

                    if (mDScheduleCategoryEntity.IsNew)
                    {
                        result = FCCMDScheduleCategory.GetFacadeCreate().Add(mDScheduleCategoryEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDScheduleCategoryEntity.FLD_NAME_ScheduleCategoryID, mDScheduleCategoryEntity.ScheduleCategoryID.ToString(), SQLMatchType.Equal);
                        result = FCCMDScheduleCategory.GetFacadeCreate().Update(mDScheduleCategoryEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _ScheduleCategoryID       = 0;
                        _MDScheduleCategoryEntity = new MDScheduleCategoryEntity();
                        PrepareInitialView();
                        BindMDScheduleCategoryList();

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

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDScheduleCategoryEntity.FLD_NAME_ScheduleCategoryID, ScheduleCategoryID.ToString(), SQLMatchType.Equal);

                        MDScheduleCategoryEntity mDScheduleCategoryEntity = new MDScheduleCategoryEntity();


                        result = FCCMDScheduleCategory.GetFacadeCreate().Delete(mDScheduleCategoryEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _ScheduleCategoryID       = 0;
                            _MDScheduleCategoryEntity = new MDScheduleCategoryEntity();
                            PrepareInitialView();
                            BindMDScheduleCategoryList();

                            MiscUtil.ShowMessage(lblMessage, "Schedule Category has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Schedule Category.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <MDScheduleCategoryEntity> GetData()
        {
            IList <MDScheduleCategoryEntity> mDScheduleCategoryEntityList = new List <MDScheduleCategoryEntity>();

            try
            {
                mDScheduleCategoryEntityList = FCCMDScheduleCategory.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDScheduleCategoryEntityList ?? new List <MDScheduleCategoryEntity>());
        }