Exemplo n.º 1
0
        //
        // GET: /VesselSchedule/Create
        public ActionResult Create()
        {
            var viewModel = new VesselScheduleViewModel();

            viewModel.SalesTypes = _selectService.GetSelect(new GetSelectRequest {
                Name = "vessel-schedule-sales-types"
            }).Options
                                   .Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value
            }).ToList();
            viewModel.Buyers = _buyerService.GetBuyers(new GetBuyersRequest
            {
                Skip = 0,
                Take = 100
            }).Buyers.OrderBy(x => x.Name).Select(x => new SelectListItem {
                Text = x.Name, Value = x.id.ToString()
            }).ToList();
            viewModel.Vessels = _vesselService.GetVessels(new GetVesselsRequest
            {
                Skip = 0,
                Take = 100
            }).Vessels.OrderBy(x => x.Name).Select(x => new SelectListItem {
                Text = x.Name, Value = x.id.ToString()
            }).ToList();
            viewModel.IsActive = true;
            return(PartialView(viewModel));
        }
Exemplo n.º 2
0
        public ActionResult Update(int id)
        {
            var response = _selectService.GetSelect(new GetSelectRequest {
                Id = id
            });
            var viewModel = response.MapTo <UpdateSelectViewModel>();

            foreach (var name in Enum.GetNames(typeof(SelectType)))
            {
                viewModel.Types.Add(new SelectListItem {
                    Text = name, Value = name
                });
            }
            viewModel.Parents = _selectService.GetSelects(new GetSelectsRequest())
                                .Selects.Select(x => new SelectListItem {
                Value = x.Id.ToString(), Text = x.Name.ToString()
            }).ToList();
            if (viewModel.ParentId != 0)
            {
                viewModel.ParentOptions = response.ParentOptions.Select(x => new SelectListItem {
                    Value = x.Id.ToString(), Text = x.Text.ToString()
                }).ToList();
            }
            viewModel.Parents.Insert(0, new SelectListItem {
                Value = "0", Text = "No Parent"
            });
            return(View(viewModel));
        }
Exemplo n.º 3
0
        public ActionResult Create()
        {
            var viewModel = new TemplateViewModel();

            foreach (var name in Enum.GetNames(typeof(PeriodeType)))
            {
                if (!name.Equals("Hourly") && !name.Equals("Weekly") && !name.Equals("Itd"))
                {
                    viewModel.PeriodeTypes.Add(new SelectListItem {
                        Text = name, Value = name
                    });
                }
            }
            var forbidenTypes = new string[] { "Alert" };

            viewModel.HighlightTypes = _selectService.GetSelect(new GetSelectRequest {
                Name = "highlight-types"
            }).Options
                                       .Select(x => new SelectListItem {
                Text = x.Text, Value = x.Id.ToString()
            }).Where(x => !x.Text.ToLower().Contains("indicator") &&
                     !forbidenTypes.Contains(x.Text) &&
                     !x.Text.ToLower().Contains("edg") &&
                     !x.Text.ToLower().Contains("gtg")).ToList();
            foreach (var name in Enum.GetNames(typeof(TemplateColumnType)))
            {
                viewModel.ColumnTypes.Add(new SelectListItem {
                    Text = name, Value = name
                });
            }
            return(View(viewModel));
        }
Exemplo n.º 4
0
        //
        // GET: /Highlight/Create
        public ActionResult Create()
        {
            ViewBag.TurnOffDevexpress = true;
            var viewModel = new HighlightViewModel();
            foreach (var name in Enum.GetNames(typeof(PeriodeType)))
            {
                if (!name.Equals("Hourly") && !name.Equals("Weekly"))
                {
                    viewModel.PeriodeTypes.Add(new SelectListItem { Text = name, Value = name });
                }
            }
            viewModel.Types = _selectService.GetSelect(new GetSelectRequest { Name = "highlight-types" }).Options
                .Select(x => new SelectListItem { Text = x.Text, Value = x.Id.ToString() }).ToList();
            //viewModel.AlertConditions = _selectService.GetSelect(new GetSelectRequest { Name = "alert-conditions" }).Options
            //    .Select(x => new SelectListItem { Text = x.Text, Value = x.Value }).ToList();

            var TypeId = string.IsNullOrEmpty(Request.QueryString["TypeId"]) ? 0 : int.Parse(Request.QueryString["TypeId"]);
            var PeriodeType = string.IsNullOrEmpty(Request.QueryString["PeriodeType"]) ? "Daily"
                : Request.QueryString["PeriodeType"];
            var periodeQS = !string.IsNullOrEmpty(Request.QueryString["Periode"]) ? Request.QueryString["Periode"] : null;
            viewModel.TypeId = TypeId;
            viewModel.PeriodeType = PeriodeType;
            switch (PeriodeType)
            {
                case "Monthly":
                    viewModel.PeriodeType = PeriodeType;
                    if (!string.IsNullOrEmpty(periodeQS))
                    {
                        viewModel.Date = DateTime.ParseExact("01/" + periodeQS, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                    }

                    break;
                case "Yearly":
                    viewModel.PeriodeType = PeriodeType;
                    if (!string.IsNullOrEmpty(periodeQS))
                    {
                        viewModel.Date = DateTime.ParseExact("01/01/" + periodeQS, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                    }

                    break;
                default:
                    viewModel.PeriodeType = PeriodeType;
                    if (!string.IsNullOrEmpty(periodeQS))
                    {
                        viewModel.Date = DateTime.ParseExact(periodeQS, "MM/dd/yyyy", CultureInfo.InvariantCulture);
                    }

                    break;
            }

            return View(viewModel);
        }
Exemplo n.º 5
0
        //
        // GET: /VesselSchedule/Create
        public ActionResult Create()
        {
            var viewModel = new VesselScheduleViewModel();

            viewModel.SalesTypes = _selectService.GetSelect(new GetSelectRequest {
                Name = "vessel-schedule-sales-types"
            }).Options
                                   .Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value
            }).ToList();
            viewModel.IsActive = true;
            return(View(viewModel));
        }
