public HQResult <string> Sigin(string UserName, string Password) { HQResult <string> result = new HQResult <string>(0, ""); OrderManagementBll.Authority.Account accountBll = new OrderManagementBll.Authority.Account(Configuration); var v1 = accountBll.Sigin(UserName, Password); if (v1.Status < 1) { return(result.SetResult(-1, v1.Msg)); } HQAuthorizationUser User = new HQAuthorizationUser() { UserName = UserName, Account = UserName, UserID = 10 }; User.UserHQAuthorizationSign.LoadData(new List <HQAuthorizationSign>() { new HQAuthorizationSign { Area = "", Controller = "login", Action = "test1", ID = 10 }, // new HQAuthorizationSign { Area="", Controller="login", Action="test3" }, }); _stateManager.Sigin(User); // return RedirectToAction("test1"); return(result.SetResult(1, "登入成功", "")); }
public HQResult <Authority_Account> Sigin(string Account, string Password) { HQResult <Authority_Account> result = new HQResult <Authority_Account>(); OrderManagementDB DBcontext = new OrderManagementDB(); var user = DBcontext.Authority_Account.Where(w => w.Account == Account && w.Pass == Password) .Include(p => p.RelatedRoles) .ThenInclude(p => p.Role) .ThenInclude(p => p.RelatedRoleBases) .ThenInclude(p => p.BasePer).FirstOrDefault(); if (user == null) { return(result.SetResult(-1, null)); } return(result.SetResult(1, "ok", user)); }
public HQResult <string> Sigout() { HQResult <string> result = new HQResult <string>(0, ""); _stateManager.Signout(); return(result.SetResult(1, "退出成功")); }
public HQResult <string> AddRole(string RoleName, string Description) { HQResult <string> result = new HQResult <string>(); OrderManagementDB DBcontext = new OrderManagementDB(); DBcontext.Authority_Role.Add(new Authority_Role { RoleName = RoleName, Description = Description }); DBcontext.SaveChanges(); return(result.SetResult(1, "ok")); }
public HQResult <string> AddAccount(string Account, string Name, string Pass) { HQResult <string> result = new HQResult <string>(); OrderManagementDB DBcontext = new OrderManagementDB(); DBcontext.Authority_Account.Add(new Authority_Account { Account = Account, Name = Name, Pass = Pass, }); DBcontext.SaveChanges(); return(result.SetResult(1, "ok")); }
public HQResult <string> RelatedPerBase(int RoleId, int BaseId) { HQResult <string> result = new HQResult <string>(); OrderManagementDB DBcontext = new OrderManagementDB(); DBcontext.Authority_RelatedRoleBasePer.Add(new OrderManagementModel.DBModel.Authority.Authority_RelatedRoleBasePer() { BasePerID = BaseId, RoleID = RoleId }); DBcontext.SaveChanges(); return(result.SetResult(1, "ok")); }
public HQResult <string> RelatedRole(int AccountId, int RoleId) { HQResult <string> result = new HQResult <string>(); OrderManagementDB DBcontext = new OrderManagementDB(); DBcontext.Authority_RelatedAccountRole.Add(new OrderManagementModel.DBModel.Authority.Authority_RelatedAccountRole() { AccountID = AccountId, RoleID = RoleId }); DBcontext.SaveChanges(); return(result.SetResult(1, "ok")); }