/// <summary> /// 点击左菜单获取单灯信息 /// </summary> /// <returns></returns> public JsonResult AllMarkerLights() { if (Request.QueryString["sGUID"] != null) { LumluxSSYDB.BLL.tLightInfoes light_bll = new LumluxSSYDB.BLL.tLightInfoes(); LightsViewModel lightVM = new LightsViewModel(); DataTable dt = light_bll.GetLightByWhereInfo(" li.iEnable=1 and sHostInfoGUID='" + Request.QueryString["sGUID"].ToString() + "'"); if (dt != null) { //lightVM.maxLat = GetMaxLat(Request.QueryString["sGUID"].ToString()); //lightVM.maxlng = GetMaxLng(Request.QueryString["sGUID"].ToString()); LightInfoVM hvm; foreach (DataRow dr in dt.Rows) { hvm = addlightInfo(dr); lightVM.LightInfos.Add(hvm); } } return(this.Json(lightVM.LightInfos)); } else { return(this.Json("")); } }
}//edit // GET: TaloValo/LightsOff/5 public ActionResult LightsOff(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TaloValo talovalo = db.TaloValo.Find(id); if (talovalo == null) { return(HttpNotFound()); } LightsViewModel valo = new LightsViewModel(); valo.Valo_ID = talovalo.Valo_ID; valo.Huone = talovalo.Huone; valo.ValaisinType = talovalo.ValaisinType; valo.Lamppu_ID = talovalo.Lamppu_ID; valo.Valo33 = false; valo.Valo66 = false; valo.Valo100 = false; valo.ValoTilaOff = true; //valo.ValoOn33 = DateTime.Now; //valo.ValoOn66 = DateTime.Now; //valo.ValoOn100 = DateTime.Now; return(View(valo)); }
/// <summary> /// 实时刷新单灯 /// </summary> /// <returns></returns> public JsonResult curHostAllLights() { if (Request.QueryString["hostGUID"] != null) { //List<Model.tLightInfoes> list = new List<Model.tLightInfoes>(); LumluxSSYDB.BLL.tLightInfoes light_bll = new LumluxSSYDB.BLL.tLightInfoes(); //list = light_bll.GetModelList("sHostInfoGUID='" + Request.QueryString["hostGUID"] + "'"); LightsViewModel lightVM = new LightsViewModel(); DataTable dt = light_bll.GetLightByWhereInfo(" li.iEnable=1 and sHostInfoGUID='" + Request.QueryString["hostGUID"].ToString() + "'"); if (dt != null) { LightInfoVM hvm; foreach (DataRow dr in dt.Rows) { hvm = addlightInfo(dr); lightVM.LightInfos.Add(hvm); } } return(this.Json(lightVM.LightInfos)); } else { return(this.Json("")); } }
public ActionResult Create(LightsViewModel model) { TaloValo valo = new TaloValo(); valo.Valo_ID = model.Valo_ID; valo.Huone = model.Huone; valo.ValaisinType = model.ValaisinType; valo.Lamppu_ID = model.Lamppu_ID; //valo.ValoOn33 = DateTime.Now; //valo.ValoOn66 = DateTime.Now; //valo.ValoOn100 = DateTime.Now; //valo.ValoOff = DateTime.Now; db.TaloValo.Add(valo); ViewBag.Huone = new SelectList((from tv in db.TaloValo select new { Valo_ID = tv.Valo_ID, Huone = tv.Huone }), "Valo_ID", "Huone", null); ViewBag.ValaisinTYpe = new SelectList((from tv in db.TaloValo select new { Valo_ID = tv.Valo_ID, Huone = tv.Huone }), "Valo_ID", "ValaisinType", null); try { db.SaveChanges(); } catch (Exception ex) { } return(RedirectToAction("Index")); }//create*/;
public JsonResult RealTimeAlarmDemoInfo() { if (Request.QueryString["RTPrjctGUID"] != null) { List <PrjectSetInfoVM> pslist = new List <PrjectSetInfoVM>(); LumluxSSYDB.BLL.tPrjectSet light_bll = new LumluxSSYDB.BLL.tPrjectSet(); LightsViewModel lightVM = new LightsViewModel(); DataTable dt = light_bll.GetTableByWhere("sPrjectGUID='" + Request.QueryString["RTPrjctGUID"].ToString() + "' and sKey like '%Light_Image_%'"); //DataTable dt=DataTableRowtoCon(dtold, "sKey"); if (dt != null) { PrjectSetInfoVM psm; foreach (DataRow dr in dt.Rows) { psm = addprjectsetInfo(dr); pslist.Add(psm); } } return(this.Json(pslist)); } else { return(this.Json("")); } }
}// // GET: TaloValo/Light100/5 public ActionResult Light100(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TaloValo talovalo = db.TaloValo.Find(id); if (talovalo == null) { return(HttpNotFound()); } LightsViewModel valo = new LightsViewModel(); valo.Valo_ID = talovalo.Valo_ID; valo.Huone = talovalo.Huone; valo.ValaisinType = talovalo.ValaisinType; valo.Lamppu_ID = talovalo.Lamppu_ID; valo.Valo33 = false; valo.Valo66 = false; valo.Valo100 = true; valo.ValoTilaOff = false; //valo.ValoOn33 = talovalo.ValoOn33; //valo.ValoOn66 = talovalo.ValoOn66; valo.ValoOn100 = talovalo.ValoOn100; //valo.ValoOff = talovalo.ValoOff; ViewBag.Huone = new SelectList((from tv in db.TaloValo select new { Valo_ID = tv.Valo_ID, Huone = tv.Huone }), "Valo_ID", "Huone", null); ViewBag.ValaisinTYpe = new SelectList((from tv in db.TaloValo select new { Valo_ID = tv.Valo_ID, Huone = tv.Huone }), "Valo_ID", "ValaisinType", null); return(View(valo)); }
}// // GET: TaloValo/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TaloValo talovalo = db.TaloValo.Find(id); if (talovalo == null) { return(HttpNotFound()); } LightsViewModel valo = new LightsViewModel(); valo.Valo_ID = talovalo.Valo_ID; valo.Huone = talovalo.Huone; valo.ValaisinType = talovalo.ValaisinType; valo.Lamppu_ID = talovalo.Lamppu_ID; valo.ValoTilaOff = talovalo.ValoTilaOff; valo.Valo33 = talovalo.Valo33; valo.Valo66 = talovalo.Valo66; valo.Valo100 = talovalo.Valo100; valo.ValoOn33 = talovalo.ValoOn33; valo.ValoOn66 = talovalo.ValoOn66; valo.ValoOn100 = talovalo.ValoOn100; valo.ValoOff = talovalo.ValoOff; return(View(valo)); }
public LightsPage() { InitializeComponent(); LightsBindingContext = new LightsViewModel(this); BindingContext = LightsBindingContext; App.Curr.OnBridgeFound += Curr_OnBridgeFound; }
// GET: TaloValo/Create public ActionResult Create() { JohaMeriSQL2Entities db = new JohaMeriSQL2Entities(); LightsViewModel model = new LightsViewModel(); ViewBag.Huone = new SelectList((from tv in db.TaloValo select new { Valo_ID = tv.Valo_ID, Huone = tv.Huone }), "Valo_ID", "Huone", null); ViewBag.ValaisinType = new SelectList((from tv in db.TaloValo select new { Valo_ID = tv.Valo_ID, Huone = tv.Huone }), "Valo_ID", "ValaisinType", null); return(View(model)); }
public ActionResult Edit(LightsViewModel model) { TaloValo valo = db.TaloValo.Find(model.Valo_ID); //valo.Valo_ID = model.Valo_ID; valo.Huone = model.Huone; valo.ValaisinType = model.ValaisinType; valo.Lamppu_ID = model.Lamppu_ID; //valo.ValoOn33 = DateTime.Now; //valo.ValoOn66 = DateTime.Now; //valo.ValoOn100 = DateTime.Now; //valo.ValoOff = DateTime.Now; ViewBag.Huone = new SelectList((from tv in db.TaloValo select new { Valo_ID = tv.Valo_ID, Huone = tv.Huone }), "Valo_ID", "Huone", null); ViewBag.ValaisinTYpe = new SelectList((from tv in db.TaloValo select new { Valo_ID = tv.Valo_ID, Huone = tv.Huone }), "Valo_ID", "ValaisinType", null); db.SaveChanges(); return(RedirectToAction("Index")); }//edit
// GET: TaloValo/Details/5 public ActionResult Details(int?id) { LightsViewModel model = new LightsViewModel(); JohaMeriSQL2Entities entities = new JohaMeriSQL2Entities(); try { TaloValo taloValo = db.TaloValo.Find(id); if (taloValo == null) { return(HttpNotFound()); } TaloValo valodetail = entities.TaloValo.Find(taloValo.Valo_ID); LightsViewModel valo = new LightsViewModel(); valo.Valo_ID = valodetail.Valo_ID; valo.Huone = valodetail.Huone; valo.ValaisinType = valodetail.ValaisinType; valo.Lamppu_ID = valodetail.Lamppu_ID; valo.ValoTilaOff = valodetail.ValoTilaOff; valo.Valo33 = valodetail.Valo33; valo.Valo66 = valodetail.Valo66; valo.Valo100 = valodetail.Valo100; valo.ValoOn33 = valodetail.ValoOn33; valo.ValoOn66 = valodetail.ValoOn66; valo.ValoOn100 = valodetail.ValoOn100; valo.ValoOff = valodetail.ValoOff; model = valo; } finally { entities.Dispose(); } return(View(model)); }
// // GET: /Lamp/FailureRate/ public ActionResult Index() { LumluxSSYDB.BLL.tHostInfo lbt = new LumluxSSYDB.BLL.tHostInfo(); //and iState_Alarm=1 List <LumluxSSYDB.Model.tHostInfo> listhost = lbt.GetModelList("sProjectInfoGUID='" + PrjGUID + "' and iState_Enable= '" + (int)StateEnable.Enable + "'");; if (listhost.Count > 0) { ViewBag.vHost = listhost; } else { ViewBag.vHost = new List <LumluxSSYDB.Model.tHostInfo>(); } List <PrjectSetInfoVM> pslist = new List <PrjectSetInfoVM>(); LumluxSSYDB.BLL.tPrjectSet light_bll = new LumluxSSYDB.BLL.tPrjectSet(); LightsViewModel lightVM = new LightsViewModel(); DataTable dt = light_bll.GetTableByWhere("sPrjectGUID='" + PrjGUID + "' and sKey like '%Light_Image_%'"); if (dt != null) { PrjectSetInfoVM psm; foreach (DataRow dr in dt.Rows) { psm = addprjectsetInfo(dr); pslist.Add(psm); } ViewBag.AlarmDemos = pslist; } else { ViewBag.AlarmDemos = new List <PrjectSetInfoVM>(); } return(View()); }
public IActionResult Post([FromBody] LightsViewModel model) { try { if (ModelState.IsValid) { var newEntrie = _mapper.Map <LightsViewModel, Light>(model); _repository.AddEntity(newEntrie); if (_repository.SaveAll()) { return(Created($"/api/lights/{newEntrie.Id}", _mapper.Map <Light, LightsViewModel>(newEntrie))); } } } catch (Exception ex) { _logger.LogError($"Failed to save a new Entrie to Lights: {ex}"); } return(BadRequest("Bad Request")); }
public ViewModels(Models models) { m_models = models; // view model initialization ConsoleOutput = new ConsoleOutputViewModel(m_models); Display = new DisplayViewModel(m_models); Cameras = new CamerasViewModel(m_models); Lights = new LightsViewModel(m_models); Materials = new MaterialsViewModel(m_models); Toolbar = new ToolbarViewModel(m_models); Statusbar = new StatusbarViewModel(m_models); Profiler = new ProfilerViewModel(m_models); Renderer = new RendererViewModel(m_models, Toolbar.PlayPauseCommand, Toolbar.ResetCommand); Scene = new SceneViewModel(m_models); RenderTargetSelection = new RenderTargetSelectionViewModel(m_models, Toolbar.ResetCommand); LoadWorld = new LoadWorldViewModel(m_models); AnimationFrames = new AnimationFrameViewModel(m_models); Tessellation = new TessellationViewModel(m_models); // command initialization AddLightCommand = new AddLightCommand(m_models); LoadSceneCommand = new LoadSceneCommand(m_models); SaveSceneCommand = new SaveSceneCommand(m_models); SelectRendererCommand = new SelectRendererCommand(m_models); OpenSettingsCommand = new OpenSettingsCommand(m_models); DenoiseImageCommand = new SaveDenoisedScreenshotCommand(m_models); RenderAnimatedSequenceCommand = new RenderSequenceCommand(m_models, 0, false, true); KeyGestures = new KeyGestureViewModel(models); }
public IActionResult UpdateEntrie([FromBody] LightsViewModel model) { try { if (ModelState.IsValid) { var newEntrie = _mapper.Map <LightsViewModel, Light>(model); var entity = _ctx.Lights.FirstOrDefault(i => i.Id == model.Id); entity.Number = newEntrie.Number; entity.Setting1 = newEntrie.Setting1; entity.Setting2 = newEntrie.Setting2; entity.Setting3 = newEntrie.Setting3; entity.Pattern = newEntrie.Pattern; entity.Datetime = newEntrie.Datetime; entity.AlgorithmParameter1 = newEntrie.AlgorithmParameter1; entity.AlgorithmParameter2 = newEntrie.AlgorithmParameter2; entity.AlgorithmParameter3 = newEntrie.AlgorithmParameter3; entity.AlgorithmParameter4 = newEntrie.AlgorithmParameter4; _repository.UpdateEntity(entity); if (_repository.SaveAll()) { return(Created($"/api/lights/{entity.Id}", _mapper.Map <Light, LightsViewModel>(entity))); } } } catch (Exception ex) { _logger.LogError($"Failed to update a Entrie in Lights: {ex}"); } return(BadRequest("BadRequest")); }
// GET: TaloValo public ActionResult Index() { List <LightsViewModel> model = new List <LightsViewModel>(); JohaMeriSQL2Entities entities = new JohaMeriSQL2Entities(); try { List <TaloValo> talovalot = entities.TaloValo.OrderByDescending(TaloValo => TaloValo.ValaisinType).ToList(); // muodostetaan näkymämalli tietokannan rivien pohjalta foreach (TaloValo talovalo in talovalot) { LightsViewModel valo = new LightsViewModel(); valo.Valo_ID = talovalo.Valo_ID; valo.Huone = talovalo.Huone; valo.ValaisinType = talovalo.ValaisinType; valo.Lamppu_ID = talovalo.Lamppu_ID; valo.ValoTilaOff = talovalo.ValoTilaOff; valo.Valo33 = talovalo.Valo33; valo.Valo66 = talovalo.Valo66; valo.Valo100 = talovalo.Valo100; valo.ValoOn33 = talovalo.ValoOn33; valo.ValoOn66 = talovalo.ValoOn66; valo.ValoOn100 = talovalo.ValoOn100; valo.ValoOff = talovalo.ValoOff; model.Add(valo); } } finally { entities.Dispose(); } return(View(model)); }
// // GET: /Lamp/AlarmPage/ public ActionResult Index() { string strLightName = " 1=1 and "; string curTime = DateTime.Now.ToString("yyyy-MM-dd"); DateTime dtStart = DateTime.Now.AddDays(-7);//DateTime.Parse("1999-01-01"); DateTime dtEnd = DateTime.Parse(curTime).Add(new TimeSpan(23, 59, 59)); if (Request.QueryString["sGUID"] != null) { ViewBag.sHostGUID = Request.QueryString["sGUID"].ToString(); AlarmSelectedGUID = Request.QueryString["sGUID"].ToString(); LumluxSSYDB.BLL.tHostInfo thostbll = new LumluxSSYDB.BLL.tHostInfo(); LumluxSSYDB.Model.tHostInfo thostmode = thostbll.GetModel(AlarmSelectedGUID); if (thostmode != null) { ViewBag.HostNames = thostmode.sName; } //getdataresource gd = new getdataresource(); //PagingHelper<AlarmInfo> DataPaging = new PagingHelper<AlarmInfo>(10, GetDataSouceByTime(AlarmSelectedGUID, dtStart, dtEnd, 10)); List <AlarmInfo> DataPaging = GetDataSouceByTime(PrjGUID, AlarmSelectedGUID, dtStart, dtEnd, 0, strLightName); ViewBag.CurPageIndex = 1;//当前页 ViewBag.CurPageIndex = 1; if (DataPaging.Count > 0) { ViewBag.iCount = DataPaging[0].iCount;//总记录 ViewBag.iPage = (int)Math.Ceiling(Convert.ToInt32(DataPaging[0].iCount) / (double)10); ViewBag.Alarms = DataPaging; } else { ViewBag.iCount = 0;//总记录 ViewBag.iPage = 0; ViewBag.Alarms = new List <AlarmInfo>(); } ViewBag.vHost = new List <LumluxSSYDB.Model.tHostInfo>(); } else { #region MyRegion LumluxSSYDB.BLL.tHostInfo lbt = new LumluxSSYDB.BLL.tHostInfo(); //and iState_Alarm=1 List <LumluxSSYDB.Model.tHostInfo> listhost = lbt.GetModelList("sProjectInfoGUID='" + PrjGUID + "' and iState_Enable='" + (int)StateEnable.Enable + "' ");; if (listhost.Count > 0) { ViewBag.vHost = listhost; } else { ViewBag.vHost = new List <LumluxSSYDB.Model.tHostInfo>(); } #endregion // ViewBag.Alarms = new List<AlarmInfo>(); List <AlarmInfo> DataPagingall = GetDataSouceByTime(PrjGUID, dtStart, dtEnd, 0, strLightName); ViewBag.CurPageIndex = 1;; //当前页 ViewBag.HostNames = "单灯信息"; //"全部主机"; if (DataPagingall.Count > 0) { ViewBag.iCount = DataPagingall[0].iCount; //总记录 ViewBag.iPage = (int)Math.Ceiling(Convert.ToInt32(DataPagingall[0].iCount) / (double)10); //总页数 ViewBag.Alarms = DataPagingall; } else { ViewBag.iCount = 0;//总记录 ViewBag.iPage = 0; ViewBag.Alarms = new List <AlarmInfo>(); } } #region MyRegion List <PrjectSetInfoVM> pslist = new List <PrjectSetInfoVM>(); LumluxSSYDB.BLL.tPrjectSet light_bll = new LumluxSSYDB.BLL.tPrjectSet(); LightsViewModel lightVM = new LightsViewModel(); DataTable dt = light_bll.GetTableByWhere("sPrjectGUID='" + PrjGUID + "' and sKey like '%Light_Image_%'"); if (dt != null) { PrjectSetInfoVM psm; foreach (DataRow dr in dt.Rows) { psm = addprjectsetInfo(dr); pslist.Add(psm); } ViewBag.AlarmDemos = pslist; } else { ViewBag.AlarmDemos = new List <PrjectSetInfoVM>(); } #endregion return(View()); }