Example #1
0
        public IList <MDDMSOwnerTypeEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <MDDMSOwnerTypeEntity> mDDMSOwnerTypeEntityList = new List <MDDMSOwnerTypeEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDDMSOwnerTypeEntity.FLD_NAME_OwnerTypeID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDDMSOwnerTypeEntityList = FCCMDDMSOwnerType.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDDMSOwnerTypeEntityList ?? new List <MDDMSOwnerTypeEntity>());
        }
        private void SaveMDDMSOwnerTypeEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDDMSOwnerTypeEntity mDDMSOwnerTypeEntity = BuildMDDMSOwnerTypeEntity();

                    Int64 result = -1;

                    if (mDDMSOwnerTypeEntity.IsNew)
                    {
                        result = FCCMDDMSOwnerType.GetFacadeCreate().Add(mDDMSOwnerTypeEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDDMSOwnerTypeEntity.FLD_NAME_OwnerTypeID, mDDMSOwnerTypeEntity.OwnerTypeID.ToString(), SQLMatchType.Equal);
                        result = FCCMDDMSOwnerType.GetFacadeCreate().Update(mDDMSOwnerTypeEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _OwnerTypeID          = 0;
                        _MDDMSOwnerTypeEntity = new MDDMSOwnerTypeEntity();
                        PrepareInitialView();
                        BindMDDMSOwnerTypeList();

                        if (mDDMSOwnerTypeEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "D MSOwner Type Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "D MSOwner Type Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDDMSOwnerTypeEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add D MSOwner Type Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update D MSOwner Type Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvMDDMSOwnerType_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 OwnerTypeID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDDMSOwnerTypeEntity.FLD_NAME_OwnerTypeID, OwnerTypeID.ToString(), SQLMatchType.Equal);

                        MDDMSOwnerTypeEntity mDDMSOwnerTypeEntity = new MDDMSOwnerTypeEntity();


                        result = FCCMDDMSOwnerType.GetFacadeCreate().Delete(mDDMSOwnerTypeEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _OwnerTypeID          = 0;
                            _MDDMSOwnerTypeEntity = new MDDMSOwnerTypeEntity();
                            PrepareInitialView();
                            BindMDDMSOwnerTypeList();

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

            try
            {
                mDDMSOwnerTypeEntityList = FCCMDDMSOwnerType.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDDMSOwnerTypeEntityList ?? new List <MDDMSOwnerTypeEntity>());
        }