예제 #1
0
        private List <WellType> GetWellTypes()
        {
            var wellTypeList = new WellTypeServices().GetAllOrderedWellTypes() ?? new List <WellType>();

            if (!wellTypeList.Any())
            {
                return(new List <WellType>());
            }

            return(wellTypeList);
        }
        public ViewResult WellTypes()
        {
            var wellTypeList = new WellTypeServices().GetAllOrderedWellTypes() ?? new List <WellType>();

            if (!wellTypeList.Any())
            {
                ViewBag.Title = "Well Type SetUp";
                return(View(wellTypeList));
            }

            ViewBag.Title = "Manage Well Types";
            return(View(wellTypeList));
        }
예제 #3
0
        private List <WellType> GetWellTypes()
        {
            try
            {
                var wellTypes = new WellTypeServices().GetAllOrderedWellTypes() ?? new List <WellType>();

                if (!wellTypes.Any())
                {
                    return(new List <WellType>());
                }

                return(wellTypes);
            }
            catch (Exception ex)
            {
                ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message);
                return(new List <WellType>());
            }
        }
        public ViewResult WellWorkovers(string returnMsg = null, int returnCode = 0)
        {
            try
            {
                var wellWorkOverReasonList = GetWellWorkoverReasons();

                if (!wellWorkOverReasonList.Any())
                {
                    ViewBag.Title = "Well Workover Reason SetUp";
                    return(View("~/Views/WellWorkOverReason/WellWorkOverReasons.cshtml", wellWorkOverReasonList));
                }

                var equipmentList = GetEquipmets();

                if (!equipmentList.Any())
                {
                    ViewBag.Edit  = 0;
                    ViewBag.Title = "Equipment SetUp";
                    var equipmentTypeList = new EquipmentTypeServices().GetAllOrderedEquipmentTypes() ?? new List <EquipmentType>();

                    if (!equipmentTypeList.Any())
                    {
                        ViewBag.Edit  = 0;
                        ViewBag.Title = "Equipment Type SetUp";
                        return(View("~/Views/EquipmentType/EquipmentTypes.cshtml", new List <EquipmentType>()));
                    }
                    return(View("~/Views/Equipment/Equipments.cshtml", Tuple.Create(equipmentTypeList, new List <Equipment>())));
                }

                var wells = GetWells();
                if (!wells.Any())
                {
                    ViewBag.Edit  = 1;
                    ViewBag.Title = "Well Set Up";
                    var wellTypeList = new WellTypeServices().GetAllOrderedWellTypes() ?? new List <WellType>();

                    if (!wellTypeList.Any())
                    {
                        ViewBag.Edit  = 0;
                        ViewBag.Title = "Well Type Set Up";
                        return(View("~/Views/WellType/WellTypes.cshtml", new List <WellType>()));
                    }

                    var companyList = new CompanyServices().GetAllOrderedCompanies() ?? new List <Company>();
                    if (!companyList.Any())
                    {
                        ViewBag.Edit  = 0;
                        ViewBag.Title = "Company SetUp";
                        return(View("~/Views/Company/Companies.cshtml", new List <Company>()));
                    }
                    var wellClassList = GetWellClasses();
                    if (!wellClassList.Any())
                    {
                        ViewBag.Edit  = 0;
                        ViewBag.Title = "well Class Set Up";
                        return(View("~/Views/WellClass/WellClasses.cshtml", wellClassList));
                    }

                    return(View("~/Views/Well/Wells.cshtml", new WellViewModel {
                        WellTypes = wellTypeList, Companies = companyList, WellClasses = wellClassList, Wells = new List <Well>()
                    }));
                }

                var yearList  = GetYears();
                var monthList = GetMonths();
                int dataCount;
                var wellWorkOvers = GetWellWorkovers(ItemsPerPage, PageNumber, out dataCount);

                if (!wellWorkOvers.Any())
                {
                    ViewBag.Edit  = 1;
                    ViewBag.Title = "Well Workover SetUp";

                    return(View(new WellWorkoverViewModel
                    {
                        WellWorkOverReasons = wellWorkOverReasonList,
                        Equipments = equipmentList,
                        WellObjects = wells,
                        WellWorkOvers = new List <WellWorkover>()
                    }));
                }

                var txx = new WellWorkoverViewModel
                {
                    WellWorkOverReasons = wellWorkOverReasonList,
                    Equipments          = equipmentList,
                    WellObjects         = wells,
                    WellWorkOvers       = wellWorkOvers
                };

                ViewBag.Title            = "Manage Well Workovers";
                Session["_workoverPage"] = 1;
                return(View(txx));
            }
            catch (Exception ex)
            {
                ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message);
                var txx = new WellWorkoverViewModel
                {
                    WellWorkOverReasons = GetWellWorkoverReasons(),
                    Equipments          = GetEquipmets(),
                    WellObjects         = GetWells(),
                    WellWorkOvers       = new List <WellWorkover>()
                };

                ViewBag.Title = "Manage Well Workovers";
                return(View(txx));
            }
        }