Exemplo n.º 1
0
        public IList <CRMCommunicationEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <CRMCommunicationEntity> cRMCommunicationEntityList = new List <CRMCommunicationEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = CRMCommunicationEntity.FLD_NAME_CommunicationID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                cRMCommunicationEntityList = FCCCRMCommunication.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(cRMCommunicationEntityList ?? new List <CRMCommunicationEntity>());
        }
Exemplo n.º 2
0
        private void SaveCRMCommunicationEntity()
        {
            if (IsValid)
            {
                try
                {
                    CRMCommunicationEntity cRMCommunicationEntity = BuildCRMCommunicationEntity();

                    Int64 result = -1;

                    if (cRMCommunicationEntity.IsNew)
                    {
                        result = FCCCRMCommunication.GetFacadeCreate().Add(cRMCommunicationEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CRMCommunicationEntity.FLD_NAME_CommunicationID, cRMCommunicationEntity.CommunicationID.ToString(), SQLMatchType.Equal);
                        result = FCCCRMCommunication.GetFacadeCreate().Update(cRMCommunicationEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _CommunicationID        = 0;
                        _CRMCommunicationEntity = new CRMCommunicationEntity();
                        PrepareInitialView();
                        BindCRMCommunicationList();

                        if (cRMCommunicationEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Communication Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Communication Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cRMCommunicationEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Communication Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Communication Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Exemplo n.º 3
0
        protected void lvCRMCommunication_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 CommunicationID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMCommunicationEntity.FLD_NAME_CommunicationID, CommunicationID.ToString(), SQLMatchType.Equal);

                        CRMCommunicationEntity cRMCommunicationEntity = new CRMCommunicationEntity();


                        result = FCCCRMCommunication.GetFacadeCreate().Delete(cRMCommunicationEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _CommunicationID        = 0;
                            _CRMCommunicationEntity = new CRMCommunicationEntity();
                            PrepareInitialView();
                            BindCRMCommunicationList();

                            MiscUtil.ShowMessage(lblMessage, "Communication has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Communication.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Exemplo n.º 4
0
        public IList <CRMCommunicationEntity> GetData()
        {
            IList <CRMCommunicationEntity> cRMCommunicationEntityList = new List <CRMCommunicationEntity>();

            try
            {
                cRMCommunicationEntityList = FCCCRMCommunication.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(cRMCommunicationEntityList ?? new List <CRMCommunicationEntity>());
        }