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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = CRMBuyerChildrenInfoEntity.FLD_NAME_BuyerChildrenInfoID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                cRMBuyerChildrenInfoEntityList = FCCCRMBuyerChildrenInfo.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(cRMBuyerChildrenInfoEntityList ?? new List <CRMBuyerChildrenInfoEntity>());
        }
        private void SaveCRMBuyerChildrenInfoEntity()
        {
            if (IsValid)
            {
                try
                {
                    CRMBuyerChildrenInfoEntity cRMBuyerChildrenInfoEntity = BuildCRMBuyerChildrenInfoEntity();

                    Int64 result = -1;

                    if (cRMBuyerChildrenInfoEntity.IsNew)
                    {
                        result = FCCCRMBuyerChildrenInfo.GetFacadeCreate().Add(cRMBuyerChildrenInfoEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CRMBuyerChildrenInfoEntity.FLD_NAME_BuyerChildrenInfoID, cRMBuyerChildrenInfoEntity.BuyerChildrenInfoID.ToString(), SQLMatchType.Equal);
                        result = FCCCRMBuyerChildrenInfo.GetFacadeCreate().Update(cRMBuyerChildrenInfoEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _BuyerChildrenInfoID        = 0;
                        _CRMBuyerChildrenInfoEntity = new CRMBuyerChildrenInfoEntity();
                        PrepareInitialView();
                        BindCRMBuyerChildrenInfoList();

                        if (cRMBuyerChildrenInfoEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Buyer Children Info Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Buyer Children Info Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cRMBuyerChildrenInfoEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Buyer Children Info Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Buyer Children Info Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvCRMBuyerChildrenInfo_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 BuyerChildrenInfoID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMBuyerChildrenInfoEntity.FLD_NAME_BuyerChildrenInfoID, BuyerChildrenInfoID.ToString(), SQLMatchType.Equal);

                        CRMBuyerChildrenInfoEntity cRMBuyerChildrenInfoEntity = new CRMBuyerChildrenInfoEntity();


                        result = FCCCRMBuyerChildrenInfo.GetFacadeCreate().Delete(cRMBuyerChildrenInfoEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _BuyerChildrenInfoID        = 0;
                            _CRMBuyerChildrenInfoEntity = new CRMBuyerChildrenInfoEntity();
                            PrepareInitialView();
                            BindCRMBuyerChildrenInfoList();

                            MiscUtil.ShowMessage(lblMessage, "Buyer Children Info has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Buyer Children Info.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <CRMBuyerChildrenInfoEntity> GetData()
        {
            IList <CRMBuyerChildrenInfoEntity> cRMBuyerChildrenInfoEntityList = new List <CRMBuyerChildrenInfoEntity>();

            try
            {
                cRMBuyerChildrenInfoEntityList = FCCCRMBuyerChildrenInfo.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(cRMBuyerChildrenInfoEntityList ?? new List <CRMBuyerChildrenInfoEntity>());
        }