Esempio n. 1
0
        public IList <MDZoneEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <MDZoneEntity> mDZoneEntityList = new List <MDZoneEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDZoneEntity.FLD_NAME_ZoneID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDZoneEntityList = FCCMDZone.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDZoneEntityList ?? new List <MDZoneEntity>());
        }
Esempio n. 2
0
        private void SaveMDZoneEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDZoneEntity mDZoneEntity = BuildMDZoneEntity();

                    Int64 result = -1;

                    if (mDZoneEntity.IsNew)
                    {
                        result = FCCMDZone.GetFacadeCreate().Add(mDZoneEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDZoneEntity.FLD_NAME_ZoneID, mDZoneEntity.ZoneID.ToString(), SQLMatchType.Equal);
                        result = FCCMDZone.GetFacadeCreate().Update(mDZoneEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _ZoneID       = 0;
                        _MDZoneEntity = new MDZoneEntity();
                        PrepareInitialView();
                        BindMDZoneList();

                        if (mDZoneEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Zone Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Zone Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDZoneEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Zone Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Zone Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Esempio n. 3
0
        protected void lvMDZone_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ZoneID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDZoneEntity.FLD_NAME_ZoneID, ZoneID.ToString(), SQLMatchType.Equal);

                        MDZoneEntity mDZoneEntity = new MDZoneEntity();


                        result = FCCMDZone.GetFacadeCreate().Delete(mDZoneEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _ZoneID       = 0;
                            _MDZoneEntity = new MDZoneEntity();
                            PrepareInitialView();
                            BindMDZoneList();

                            MiscUtil.ShowMessage(lblMessage, "Zone has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Zone.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Esempio n. 4
0
        public IList <MDZoneEntity> GetData()
        {
            IList <MDZoneEntity> mDZoneEntityList = new List <MDZoneEntity>();

            try
            {
                mDZoneEntityList = FCCMDZone.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDZoneEntityList ?? new List <MDZoneEntity>());
        }