Ejemplo n.º 1
0
        public ActionResult View(long id)
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);
            var model     = NoticeModelReg.GetNoticeModel(id);

            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult LogOn(LogOnModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                if (_IsValidateUser(model.UserID, model.Password))
                {
                    FormsAuthentication.SetAuthCookie(model.UserID, model.RememberMe);

                    if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") &&
                        !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                    {
                        return(Redirect(returnUrl));
                    }

                    var loginInfoSession = SessionLoginInfo.GetInstance(Session);

                    return(RedirectToAction("Index", "Home", new { key = loginInfoSession.OrganizationID }));
                }

                ModelState.AddModelError("", @"指定されたユーザー名またはパスワードが正しくありません。");
            }

            // ここで問題が発生した場合はフォームを再表示します
            return(View(model));
        }
Ejemplo n.º 3
0
        //
        // GET: /Notice/

        public ActionResult Index(int PageIndex = 0, int PageSize = 15)
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);

            if (PageSize <= 0)
            {
                PageSize = 15;
            }
            PageSize = Math.Max(1, PageSize);
            var viewModel = new NoticeModelListViewModel()
            {
                PageIndex = PageIndex,
                PageSize  = PageSize
            };

            var items = NoticeModelReg.GetNoticeListForEdit(loginInfo.SystemRoll, loginInfo.OrganizationID, PageIndex, PageSize);

            viewModel.RowTotal = NoticeModelReg.GetNoticeListForEditCount(loginInfo.SystemRoll, loginInfo.OrganizationID);
            viewModel.Items    = items;

            viewModel.PageIndex = Math.Min(viewModel.PageIndex, viewModel.PageCount - 1);
            viewModel.PageIndex = Math.Max(viewModel.PageIndex, 0);

            return(View(viewModel));
        }
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var Session      = HttpContext.Current.Session;
            var loginInfo    = SessionLoginInfo.GetInstance(Session);
            var organization = loginInfo.OrganizationID;// HttpContext.Current.Request.Cookies.Get("OrganizationID");

            if (loginInfo.LoginID == 0 || !_rolls.Contains(loginInfo.SystemRoll))
            {
                if (AjaxRequestExtensions.IsAjaxRequest(filterContext.HttpContext.Request))
                {
                    ActionExecutingContext executingContext = filterContext;
                    JsonResult             jsonResult1      = new JsonResult();
                    var dt = new { State = "Timeout", Redirect = UrlHelper.GenerateUrl("default", "RolloutRedirect", "Home", null, null, filterContext.RequestContext, true) };
                    jsonResult1.Data = dt;// "_Logon_";
                    JsonResult jsonResult2 = jsonResult1;
                    executingContext.Result = (ActionResult)jsonResult2;
                }
                else
                {
                    ActionExecutingContext executingContext = filterContext;
                    RouteValueDictionary   routeValues      = new RouteValueDictionary();
                    routeValues.Add("Controller", "Home");
                    routeValues.Add("Action", "RolloutRedirect");
                    if (string.IsNullOrEmpty(organization))
                    {
                        routeValues.Add("OrganizationID", organization);
                    }
                    RedirectToRouteResult redirectToRouteResult = new RedirectToRouteResult(routeValues);
                    executingContext.Result = (ActionResult)redirectToRouteResult;
                }
            }
            base.OnActionExecuting(filterContext);
        }
Ejemplo n.º 5
0
        public ActionResult UserList()
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);
            var modelreg  = new UserModelReg();

            modelreg.SetUserList(loginInfo.SystemRoll, loginInfo.OrganizationID);
            return(View(modelreg));
        }
Ejemplo n.º 6
0
        public ActionResult GetAllLayersPartial()
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);
            var allModels = LayerModelReg.GetModels(loginInfo.OrganizationID);

            allModels.ForEach(m => m.SetUrlHelper(Url));
            return(PartialView("_AllLayersPartial", allModels));
        }
Ejemplo n.º 7
0
        public ActionResult GetMenuHtml()
        {
            // TODO:Fix RollEnum
            var model    = SessionLoginInfo.GetInstance(Session);
            var RollEnum = model.SystemRoll;// (SystemRoll)Session[LoginSessionKeys.RollEnum];

            return(Content(SystemMenuListModel.GetInstance().GetHtml(RollEnum, Url)));
        }
