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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = OTScheduleResourceEntity.FLD_NAME_OTScheduleResourceID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                oTScheduleResourceEntityList = FCCOTScheduleResource.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(oTScheduleResourceEntityList ?? new List <OTScheduleResourceEntity>());
        }
예제 #2
0
        private void SaveOTScheduleResourceEntity()
        {
            if (IsValid)
            {
                try
                {
                    OTScheduleResourceEntity oTScheduleResourceEntity = BuildOTScheduleResourceEntity();

                    Int64 result = -1;

                    if (oTScheduleResourceEntity.IsNew)
                    {
                        result = FCCOTScheduleResource.GetFacadeCreate().Add(oTScheduleResourceEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(OTScheduleResourceEntity.FLD_NAME_OTScheduleResourceID, oTScheduleResourceEntity.OTScheduleResourceID.ToString(), SQLMatchType.Equal);
                        result = FCCOTScheduleResource.GetFacadeCreate().Update(oTScheduleResourceEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _OTScheduleResourceID     = 0;
                        _OTScheduleResourceEntity = new OTScheduleResourceEntity();
                        PrepareInitialView();
                        BindOTScheduleResourceList();

                        if (oTScheduleResourceEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "O TSchedule Resource Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "O TSchedule Resource Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (oTScheduleResourceEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add O TSchedule Resource Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update O TSchedule Resource Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
예제 #3
0
        protected void lvOTScheduleResource_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 OTScheduleResourceID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(OTScheduleResourceEntity.FLD_NAME_OTScheduleResourceID, OTScheduleResourceID.ToString(), SQLMatchType.Equal);

                        OTScheduleResourceEntity oTScheduleResourceEntity = new OTScheduleResourceEntity();


                        result = FCCOTScheduleResource.GetFacadeCreate().Delete(oTScheduleResourceEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _OTScheduleResourceID     = 0;
                            _OTScheduleResourceEntity = new OTScheduleResourceEntity();
                            PrepareInitialView();
                            BindOTScheduleResourceList();

                            MiscUtil.ShowMessage(lblMessage, "O TSchedule Resource has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete O TSchedule Resource.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
예제 #4
0
        public IList <OTScheduleResourceEntity> GetData()
        {
            IList <OTScheduleResourceEntity> oTScheduleResourceEntityList = new List <OTScheduleResourceEntity>();

            try
            {
                oTScheduleResourceEntityList = FCCOTScheduleResource.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(oTScheduleResourceEntityList ?? new List <OTScheduleResourceEntity>());
        }