예제 #1
0
        public IList <MDStandardTimeUnitEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <MDStandardTimeUnitEntity> mDStandardTimeUnitEntityList = new List <MDStandardTimeUnitEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = MDStandardTimeUnitEntity.FLD_NAME_StandardTimeUnitID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                mDStandardTimeUnitEntityList = FCCMDStandardTimeUnit.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(mDStandardTimeUnitEntityList ?? new List <MDStandardTimeUnitEntity>());
        }
예제 #2
0
        private void SaveMDStandardTimeUnitEntity()
        {
            if (IsValid)
            {
                try
                {
                    MDStandardTimeUnitEntity mDStandardTimeUnitEntity = BuildMDStandardTimeUnitEntity();

                    Int64 result = -1;

                    if (mDStandardTimeUnitEntity.IsNew)
                    {
                        result = FCCMDStandardTimeUnit.GetFacadeCreate().Add(mDStandardTimeUnitEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(MDStandardTimeUnitEntity.FLD_NAME_StandardTimeUnitID, mDStandardTimeUnitEntity.StandardTimeUnitID.ToString(), SQLMatchType.Equal);
                        result = FCCMDStandardTimeUnit.GetFacadeCreate().Update(mDStandardTimeUnitEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _StandardTimeUnitID       = 0;
                        _MDStandardTimeUnitEntity = new MDStandardTimeUnitEntity();
                        PrepareInitialView();
                        BindMDStandardTimeUnitList();

                        if (mDStandardTimeUnitEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Standard Time Unit Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Standard Time Unit Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (mDStandardTimeUnitEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Standard Time Unit Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Standard Time Unit Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
예제 #3
0
        protected void lvMDStandardTimeUnit_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 StandardTimeUnitID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDStandardTimeUnitEntity.FLD_NAME_StandardTimeUnitID, StandardTimeUnitID.ToString(), SQLMatchType.Equal);

                        MDStandardTimeUnitEntity mDStandardTimeUnitEntity = new MDStandardTimeUnitEntity();


                        result = FCCMDStandardTimeUnit.GetFacadeCreate().Delete(mDStandardTimeUnitEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _StandardTimeUnitID       = 0;
                            _MDStandardTimeUnitEntity = new MDStandardTimeUnitEntity();
                            PrepareInitialView();
                            BindMDStandardTimeUnitList();

                            MiscUtil.ShowMessage(lblMessage, "Standard Time Unit has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Standard Time Unit.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
예제 #4
0
        public IList <MDStandardTimeUnitEntity> GetData()
        {
            IList <MDStandardTimeUnitEntity> mDStandardTimeUnitEntityList = new List <MDStandardTimeUnitEntity>();

            try
            {
                mDStandardTimeUnitEntityList = FCCMDStandardTimeUnit.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(mDStandardTimeUnitEntityList ?? new List <MDStandardTimeUnitEntity>());
        }