Ejemplo n.º 8
0
        public ActionResult RefreshSys()
        {
            SystemMenuConfig.RefreshMenu();

            var key = SessionLoginInfo.GetInstance(Session).OrganizationID;

            return(RedirectToAction("Index", "Home", new { OrganizationID = key }));
        }
Ejemplo n.º 9
0
        /// <summary>
        ///     ログインユーザー名取得
        /// </summary>
        /// <returns></returns>
        public ActionResult GetLoginName()
        {
            var loginInfoSession = SessionLoginInfo.GetInstance(Session);

            if (Converts.ToTryInt(loginInfoSession.LoginID) == 0)
            {
                return(Content(String.Empty));
            }
            return(Content(Converts.ToTryString(loginInfoSession.UserName) + " さんでログイン"));
        }
Ejemplo n.º 10
0
        public ActionResult Index(string key)
        {
            if (Session[SessionKeyConfig.OrganizationID] == null)
            {
                return(RedirectToAction("Index", "Account", new { OrganizationID = key }));
            }

            var loginInfo    = SessionLoginInfo.GetInstance(Session);
            var organization = OrganizationReg.GetInstance().GetOrganizationModel(loginInfo.OrganizationID);

            return(View(organization));
        }
Ejemplo n.º 11
0
        public ActionResult GetAllLineDatas(string LayerIds)
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);
            var allModels = LineModelReg.GetModels(LayerIds);

            allModels.ForEach(m => m.SetUrlHelper(Url));
            var r = new
            {
                Datas = allModels
            };

            return(Json(r));
        }
        //
        // GET: /Organization/

        public ActionResult OrganizationEdit(string OrganizationID)
        {
            if (string.IsNullOrEmpty(OrganizationID))
            {
                var loginInfo = SessionLoginInfo.GetInstance(Session);
                OrganizationID = loginInfo.OrganizationID;
            }

            var model = OrganizationReg.GetInstance().GetOrganizationModel(OrganizationID);//SessionLoginInfo.GetInstance(Session).OrganizationID);

            Session["OrganizationEdit"] = model;
            return(View(model));
        }
Ejemplo n.º 13
0
        public ActionResult LogOff()
        {
            var key = SessionLoginInfo.GetInstance(Session).OrganizationID;

            if (string.IsNullOrEmpty(key))
            {
                key = this.Request.Form["OrganizationID"];
            }
            FormsAuthentication.SignOut();
            Session.Clear();
            Session.Abandon();
            return(RedirectToAction("Index", "Home", new { key = key }));
        }
Ejemplo n.º 14
0
        public ActionResult Edit(long id, int PageIndex = 0, int PageSize = 15)
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);
            var model     = NoticeModelReg.GetNoticeModel(id);

            if (model.CreateUserID == loginInfo.LoginID)
            {
                return(View(model));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
Ejemplo n.º 15
0
        public ActionResult Del(long id)
        {
            var    loginInfo      = SessionLoginInfo.GetInstance(Session);
            string OrganizationID = loginInfo.OrganizationID;

            if (loginInfo.SystemRoll == SystemRollEnum.SysAdmin)
            {
                OrganizationID = "";
            }
            var modelreg = new UserModelReg();

            modelreg.DeleteUser(OrganizationID, id);
            return(RedirectToAction("UserList", "User"));
        }
Ejemplo n.º 16
0
        protected void Application_Error(object sender, EventArgs e)
        {
            try
            {
                var ex = Server.GetLastError();

                if (ex == null)
                {
                    return;
                }

                if (ex.Message.IndexOf("favicon.ico", StringComparison.Ordinal) > 0)
                {
                    return;
                }

                //Debug.WriteLine(
                //    @"-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/{0}"
                //    + "DebugInfo ApplicationError:{0}{1}{0}"
                //    + "-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/{0}",
                //    Environment.NewLine, ex.Message);

                //Application[HttpContext.Current.Request.UserHostAddress] = ex;



                var loginInfoSession = SessionLoginInfo.GetInstance(Session);
                var msg = string.Format("{1}{0}{2}", Environment.NewLine, HttpContext.Current.Request.Url.OriginalString, ex.Message);
                SystemLogManager.GetInstance().SetSystemErrorLog(SystemConfig.SystemTitle, loginInfoSession.OrganizationID, loginInfoSession.LoginID, loginInfoSession.UserName, msg, ex.StackTrace);

#if DEBUG
                return;
#endif
                Server.ClearError();

                var url = new UrlHelper(HttpContext.Current.Request.RequestContext);
                Response.Redirect(url.Action("Error", "Home"), false);
                // ReSharper disable once AssignNullToNotNullAttribute
            }
            catch (Exception)
            {
                //Debug.WriteLine(
                //    @"-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/{0}"
                //    + "DebugInfo ApplicationError:{0}{1}{0}"
                //    + "-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/{0}",
                //    Environment.NewLine, ex.Message);
            }
            finally {
            }
        }
Ejemplo n.º 17
0
        public ActionResult UserEdit(long id)
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);

            var modelreg = new UserModelReg();
            var model    = new UserModel();

            model.DisplayFlag = true;
            if (id > 0)
            {
                if (loginInfo.SystemRoll == SystemRollEnum.SysAdmin)
                {
                    model = modelreg.GetUserModel(id);
                }
                else
                {
                    model = modelreg.GetUserModel(model.OrganizationID, id);
                }
                model.ConfirmPassword = model.Password;
            }
            else
            {
                modelreg.FillUnionOrganizations(model);
            }
            model.SetAuthrityList(loginInfo.SystemRoll);

            var reg   = OrganizationReg.GetInstance();
            var items = reg.GetOrganizationList();

            foreach (var item in items)
            {
                model.Organizations.Add(new SelectListItem()
                {
                    Value = item.OrganizationID, Text = item.OfficeName
                });
            }
            if (model.Guid == 0)
            {
                model.OrganizationID = loginInfo.OrganizationID;
                model.OfficeName     = reg.GetOrganizationModel(model.OrganizationID).OfficeName;
            }

            //var orgModelReg = new OrganizationReg();
            //orgModelReg.SetOrganizationList();
            //model.Organizations = orgModelReg.Items;

            ViewBag.DeleteCheck = modelreg.DeleteCheck(model.OrganizationID, id);
            return(View(model));
        }
