public IList <MDSupplierAddressTypeEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <MDSupplierAddressTypeEntity> mDSupplierAddressTypeEntityList = new List <MDSupplierAddressTypeEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDSupplierAddressTypeEntity.FLD_NAME_SupplierAddressTypeID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDSupplierAddressTypeEntityList = FCCMDSupplierAddressType.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDSupplierAddressTypeEntityList ?? new List <MDSupplierAddressTypeEntity>());
        }
        private void SaveMDSupplierAddressTypeEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDSupplierAddressTypeEntity mDSupplierAddressTypeEntity = BuildMDSupplierAddressTypeEntity();

                    Int64 result = -1;

                    if (mDSupplierAddressTypeEntity.IsNew)
                    {
                        result = FCCMDSupplierAddressType.GetFacadeCreate().Add(mDSupplierAddressTypeEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDSupplierAddressTypeEntity.FLD_NAME_SupplierAddressTypeID, mDSupplierAddressTypeEntity.SupplierAddressTypeID.ToString(), SQLMatchType.Equal);
                        result = FCCMDSupplierAddressType.GetFacadeCreate().Update(mDSupplierAddressTypeEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _SupplierAddressTypeID       = 0;
                        _MDSupplierAddressTypeEntity = new MDSupplierAddressTypeEntity();
                        PrepareInitialView();
                        BindMDSupplierAddressTypeList();

                        if (mDSupplierAddressTypeEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Vendor Address Type Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Vendor Address Type Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDSupplierAddressTypeEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Vendor Address Type Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Vendor Address Type Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvMDSupplierAddressType_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 SupplierAddressTypeID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDSupplierAddressTypeEntity.FLD_NAME_SupplierAddressTypeID, SupplierAddressTypeID.ToString(), SQLMatchType.Equal);

                        MDSupplierAddressTypeEntity mDSupplierAddressTypeEntity = new MDSupplierAddressTypeEntity();


                        result = FCCMDSupplierAddressType.GetFacadeCreate().Delete(mDSupplierAddressTypeEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _SupplierAddressTypeID       = 0;
                            _MDSupplierAddressTypeEntity = new MDSupplierAddressTypeEntity();
                            PrepareInitialView();
                            BindMDSupplierAddressTypeList();

                            MiscUtil.ShowMessage(lblMessage, "Vendor Address Type has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Vendor Address Type.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <MDSupplierAddressTypeEntity> GetData()
        {
            IList <MDSupplierAddressTypeEntity> mDSupplierAddressTypeEntityList = new List <MDSupplierAddressTypeEntity>();

            try
            {
                mDSupplierAddressTypeEntityList = FCCMDSupplierAddressType.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDSupplierAddressTypeEntityList ?? new List <MDSupplierAddressTypeEntity>());
        }