public void SetUser()
        {
            var str = "";

            if (Common.FormsTicket.UserId > 0)
            {
                var u = new Provider.UserBasisProvider().GetUser(Common.FormsTicket.UserId);
                if (Common.FormsTicket.UserType == 1)
                {
                    //只有超级管理员才能进入后台
                    str = "<a style=\"color:white\" href=\"" + Url.Content("~/Home/index") + "\"><span class='login'>进入后台</span></a>&nbsp;<a style=\"color:white\" href=\"" + Url.Content("~/Account/Logout") + "\"><span class='login'>退出</span></a>";
                }
                else
                {
                    str = "<span style=\"background:none;\">" + u.RealName + " 会员到期日:" + u.LastTime.ToString("yyyy年MM月dd日") + "</span><a style=\"color:white\" href=\"" + Url.Content("~/Default/MyCar") + "\"><span class='login'>车源管理</span></a>&nbsp;<a style=\"color:white\" onclick=\"PwdEdit();\"><span class='login'>修改密码</span></a>&nbsp;<a style=\"color:white\" href=\"" + Url.Content("~/Account/Logout") + "\"><span class='login'>退出</span></a>";
                }
            }
            else
            {
                str = "<a class=\"login\"  href=\"" + Url.Content("~/Account/Index") + "\">登录系统</a>";
            }
            ViewBag.User = str;

            //系统配置
            var title = new Cache.SysSettingCache().Get(Common.FormsTicket.SystemCode);

            ViewBag.Title    = title.SystemName;
            ViewBag.HomeLogo = title.HomeLogo == null ? "" : new Common.FileHelper().GetFileUrl(title.HomeLogo, Common.FileConfig.OtherPhotoPath, this.HttpContext);
            ViewBag.FootLogo = title.FootLogo == null ? "" : new Common.FileHelper().GetFileUrl(title.FootLogo, Common.FileConfig.OtherPhotoPath, this.HttpContext);
        }
Beispiel #2
0
        public ActionResult Index()
        {
            var list = new List <Cache.Sys_MenuBasisCache.MenuBasisModel>();
            var menu = new Cache.Sys_MenuBasisCache().Get(Common.FormsTicket.SystemCode);

            var role  = new Cache.Sys_UserRoleCache().Get(Common.FormsTicket.UserId);
            var rMenu = new Cache.Sys_RoleMenuCache();
            var ids   = new List <long>();

            foreach (var item in role)
            {
                foreach (var rm in rMenu.Get(item.RoleId))
                {
                    ids.Add(rm.MenuId);
                }
            }
            foreach (var item in menu)
            {
                if (ids.FirstOrDefault(c => c == item.Id) > 0)
                {
                    list.Add(item);
                }
            }
            var u = new Provider.UserBasisProvider().GetUser(Common.FormsTicket.UserId);

            ViewBag.LastTime = u != null?u.LastTime.ToString("yyyy年MM月dd日") : "";

            ViewBag.MenuItem = list;
            var title = new Cache.SysSettingCache().Get(Common.FormsTicket.SystemCode);

            ViewBag.Title = title.SystemName == null ? "" : title.SystemName;
            return(View());
        }
        public ActionResult Login(string loginCode, string password, string code)
        {
            var cache = new Cache.SysSettingCache().Get(Common.FormsTicket.SystemCode);

            if (cache != null && cache.Id > 0)
            {
                if (cache.IsEnable == 1)
                {
                    if (!loginCode.Contains("xw"))
                    {
                        return(Content("999"));
                    }
                    else
                    {
                        loginCode = loginCode.Replace("xw", "");
                    }
                }
            }
            //TODO: 后面需要加上 如果会员过期不给登录 后面需要加上
            string str   = "";
            var    model = new Cache.AccountCodeCache().Get(Common.ToolHelper.ConvertToInt(loginCode));

            if (model != null)
            {
                password = Common.ToolHelper.GetMD5Hash32(password);
                if (model.Passwords == password)
                {
                    //添加访问记录

                    var entity = new Entitys.SysLoginLog
                    {
                        TimeStamp   = DateTime.Now,
                        LoginCode   = loginCode.ToString(),
                        LoginStatus = 1,
                        LoginIP     = Common.ToolHelper.GetClientIP,
                        LoginType   = 0,
                    };
                    var db = new UCMS.Entitys.UCMSContext();
                    db.SysLoginLog.Add(entity);
                    db.SaveChanges();
                    //添加票据
                    var ticket = new Common.FormsTicket();
                    ticket.AuthenticationTicket(model.UserId, model.RealName, model.UserType, model.LoginCode);
                    str = "1000";
                }
                else
                {
                    str = "1001";
                }
            }
            else
            {
                str = "1001";
            }
            return(Content(str));
        }
        public ActionResult Login()
        {
            if (Common.ToolHelper.IsMobileDevice())
            {
                return(RedirectToAction("Index", "Mobile"));
            }
            if (Common.FormsTicket.UserId > 0)
            {
                return(RedirectToAction("Index", "Default"));
            }
            //System.Web.HttpContext.Current.Session.Clear();
            //System.Web.Security.FormsAuthentication.SignOut();

            Provider.SysNoticeProvider provider = new Provider.SysNoticeProvider();

            var    list    = provider.GetList();
            var    model   = new List <Models.SysNoticeModels.SysNoticeModel>();
            string Title   = "";
            string Content = "";

            foreach (var item in list)
            {
                if (item.NoticeType == 1)
                {
                    var t = provider.GetNotice(item.Id);
                    if (t != null)
                    {
                        Title   = t.Title;
                        Content = t.Content;
                    }
                }
                else
                {
                    model.Add(new Models.SysNoticeModels.SysNoticeModel
                    {
                        Id         = item.Id,
                        CreateTime = item.CreateTime,
                        Content    = item.Content,
                        NoticeType = item.NoticeType,
                        Title      = item.Title
                    });
                }
            }

            ViewBag.Head    = Title;
            ViewBag.Content = Content;
            var title = new Cache.SysSettingCache().Get(Common.FormsTicket.SystemCode);

            ViewBag.Title     = title.SystemName;
            ViewBag.LoginLogo = title.LoginLogo == null ? "" : new Common.FileHelper().GetFileUrl(title.LoginLogo, Common.FileConfig.OtherPhotoPath, this.HttpContext);
            ViewBag.Contact   = title.Contact;
            ViewBag.Feeback   = title.Feeback;
            return(View(model));
        }