Ejemplo n.º 18
0
        public ActionResult Delete(NoticeModel requestModel)
        {
            var viewName  = "Edit";
            var loginInfo = SessionLoginInfo.GetInstance(Session);
            var bl        = NoticeModelReg.Delete(requestModel.NoticeID, loginInfo.LoginID);

            if (bl)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(viewName, requestModel));
            }
        }
Ejemplo n.º 19
0
        public ActionResult EditDeviceAjax(DeviceModel model)
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);

            if (!ModelState.IsValid)
            {
                var r = new
                {
                    Success = false
                };
                return(Json(r));
            }

            bool bl = false;

            if (model.DeviceId > 0)
            {
                try
                {
                    var oldmodel = DeviceModelReg.GetModel(model.DeviceId);
                    oldmodel.DeviceKey  = model.DeviceKey;
                    oldmodel.DeviceName = model.DeviceName;
                    oldmodel.Lat        = model.Lat;
                    oldmodel.Lng        = model.Lng;
                    oldmodel.Note       = model.Note;
                    oldmodel.DeviceUrl  = model.DeviceUrl;
                    oldmodel.LastUserID = loginInfo.LoginID;
                    bl = DeviceModelReg.Update(oldmodel);
                }
                catch (Exception) { }
            }
            else
            {
                try
                {
                    model.OrganizationID = loginInfo.OrganizationID;
                    model.LastUserID     = loginInfo.LoginID;
                    bl = DeviceModelReg.Add(model);
                }
                catch (Exception) { }
            }
            var jsonObj = new
            {
                Success = bl
            };

            return(Json(jsonObj));
        }
