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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDApprovalProcessPriorityEntity.FLD_NAME_ApprovalProcessPriorityID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDApprovalProcessPriorityEntityList = FCCMDApprovalProcessPriority.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDApprovalProcessPriorityEntityList ?? new List <MDApprovalProcessPriorityEntity>());
        }
        private void SaveMDApprovalProcessPriorityEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDApprovalProcessPriorityEntity mDApprovalProcessPriorityEntity = BuildMDApprovalProcessPriorityEntity();

                    Int64 result = -1;

                    if (mDApprovalProcessPriorityEntity.IsNew)
                    {
                        result = FCCMDApprovalProcessPriority.GetFacadeCreate().Add(mDApprovalProcessPriorityEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDApprovalProcessPriorityEntity.FLD_NAME_ApprovalProcessPriorityID, mDApprovalProcessPriorityEntity.ApprovalProcessPriorityID.ToString(), SQLMatchType.Equal);
                        result = FCCMDApprovalProcessPriority.GetFacadeCreate().Update(mDApprovalProcessPriorityEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _ApprovalProcessPriorityID       = 0;
                        _MDApprovalProcessPriorityEntity = new MDApprovalProcessPriorityEntity();
                        PrepareInitialView();
                        BindMDApprovalProcessPriorityList();

                        if (mDApprovalProcessPriorityEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Approval Process Priority Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Approval Process Priority Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDApprovalProcessPriorityEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Approval Process Priority Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Approval Process Priority Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvMDApprovalProcessPriority_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ApprovalProcessPriorityID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDApprovalProcessPriorityEntity.FLD_NAME_ApprovalProcessPriorityID, ApprovalProcessPriorityID.ToString(), SQLMatchType.Equal);

                        MDApprovalProcessPriorityEntity mDApprovalProcessPriorityEntity = new MDApprovalProcessPriorityEntity();


                        result = FCCMDApprovalProcessPriority.GetFacadeCreate().Delete(mDApprovalProcessPriorityEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _ApprovalProcessPriorityID       = 0;
                            _MDApprovalProcessPriorityEntity = new MDApprovalProcessPriorityEntity();
                            PrepareInitialView();
                            BindMDApprovalProcessPriorityList();

                            MiscUtil.ShowMessage(lblMessage, "Approval Process Priority has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Approval Process Priority.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <MDApprovalProcessPriorityEntity> GetData()
        {
            IList <MDApprovalProcessPriorityEntity> mDApprovalProcessPriorityEntityList = new List <MDApprovalProcessPriorityEntity>();

            try
            {
                mDApprovalProcessPriorityEntityList = FCCMDApprovalProcessPriority.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDApprovalProcessPriorityEntityList ?? new List <MDApprovalProcessPriorityEntity>());
        }