Beispiel #1
0
        public IList <CRMMDAdvertiseWayEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <CRMMDAdvertiseWayEntity> cRMMDAdvertiseWayEntityList = new List <CRMMDAdvertiseWayEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = CRMMDAdvertiseWayEntity.FLD_NAME_AdvertiseWayID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                cRMMDAdvertiseWayEntityList = FCCCRMMDAdvertiseWay.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(cRMMDAdvertiseWayEntityList ?? new List <CRMMDAdvertiseWayEntity>());
        }
        private void SaveCRMMDAdvertiseWayEntity()
        {
            if (IsValid)
            {
                try
                {
                    CRMMDAdvertiseWayEntity cRMMDAdvertiseWayEntity = BuildCRMMDAdvertiseWayEntity();

                    Int64 result = -1;

                    if (cRMMDAdvertiseWayEntity.IsNew)
                    {
                        result = FCCCRMMDAdvertiseWay.GetFacadeCreate().Add(cRMMDAdvertiseWayEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CRMMDAdvertiseWayEntity.FLD_NAME_AdvertiseWayID, cRMMDAdvertiseWayEntity.AdvertiseWayID.ToString(), SQLMatchType.Equal);
                        result = FCCCRMMDAdvertiseWay.GetFacadeCreate().Update(cRMMDAdvertiseWayEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _AdvertiseWayID          = 0;
                        _CRMMDAdvertiseWayEntity = new CRMMDAdvertiseWayEntity();
                        PrepareInitialView();
                        BindCRMMDAdvertiseWayList();

                        if (cRMMDAdvertiseWayEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "C RMAdvertise Way Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "C RMAdvertise Way Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cRMMDAdvertiseWayEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add C RMAdvertise Way Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update C RMAdvertise Way Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvCRMMDAdvertiseWay_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 AdvertiseWayID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CRMMDAdvertiseWayEntity.FLD_NAME_AdvertiseWayID, AdvertiseWayID.ToString(), SQLMatchType.Equal);

                        CRMMDAdvertiseWayEntity cRMMDAdvertiseWayEntity = new CRMMDAdvertiseWayEntity();


                        result = FCCCRMMDAdvertiseWay.GetFacadeCreate().Delete(cRMMDAdvertiseWayEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _AdvertiseWayID          = 0;
                            _CRMMDAdvertiseWayEntity = new CRMMDAdvertiseWayEntity();
                            PrepareInitialView();
                            BindCRMMDAdvertiseWayList();

                            MiscUtil.ShowMessage(lblMessage, "C RMAdvertise Way has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete C RMAdvertise Way.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Beispiel #4
0
        public IList <CRMMDAdvertiseWayEntity> GetData()
        {
            IList <CRMMDAdvertiseWayEntity> cRMMDAdvertiseWayEntityList = new List <CRMMDAdvertiseWayEntity>();

            try
            {
                cRMMDAdvertiseWayEntityList = FCCCRMMDAdvertiseWay.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(cRMMDAdvertiseWayEntityList ?? new List <CRMMDAdvertiseWayEntity>());
        }