Ejemplo n.º 20
0
        public ActionResult GetAllDevicesPartial(long LayerId)
        {
            var loginInfo  = SessionLoginInfo.GetInstance(Session);
            var allModels  = new List <IDevice>();
            var allDevices = DeviceModelReg.GetModels(LayerId);

            allDevices.ForEach(m => m.SetUrlHelper(Url));
            allModels.AddRange(allDevices);

            var allLines = LineModelReg.GetModels(LayerId);

            allLines.ForEach(m => m.SetUrlHelper(Url));
            allModels.AddRange(allLines);

            return(PartialView("_AllDevicesPartial", allModels));
        }
 public override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     if (HttpContext.Current.Session[this._LoginSessionKey] == null)
     {
         var organization = HttpContext.Current.Request.Cookies.Get("OrganizationID");
         if (AjaxRequestExtensions.IsAjaxRequest(filterContext.HttpContext.Request))
         {
             ActionExecutingContext executingContext = filterContext;
             JsonResult             jsonResult1      = new JsonResult();
             var dt = new { State = "Timeout", Redirect = UrlHelper.GenerateUrl("default", "TimeoutRedirect", "Home", null, null, filterContext.RequestContext, true) };
             jsonResult1.Data = dt;// "_Logon_";
             JsonResult jsonResult2 = jsonResult1;
             executingContext.Result = (ActionResult)jsonResult2;
         }
         else
         {
             ActionExecutingContext executingContext = filterContext;
             RouteValueDictionary   routeValues      = new RouteValueDictionary();
             routeValues.Add("Controller", "Home");
             routeValues.Add("Action", "TimeoutRedirect");
             if (organization != null)
             {
                 routeValues.Add("OrganizationID", organization.Value);
             }
             RedirectToRouteResult redirectToRouteResult = new RedirectToRouteResult(routeValues);
             executingContext.Result = (ActionResult)redirectToRouteResult;
         }
     }
     else
     {
         var controller = filterContext.RouteData.Values["controller"].ToString();
         var action     = filterContext.RouteData.Values["action"].ToString();
         var Session    = HttpContext.Current.Session;
         var loginInfo  = SessionLoginInfo.GetInstance(Session);
         var allow      = SystemMenuConfig.CheckRoll(controller, action, loginInfo.SystemRoll);
         if (!allow)
         {
             ActionExecutingContext executingContext = filterContext;
             RouteValueDictionary   routeValues      = new RouteValueDictionary();
             routeValues.Add("Controller", "Home");
             routeValues.Add("Action", "RolloutRedirect");
             RedirectToRouteResult redirectToRouteResult = new RedirectToRouteResult(routeValues);
             executingContext.Result = (ActionResult)redirectToRouteResult;
         }
     }
     base.OnActionExecuting(filterContext);
 }
Ejemplo n.º 22
0
        public ActionResult Order()
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);
            var items     = NoticeModelReg.GetNoticeListForOrder(loginInfo.SystemRoll, loginInfo.OrganizationID);

            Session[SessionKeyConfig.SortTargetModel] = new SortTargetModel
            {
                TableName          = "t_notice",
                IdColumn           = "NoticeID",
                DisplayColumn      = "Title",
                DisplayNoColumn    = "DisplayNo",
                RedirectController = "Notice",
                RedirectAction     = "Index",
                SortItems          = items
            };
            return(RedirectToAction("SortList", "Sorts"));
        }
Ejemplo n.º 23
0
        public ActionResult Index(LogOnModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                if (string.IsNullOrEmpty(model.OrganizationID))
                {
                    model.OrganizationID = "DebugOrganizationID";
                }
                var userModel = AccountModelsReg.GetInstance().GetUserModel(model);

                if (userModel.Guid > 0)
                {
                    this.Response.Cookies.Remove("OrganizationID");
                    this.Response.Cookies.Add(new System.Web.HttpCookie("OrganizationID", userModel.OrganizationID));

                    Session[SessionKeyConfig.OrganizationID] = userModel.OrganizationID;
                    //add logs
                    var result = AccountModelsReg.GetInstance().AddAccessLog(userModel);

                    var loginInfoSession = SessionLoginInfo.GetInstance(Session);

                    loginInfoSession.LoginID         = userModel.Guid;
                    loginInfoSession.OrganizationID  = userModel.OrganizationID;
                    loginInfoSession.UserName        = userModel.UserName;
                    loginInfoSession.SystemRoll      = (SystemRollEnum)Enum.Parse(typeof(SystemRollEnum), userModel.Authority.ToString());// .Administrator;
                    loginInfoSession.UnionOfficeUser = userModel.UnionOfficeUser;
                    loginInfoSession.UnionOfficeIds  = userModel.UnionOfficeIds;
                    loginInfoSession.Save();

                    if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") &&
                        !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                    {
                        return(Redirect(returnUrl));
                    }

                    return(RedirectToAction("Index", "Home", new { key = loginInfoSession.OrganizationID }));
                }

                ModelState.AddModelError("Err01", @"ユーザー名またはパスワードが確認できませんでした。");
                ModelState.AddModelError("Err02", @"入力内容をご確認ください。");
            }

            // ここで問題が発生した場合はフォームを再表示します
            return(View(model));
        }
Ejemplo n.º 24
0
        public ActionResult DeleteLineAjax(long LineId)
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);
            var model     = new LineModel()
            {
                LineId         = LineId,
                LastUserID     = loginInfo.LoginID,
                OrganizationID = loginInfo.OrganizationID,
            };

            var bl      = LineModelReg.Delete(model);
            var jsonObj = new
            {
                Success = bl
            };

            return(Json(jsonObj));
        }
