public ActionResult RadarElementAdd()
        {
            var radarcategorylist = RadarService.GetRadarCategoryList().ToList();

            ViewData["RadarCategorylist"] = radarcategorylist.GetSelectList();
            return(View());
        }
        public ActionResult RadarCategoryAdd(RadarCategory model, FormCollection parameters)
        {
            var exist = dbContextService.Exists <RadarCategory>(x => x.Name == model.Name);

            if (exist)
            {
                TempData["errorMsg"] = "该分类已存在!";
                return(View());
            }

            var normallogoFile = Request.Files[Request.Files.Keys[0]];
            var hdlogoFile     = Request.Files[Request.Files.Keys[1]];

            var normallogoFilePath = GetNewsLogoFilePath <RadarCategory>(model, normallogoFile);
            var hdlogoFilePath     = GetNewsLogoFilePath <RadarCategory>(model, hdlogoFile);

            if (!string.IsNullOrEmpty(normallogoFilePath))
            {
                model.NormalLogoUrl = string.Format("{0}{1}", NEWS_LOGOS_IMAGE_PREFIX, Path.GetFileName(normallogoFilePath));
            }

            if (!string.IsNullOrEmpty(hdlogoFilePath))
            {
                model.HDLogoUrl = string.Format("{0}{1}", NEWS_LOGOS_IMAGE_PREFIX, Path.GetFileName(hdlogoFilePath));
            }

            var ret = dbContextService.Add <RadarCategory>(model);

            RadarService.UpdateServerVersion <RadarCategory>();

            return(RedirectToAction("RadarCategoryList"));
        }
        public ActionResult RadarCategoryEdit(RadarCategory model, HttpPostedFileBase normallogoFile, HttpPostedFileBase hdlogoFile)
        {
            var radarCategory = dbContextService.Single <RadarCategory>(model.Id);

            radarCategory.Name = model.Name;

            radarCategory.Comment        = model.Comment;
            radarCategory.Status         = model.Status;
            radarCategory.CreateDateTime = DateTime.Now;

            var normallogoFilePath = GetNewsLogoFilePath <RadarCategory>(model, normallogoFile);
            var hdlogoFilePath     = GetNewsLogoFilePath <RadarCategory>(model, hdlogoFile);

            if (!string.IsNullOrEmpty(normallogoFilePath))
            {
                radarCategory.NormalLogoUrl = string.Format("{0}{1}", NEWS_LOGOS_IMAGE_PREFIX, Path.GetFileName(normallogoFilePath));
            }

            if (!string.IsNullOrEmpty(hdlogoFilePath))
            {
                radarCategory.HDLogoUrl = string.Format("{0}{1}", NEWS_LOGOS_IMAGE_PREFIX, Path.GetFileName(hdlogoFilePath));
            }

            var ret = dbContextService.Update <RadarCategory>(radarCategory);

            RadarService.UpdateServerVersion <RadarCategory>();

            return(RedirectToAction("RadarCategoryList"));
        }
        public ActionResult RadarCategoryDelete(int radarCategoryId)
        {
            var ret = dbContextService.Delete <RadarCategory>(radarCategoryId);

            RadarService.UpdateServerVersion <RadarCategory>();

            return(RedirectToAction("RadarCategoryList"));
        }
        public ActionResult RadarElementDelete(int radarElementId)
        {
            var ret = dbContextService.Delete <RadarElement>(radarElementId);

            RadarService.UpdateServerVersion <RadarElement>();

            return(RedirectToAction("RadarElementList"));
        }
        static void Main(string[] args)
        {
            RadarService service = new RadarService();
            ServiceHost  host    = new ServiceHost(service);

            host.Open();
            Console.WriteLine("Serwer DBService został uruchomiony");
            Console.ReadKey();
        }
        public ActionResult RadarElementEdit(int radarElementId)
        {
            var allradarcategorylist = RadarService.GetRadarCategoryList().ToList();
            var radarelement         = dbContextService.Single <RadarElement>(radarElementId);

            var radarelementview = radarelement.To <RadarElementView>();

            ViewData["RadarCategorylist"] = allradarcategorylist.GetSelectList();
            ViewData["RadarCategoryIds"]  = radarelementview.RadarCategoryIds;
            ViewData["IsUpdate"]          = true;
            return(View("RadarElementAdd", radarelementview));
        }
        public RadarPage()
        {
            InitializeComponent();

            App                    app                    = ((App)Application.Current);
            RadarService           radarService           = app.GetService <RadarService>();
            WeatherLocationService weatherLocationService = app.GetService <WeatherLocationService>();
            AppPreferencesService  appPreferencesService  = app.GetService <AppPreferencesService>();

            _viewModel = new RadarViewModel(radarService, weatherLocationService, appPreferencesService);

            BindingContext = _viewModel;
        }
        public ActionResult RadarElementEdit(RadarElement model, FormCollection parameters)
        {
            var radarcategoryIds = parameters["radarcategory"].GetIds();

            var radarElement = dbContextService.Single <RadarElement>(model.Id);

            radarElement.Name             = model.Name;
            radarElement.RadarCategoryIds = radarcategoryIds.GetString();
            radarElement.Comment          = model.Comment;
            radarElement.Status           = model.Status;
            radarElement.CreateDateTime   = DateTime.Now;

            var ret = dbContextService.Update <RadarElement>(radarElement);

            RadarService.UpdateServerVersion <RadarElement>();

            return(RedirectToAction("RadarElementList"));
        }
Exemple #10
0
        public ActionResult RadarElementAdd(RadarElement model, FormCollection parameters)
        {
            var radarcategoryIds = parameters["radarcategory"].GetIds();

            var exist = dbContextService.Exists <RadarElement>(x => x.Name == model.Name);

            if (exist)
            {
                TempData["errorMsg"] = "该元素已存在!";
                return(View());
            }
            model.RadarCategoryIds = radarcategoryIds.GetString();
            var ret = dbContextService.Add <RadarElement>(model);

            RadarService.UpdateServerVersion <RadarElement>();

            return(RedirectToAction("RadarElementList"));
        }