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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDAddressTypeEntity.FLD_NAME_AddressTypeID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDAddressTypeEntityList = FCCMDAddressType.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDAddressTypeEntityList ?? new List <MDAddressTypeEntity>());
        }
Beispiel #2
0
        private void SaveMDAddressTypeEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDAddressTypeEntity mDAddressTypeEntity = BuildMDAddressTypeEntity();

                    Int64 result = -1;

                    if (mDAddressTypeEntity.IsNew)
                    {
                        result = FCCMDAddressType.GetFacadeCreate().Add(mDAddressTypeEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDAddressTypeEntity.FLD_NAME_AddressTypeID, mDAddressTypeEntity.AddressTypeID.ToString(), SQLMatchType.Equal);
                        result = FCCMDAddressType.GetFacadeCreate().Update(mDAddressTypeEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _AddressTypeID       = 0;
                        _MDAddressTypeEntity = new MDAddressTypeEntity();
                        PrepareInitialView();
                        BindMDAddressTypeList();

                        if (mDAddressTypeEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Address Type Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Address Type Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDAddressTypeEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Address Type Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Address Type Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Beispiel #3
0
        protected void lvMDAddressType_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 AddressTypeID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDAddressTypeEntity.FLD_NAME_AddressTypeID, AddressTypeID.ToString(), SQLMatchType.Equal);

                        MDAddressTypeEntity mDAddressTypeEntity = new MDAddressTypeEntity();


                        result = FCCMDAddressType.GetFacadeCreate().Delete(mDAddressTypeEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _AddressTypeID       = 0;
                            _MDAddressTypeEntity = new MDAddressTypeEntity();
                            PrepareInitialView();
                            BindMDAddressTypeList();

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

            try
            {
                mDAddressTypeEntityList = FCCMDAddressType.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDAddressTypeEntityList ?? new List <MDAddressTypeEntity>());
        }