示例#1
0
        public IList <CRMSurveyOwnerEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <CRMSurveyOwnerEntity> cRMSurveyOwnerEntityList = new List <CRMSurveyOwnerEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = CRMSurveyOwnerEntity.FLD_NAME_SurveyOwnerID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                cRMSurveyOwnerEntityList = FCCCRMSurveyOwner.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(cRMSurveyOwnerEntityList ?? new List <CRMSurveyOwnerEntity>());
        }
        private void SaveCRMSurveyOwnerEntity()
        {
            if (IsValid)
            {
                try
                {
                    CRMSurveyOwnerEntity cRMSurveyOwnerEntity = BuildCRMSurveyOwnerEntity();

                    Int64 result = -1;

                    if (cRMSurveyOwnerEntity.IsNew)
                    {
                        result = FCCCRMSurveyOwner.GetFacadeCreate().Add(cRMSurveyOwnerEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CRMSurveyOwnerEntity.FLD_NAME_SurveyOwnerID, cRMSurveyOwnerEntity.SurveyOwnerID.ToString(), SQLMatchType.Equal);
                        result = FCCCRMSurveyOwner.GetFacadeCreate().Update(cRMSurveyOwnerEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _SurveyOwnerID        = 0;
                        _CRMSurveyOwnerEntity = new CRMSurveyOwnerEntity();
                        PrepareInitialView();
                        BindCRMSurveyOwnerList();

                        if (cRMSurveyOwnerEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "C RMSurvey Owner Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "C RMSurvey Owner Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cRMSurveyOwnerEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add C RMSurvey Owner Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update C RMSurvey Owner Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvCRMSurveyOwner_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 SurveyOwnerID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMSurveyOwnerEntity.FLD_NAME_SurveyOwnerID, SurveyOwnerID.ToString(), SQLMatchType.Equal);

                        CRMSurveyOwnerEntity cRMSurveyOwnerEntity = new CRMSurveyOwnerEntity();


                        result = FCCCRMSurveyOwner.GetFacadeCreate().Delete(cRMSurveyOwnerEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _SurveyOwnerID        = 0;
                            _CRMSurveyOwnerEntity = new CRMSurveyOwnerEntity();
                            PrepareInitialView();
                            BindCRMSurveyOwnerList();

                            MiscUtil.ShowMessage(lblMessage, "C RMSurvey Owner has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete C RMSurvey Owner.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
示例#4
0
        public IList <CRMSurveyOwnerEntity> GetData()
        {
            IList <CRMSurveyOwnerEntity> cRMSurveyOwnerEntityList = new List <CRMSurveyOwnerEntity>();

            try
            {
                cRMSurveyOwnerEntityList = FCCCRMSurveyOwner.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(cRMSurveyOwnerEntityList ?? new List <CRMSurveyOwnerEntity>());
        }