public ActionResult Edit(ScadaFlowProjectModel model) { var newmodel = FlowProjectService.GetById(model.Id); newmodel.UpdateTime = DateTime.Now; newmodel.UpdateUserId = Operator.UserId; newmodel.CreateTime = DateTime.Now; newmodel.CreateUserId = Operator.UserId; newmodel.Title = model.Title; var result = FlowProjectService.UpdateById(newmodel) ? SuccessTip("修改成功") : ErrorTip("修改失败"); return(Json(result)); }
public ActionResult Index(int?id) { string vid = Request["vid"]; if (vid == null || vid.ToString().Trim() == "") { vid = ""; } ScadaFlowModel model = new ScadaFlowModel(); if (vid == "") { string para = Request.QueryString["id"].Split('?')[0]; string[] idarray = Request.QueryString["id"].Split('?').Length >= 2 ? Request.QueryString["id"].Split('?')[1].Split('=') : null; string idstr = "0"; if (idarray != null && idarray.Length >= 2) { idstr = Request.QueryString["id"].Split('?')[1].Split('=')[1]; } else { idstr = id.ToString(); } if (para != null && para != "") { id = int.Parse(para); } } ScadaFlowProjectModel Project = ProjectServer.GetById(id.Value); if (Project != null && vid == "") { ScadaFlowViewModel view = ViewServer.GetByWhere(" where ProjectId='" + Project.ProjectId + "'").First(); model.Project = Project; model.MainView = view; } else if (vid != "") { ScadaFlowViewModel view = ViewServer.GetByWhere(" where ViewId='" + vid + "'").First(); if (view != null) { Project = ProjectServer.GetByWhere(" where ProjectId='" + view.ProjectId + "'").First(); model.Project = Project; model.MainView = view; } } return(View(model)); }
public JsonResult List(ScadaFlowProjectModel model, PageInfo pageInfo) { var result = FlowProjectService.GetListByFilter(model, pageInfo); return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult Login(loginModel model) { string username = model.username, password = model.password, viewId = model.viewId, projId = model.projId; AjaxResult error = new AjaxResult { state = ResultType.error.ToString(), message = "登录失败" }; AjaxResult success = new AjaxResult { state = ResultType.success.ToString(), message = "登录成功" }; var result = error.SetMsg("禁止登录"); LogonLogModel logEntity = new LogonLogModel(); logEntity.LogType = DbLogType.Login.ToString(); try { ScadaFlowProjectModel Project = null; if (viewId != null && viewId != "" && viewId != "0") { ScadaFlowViewModel view = ViewServer.GetByWhere(" where ViewId='" + viewId + "'").First(); if (view != null) { Project = ProjectServer.GetByWhere(" where ProjectId='" + view.ProjectId + "'").First(); model.projId = Project.Id.ToString(); model.viewId = view.ViewId; } string nickname = ""; bool isUser = ProjectServer.LoginOn(username, password, Project.Id.ToString(), out nickname); if (isUser == true) { OperatorModel operatorModel = new OperatorModel(); operatorModel.UserId = 0; operatorModel.Account = username; operatorModel.RealName = nickname; operatorModel.HeadIcon = ""; operatorModel.RoleId = 0; operatorModel.LoginIPAddress = Net.Ip; operatorModel.LoginIPAddressName = Net.GetLocation(Net.Ip); OperatorFlowProvider.Provider.AddCurrent(operatorModel); logEntity.Account = username; logEntity.RealName = nickname; logEntity.Description = Project.Title + "(" + Project.Id + ")工程的 " + nickname + "登陆成功!"; LogonLogService.WriteDbLog(logEntity); result = success.SetMsg(nickname + "登陆成功"); result.data = Json(model).Data; return(Json(result)); } else { result = error.SetMsg("用户名或密码错误"); return(Json(result)); } } else { logEntity.Account = username; logEntity.RealName = username; logEntity.Description = "登录失败,登录页面不存在"; LogonLogService.WriteDbLog(logEntity); result = error.SetMsg(logEntity.Description); return(Json(result)); } } catch (Exception ex) { logEntity.Account = username; logEntity.RealName = username; logEntity.Description = "登录失败," + ex.Message; LogonLogService.WriteDbLog(logEntity); result = error.SetMsg(logEntity.Description); return(Json(result)); } }