Exemplo n.º 6
0
        public ActionResult Create()
        {
            var viewModel = new WeatherViewModel();

            foreach (var name in Enum.GetNames(typeof(PeriodeType)))
            {
                if (!name.Equals("Hourly") && !name.Equals("Weekly"))
                {
                    viewModel.PeriodeTypes.Add(new SelectListItem {
                        Text = name, Value = name
                    });
                }
            }
            viewModel.Values = _selectService.GetSelect(new GetSelectRequest {
                Name = "weather-values"
            }).Options
                               .Select(x => new SelectListItem {
                Value = x.Id.ToString(), Text = x.Text
            }).ToList();
            return(View(viewModel));
        }
        public ActionResult QhsseSection(string date)
        {
            var viewModel = GetDerValuesPerSection(date,
                                                   new int[] { 273, 274, 275, 276, 1, 177, 278, 277, 285, 356, 4, 359, 286, 292, 421, 422, 284, 357, 358, 435, 436,
                                                               /*CR Sept 2017*/ 504, 506, 507, 508, 509, 518, 511, 512, 513, 514, 515 }, //actual KpiIds
                                                   new int[] { 1, 177, 278, 277, 276, 285, 421, 422, 284, 357, 358,
                                                               /*CR Sept 2017*/ 504, 505, 506, 507, 508, 509, 518, 511, 514, 515 },      //target KpiIds
                                                   new int[] { 18, 13, 20, 7, 80, 59 } //highlightTypeIds
                                                   );
            var theDate = DateTime.ParseExact(date, "MM/dd/yyyy", CultureInfo.InvariantCulture);
            var wave    = _waveService.GetWave(new GetWaveRequest
            {
                Date   = theDate,
                ByDate = true
            });

            if (wave.Id != 0)
            {
                viewModel.Wave = wave.MapTo <WaveViewModel>();
                if (viewModel.Wave.ValueId != 0)
                {
                    viewModel.Wave.WindDirectValueType = "now";
                }

                if (!string.IsNullOrEmpty(viewModel.Wave.Tide))
                {
                    viewModel.Wave.TideValueType = "now";
                }

                if (!string.IsNullOrEmpty(viewModel.Wave.Speed))
                {
                    viewModel.Wave.SpeedValueType = "now";
                }
            }
            else
            {
                wave = _waveService.GetWave(new GetWaveRequest
                {
                    Date   = theDate.AddDays(-1),
                    ByDate = true
                });

                if (wave.Id != 0)
                {
                    viewModel.Wave = wave.MapTo <WaveViewModel>();

                    viewModel.Wave.WindDirectValueType = "prev";
                    viewModel.Wave.TideValueType       = "prev";
                    viewModel.Wave.SpeedValueType      = "prev";
                    viewModel.Wave.Id = 0;
                }
            }
            if (viewModel.Wave == null)
            {
                viewModel.Wave = new WaveViewModel();
            }
            viewModel.Wave.Values = _selectService.GetSelect(new GetSelectRequest {
                Name = "wave-values"
            }).Options
                                    .Select(x => new SelectListItem {
                Value = x.Id.ToString(), Text = x.Text
            }).ToList();
            var weather = _weatherService.GetWeather(new GetWeatherRequest
            {
                Date   = theDate,
                ByDate = true
            });

            if (weather.Id != 0)
            {
                viewModel.Weather = weather.MapTo <WeatherViewModel>();
                viewModel.Weather.DerValueType = "now";
            }
            else
            {
                weather = _weatherService.GetWeather(new GetWeatherRequest
                {
                    Date   = theDate.AddDays(-1),
                    ByDate = true
                });
                if (wave.Id != 0)
                {
                    viewModel.Weather = weather.MapTo <WeatherViewModel>();
                    viewModel.Weather.DerValueType = "prev";
                    viewModel.Weather.Id           = 0;
                }
            }
            if (viewModel.Weather == null)
            {
                viewModel.Weather = new WeatherViewModel();
            }
            viewModel.Weather.Values = _selectService.GetSelect(new GetSelectRequest {
                Name = "weather-values"
            }).Options
                                       .Select(x => new SelectListItem {
                Value = x.Id.ToString(), Text = x.Text
            }).ToList();
            viewModel.AlertOptions = _selectService.GetSelect(new GetSelectRequest {
                ParentName = "highlight-types", ParentOptionId = 7
            }).Options
                                     .Select(x => new SelectListItem {
                Value = x.Value, Text = x.Text
            }).ToList();
            return(View(viewModel));
        }