예제 #1
0
        public IList <MDRegionEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <MDRegionEntity> mDRegionEntityList = new List <MDRegionEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDRegionEntity.FLD_NAME_RegionID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDRegionEntityList = FCCMDRegion.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDRegionEntityList ?? new List <MDRegionEntity>());
        }
예제 #2
0
        private void SaveMDRegionEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDRegionEntity mDRegionEntity = BuildMDRegionEntity();

                    Int64 result = -1;

                    if (mDRegionEntity.IsNew)
                    {
                        result = FCCMDRegion.GetFacadeCreate().Add(mDRegionEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDRegionEntity.FLD_NAME_RegionID, mDRegionEntity.RegionID.ToString(), SQLMatchType.Equal);
                        result = FCCMDRegion.GetFacadeCreate().Update(mDRegionEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _RegionID       = 0;
                        _MDRegionEntity = new MDRegionEntity();
                        PrepareInitialView();
                        BindMDRegionList();

                        if (mDRegionEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Region Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Region Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDRegionEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Region Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Region Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
예제 #3
0
        protected void lvMDRegion_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 RegionID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDRegionEntity.FLD_NAME_RegionID, RegionID.ToString(), SQLMatchType.Equal);

                        MDRegionEntity mDRegionEntity = new MDRegionEntity();


                        result = FCCMDRegion.GetFacadeCreate().Delete(mDRegionEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _RegionID       = 0;
                            _MDRegionEntity = new MDRegionEntity();
                            PrepareInitialView();
                            BindMDRegionList();

                            MiscUtil.ShowMessage(lblMessage, "Region has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Region.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
예제 #4
0
        public IList <MDRegionEntity> GetData()
        {
            IList <MDRegionEntity> mDRegionEntityList = new List <MDRegionEntity>();

            try
            {
                mDRegionEntityList = FCCMDRegion.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDRegionEntityList ?? new List <MDRegionEntity>());
        }