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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDSupervisorTypeEntity.FLD_NAME_SupervisorTypeID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDSupervisorTypeEntityList = FCCMDSupervisorType.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDSupervisorTypeEntityList ?? new List <MDSupervisorTypeEntity>());
        }
예제 #2
0
        private void SaveMDSupervisorTypeEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDSupervisorTypeEntity mDSupervisorTypeEntity = BuildMDSupervisorTypeEntity();

                    Int64 result = -1;

                    if (mDSupervisorTypeEntity.IsNew)
                    {
                        result = FCCMDSupervisorType.GetFacadeCreate().Add(mDSupervisorTypeEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDSupervisorTypeEntity.FLD_NAME_SupervisorTypeID, mDSupervisorTypeEntity.SupervisorTypeID.ToString(), SQLMatchType.Equal);
                        result = FCCMDSupervisorType.GetFacadeCreate().Update(mDSupervisorTypeEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _SupervisorTypeID       = 0;
                        _MDSupervisorTypeEntity = new MDSupervisorTypeEntity();
                        PrepareInitialView();
                        BindMDSupervisorTypeList();

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

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDSupervisorTypeEntity.FLD_NAME_SupervisorTypeID, SupervisorTypeID.ToString(), SQLMatchType.Equal);

                        MDSupervisorTypeEntity mDSupervisorTypeEntity = new MDSupervisorTypeEntity();


                        result = FCCMDSupervisorType.GetFacadeCreate().Delete(mDSupervisorTypeEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _SupervisorTypeID       = 0;
                            _MDSupervisorTypeEntity = new MDSupervisorTypeEntity();
                            PrepareInitialView();
                            BindMDSupervisorTypeList();

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

            try
            {
                mDSupervisorTypeEntityList = FCCMDSupervisorType.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDSupervisorTypeEntityList ?? new List <MDSupervisorTypeEntity>());
        }