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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = BDProjectSubstationAndGeneratorEntity.FLD_NAME_ProjectSubstationAndGeneratorID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                bDProjectSubstationAndGeneratorEntityList = FCCBDProjectSubstationAndGenerator.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(bDProjectSubstationAndGeneratorEntityList ?? new List <BDProjectSubstationAndGeneratorEntity>());
        }
Exemplo n.º 2
0
        private void SaveBDProjectSubstationAndGeneratorEntity()
        {
            if (IsValid)
            {
                try
                {
                    BDProjectSubstationAndGeneratorEntity bDProjectSubstationAndGeneratorEntity = BuildBDProjectSubstationAndGeneratorEntity();

                    Int64 result = -1;

                    if (bDProjectSubstationAndGeneratorEntity.IsNew)
                    {
                        result = FCCBDProjectSubstationAndGenerator.GetFacadeCreate().Add(bDProjectSubstationAndGeneratorEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(BDProjectSubstationAndGeneratorEntity.FLD_NAME_ProjectSubstationAndGeneratorID, bDProjectSubstationAndGeneratorEntity.ProjectSubstationAndGeneratorID.ToString(), SQLMatchType.Equal);
                        result = FCCBDProjectSubstationAndGenerator.GetFacadeCreate().Update(bDProjectSubstationAndGeneratorEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _ProjectSubstationAndGeneratorID       = 0;
                        _BDProjectSubstationAndGeneratorEntity = new BDProjectSubstationAndGeneratorEntity();
                        PrepareInitialView();
                        PrepareEditView();
                        BindBDProjectSubstationAndGeneratorList();

                        if (bDProjectSubstationAndGeneratorEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Project Substation And Generator Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Project Substation And Generator Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (bDProjectSubstationAndGeneratorEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Project Substation And Generator Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Project Substation And Generator Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        public IList <BDProjectSubstationAndGeneratorEntity> GetData()
        {
            IList <BDProjectSubstationAndGeneratorEntity> bDProjectSubstationAndGeneratorEntityList = new List <BDProjectSubstationAndGeneratorEntity>();

            try
            {
                bDProjectSubstationAndGeneratorEntityList = FCCBDProjectSubstationAndGenerator.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(bDProjectSubstationAndGeneratorEntityList ?? new List <BDProjectSubstationAndGeneratorEntity>());
        }