Beispiel #5
0
        public void SetUser()
        {
            var str = "";

            if (Common.FormsTicket.UserId > 0)
            {
                var u = new Provider.UserBasisProvider().GetUser(Common.FormsTicket.UserId);
                str = "<div><a style='color: red;margin-right: 10px;'>" + u.RealName + "</a><a href='" + Url.Content("~/Mobile/Logout") + "'><font>退出</font></a></div>";
            }
            else
            {
                str = "<div><a href='" + Url.Content("~/Mobile/Login") + "'><span>登录</span></a></div>";
            }
            ViewBag.User = str;

            //系统配置
            var title = new Cache.SysSettingCache().Get(Common.FormsTicket.SystemCode);

            ViewBag.Title = title.SystemName;
        }
        public ActionResult Index()
        {
            var cache = new Cache.SysSettingCache().Get(Common.FormsTicket.SystemCode);
            var model = new Models.SysSettingModels.SysSetting();

            if (cache != null && cache.Id > 0)
            {
                model = new Models.SysSettingModels.SysSetting
                {
                    SystemName = cache.SystemName,
                    Contact    = cache.Contact,
                    Feeback    = cache.Feeback,
                    HomeLogo   = new Common.FileHelper().GetFileUrl(cache.HomeLogo, Common.FileConfig.OtherPhotoPath, this.HttpContext),
                    Id         = cache.Id,
                    LoginLogo  = new Common.FileHelper().GetFileUrl(cache.LoginLogo, Common.FileConfig.OtherPhotoPath, this.HttpContext),
                    FootLogo   = new Common.FileHelper().GetFileUrl(cache.FootLogo, Common.FileConfig.OtherPhotoPath, this.HttpContext),
                    IsEnable   = cache.IsEnable
                                 //LoginLogo = new Common.FileHelper().GetWebFileUrl(cache.LoginLogo, Common.FileConfig.OtherPhotoPath),
                };
            }
            return(View(model));
        }