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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = CRMPaymentScheduleMapEntity.FLD_NAME_PaymentScheduleMapID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                cRMPaymentScheduleMapEntityList = FCCCRMPaymentScheduleMap.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(cRMPaymentScheduleMapEntityList ?? new List <CRMPaymentScheduleMapEntity>());
        }
        private void SaveCRMPaymentScheduleMapEntity()
        {
            if (IsValid)
            {
                try
                {
                    CRMPaymentScheduleMapEntity cRMPaymentScheduleMapEntity = BuildCRMPaymentScheduleMapEntity();

                    Int64 result = -1;

                    if (cRMPaymentScheduleMapEntity.IsNew)
                    {
                        result = FCCCRMPaymentScheduleMap.GetFacadeCreate().Add(cRMPaymentScheduleMapEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CRMPaymentScheduleMapEntity.FLD_NAME_PaymentScheduleMapID, cRMPaymentScheduleMapEntity.PaymentScheduleMapID.ToString(), SQLMatchType.Equal);
                        result = FCCCRMPaymentScheduleMap.GetFacadeCreate().Update(cRMPaymentScheduleMapEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _PaymentScheduleMapID        = 0;
                        _CRMPaymentScheduleMapEntity = new CRMPaymentScheduleMapEntity();
                        PrepareInitialView();
                        BindCRMPaymentScheduleMapList();

                        if (cRMPaymentScheduleMapEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "C RMPayment Schedule Map Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "C RMPayment Schedule Map Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cRMPaymentScheduleMapEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add C RMPayment Schedule Map Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update C RMPayment Schedule Map Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvCRMPaymentScheduleMap_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 PaymentScheduleMapID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMPaymentScheduleMapEntity.FLD_NAME_PaymentScheduleMapID, PaymentScheduleMapID.ToString(), SQLMatchType.Equal);

                        CRMPaymentScheduleMapEntity cRMPaymentScheduleMapEntity = new CRMPaymentScheduleMapEntity();


                        result = FCCCRMPaymentScheduleMap.GetFacadeCreate().Delete(cRMPaymentScheduleMapEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _PaymentScheduleMapID        = 0;
                            _CRMPaymentScheduleMapEntity = new CRMPaymentScheduleMapEntity();
                            PrepareInitialView();
                            BindCRMPaymentScheduleMapList();

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

            try
            {
                cRMPaymentScheduleMapEntityList = FCCCRMPaymentScheduleMap.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(cRMPaymentScheduleMapEntityList ?? new List <CRMPaymentScheduleMapEntity>());
        }