Ejemplo n.º 25
0
        public ActionResult EditLayerAjax(LayerModel model)
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);

            if (!ModelState.IsValid)
            {
                var r = new
                {
                    Success = false
                };
                return(Json(r));
            }

            bool bl = false;

            if (model.Id > 0)
            {
                try
                {
                    var oldmodel = LayerModelReg.GetModel(model.Id);
                    oldmodel.LayerName  = model.LayerName;
                    oldmodel.IconFile   = model.IconFile;
                    oldmodel.LastUserID = loginInfo.LoginID;
                    bl = LayerModelReg.Update(oldmodel);
                }
                catch (Exception) { }
            }
            else
            {
                try
                {
                    model.OrganizationID = loginInfo.OrganizationID;
                    model.LastUserID     = loginInfo.LoginID;
                    bl = LayerModelReg.Add(model);
                }
                catch (Exception) { }
            }
            var jsonObj = new
            {
                Success = bl
            };

            return(Json(jsonObj));
        }
        public ActionResult Index()
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);

            if (loginInfo.SystemRoll == Enums.SystemRollEnum.SysAdmin)
            {
                var modelreg = new OrganizationReg();
                var items    = modelreg.GetOrganizationList();
                var model    = new OrganizationViewModel()
                {
                    Items = items
                };
                return(View(model));
            }
            else
            {
                return(RedirectToAction("OrganizationEdit", "Organization", new { OrganizationID = loginInfo.OrganizationID }));
            }
        }
Ejemplo n.º 27
0
        public ActionResult Sort()
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);
            var modelreg  = new UserModelReg();

            modelreg.SetUserList(loginInfo.SystemRoll, loginInfo.OrganizationID);

            Session[SessionKeyConfig.SortTargetModel] = new SortTargetModel
            {
                OrganizationID     = SessionLoginInfo.GetInstance(Session).OrganizationID,
                TableName          = "M_User",
                IdColumn           = "Guid",
                DisplayColumn      = "UserName",
                DisplayNoColumn    = "DisplayNo",
                RedirectController = "User",
                RedirectAction     = "UserList",
                SortItems          = modelreg.Items
            };
            return(RedirectToAction("SortList", "Sorts"));
        }
Ejemplo n.º 28
0
        public ActionResult GetAllDeviceDatasByLayerId(long LayerId)
        {
            var loginInfo = SessionLoginInfo.GetInstance(Session);
            var allModels = new List <IDevice>();

            var allDevices = DeviceModelReg.GetModels(LayerId);

            allDevices.ForEach(m => m.SetUrlHelper(Url));
            allModels.AddRange(allDevices);
            var allLines = LineModelReg.GetModels(LayerId);

            allLines.ForEach(m => m.SetUrlHelper(Url));
            allModels.AddRange(allLines);
            var r = new
            {
                Datas = allModels
            };

            return(Json(r));
        }
Ejemplo n.º 29
0
        public ActionResult Error()
        {
            try
            {
                if (Request.UserHostAddress != null)
                {
                    var ex = (Exception)HttpContext.Application[Request.UserHostAddress];

                    if (ex != null)
                    {
                        var loginInfoSession = SessionLoginInfo.GetInstance(Session);

                        SystemLogManager.GetInstance().SetSystemErrorLog(SystemConfig.SystemTitle, loginInfoSession.OrganizationID, loginInfoSession.LoginID, loginInfoSession.UserName, ex.Message, ex.StackTrace);
                    }
                }
            }
            catch (Exception exx)
            {
                Debug.WriteLine(exx.Message);
            }

            return(View("Error"));
        }
        public ActionResult OrganizationEdit(OrganizationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var org = (OrganizationModel)Session["OrganizationEdit"];

            if (!string.IsNullOrEmpty(org.OrganizationID))
            {
                model.OrganizationID = org.OrganizationID;
                model.LastUserID     = SessionLoginInfo.GetInstance(Session).LoginID;
                OrganizationReg.GetInstance().UpdateOrganizationModel(model);
            }
            else
            {
                //model.OrganizationID = Guid.NewGuid().ToString();
                model.LastUserID = SessionLoginInfo.GetInstance(Session).LoginID;
                OrganizationReg.GetInstance().AddNewOrganizationModel(model);
            }

            return(RedirectToAction("Index", "Organization", new { OrganizationID = org.OrganizationID }));
        }