public InformationViewModel getInformationViewModel(string name, string passwrd, string select = "", string uname = "") { //个人信息页面视图模型 InformationViewModel informationViewModel = new InformationViewModel(); //用户信息 UserBusinessLayer userBusinessLayer = new UserBusinessLayer(); informationViewModel.createUserViewModel = new CreateUserViewModel(); informationViewModel.createUserViewModel.user = userBusinessLayer.GetUser(name);//得到当前登录者的用户信息 //用户是管理者的时候,可以得到所有的用户信息 if (select != "") { informationViewModel.users = userBusinessLayer.GetUsers(select, uname);//得到指定条件的人 } else if (informationViewModel.createUserViewModel.user.U_level == level.Admin) { informationViewModel.users = userBusinessLayer.GetUser(); } else { informationViewModel.users = new List <User>(); } return(informationViewModel); }
public ActionResult UserTable(int?page) { //如果Session["UserTable"]为true,则显示usertable,每次都触发information都给改变Session["UserTable"]取反 if (Session["UserTable"] != null && Convert.ToBoolean(Session["UserTable"])) { //UserListViewModel userListViewModel = new UserListViewModel(); //UserBusinessLayer userBusinessLayer = new UserBusinessLayer(); //userListViewModel.users = userBusinessLayer.GetUser(); //第几页 int pageNumber = page ?? 1; //每页显示多少条 int pageSize = int.Parse(ConfigurationManager.AppSettings["pageSize"]); UserListViewModel userListViewModel = new UserListViewModel(); UserBusinessLayer userBusinessLayer = new UserBusinessLayer(); if (IsSearchPeople) { userListViewModel.users = userBusinessLayer.GetUsers(S_select, S_name).ToPagedList(pageNumber, pageSize);//得到指定条件的人; } else { userListViewModel.users = userBusinessLayer.GetUser().ToPagedList(pageNumber, pageSize); } return(PartialView("UserTable", userListViewModel)); } Session["UserTable"] = false; return(new EmptyResult()); }
public ActionResult SavePermission() { int UserId = int.Parse(Request["UserId"]); var result = new { err = false, message = "no err" }; UserBusinessLayer ubl = new UserBusinessLayer(); UserProfile user = ubl.GetUser(UserId); if (user == null || user.isDeleteUser) { return(HttpNotFound()); } user.isSearchPM = bool.Parse(Request["isSearchPM"]); user.isUploadPM = bool.Parse(Request["isUploadPM"]); user.isModifyPM = bool.Parse(Request["isModifyPM"]); user.isDeletePM = bool.Parse(Request["isDeletePM"]); user = ubl.ModifyUser(user); if (user.isDeleteUser) { result = new { err = true, message = "Error occurs, modify failed" }; return(Json(result)); } return(Json(result)); }
//id should be stored in session state //output user table info public ActionResult Index(int id) { UserBusinessLayer userBusinessLayer = new UserBusinessLayer(); User user = userBusinessLayer.GetUser(id); return(View(user)); }
public ActionResult AddNew() { CreateUserViewModel v = new CreateUserViewModel(); UserBusinessLayer userBusinessLayer = new UserBusinessLayer(); v.user = userBusinessLayer.GetUser(Session["User"].ToString()); return(PartialView("CreateUser", v)); }
public ActionResult UpdataUser() { //return PartialView(); CreateUserViewModel createUserViewModel = new CreateUserViewModel(); UserBusinessLayer userBusinessLayer = new UserBusinessLayer(); createUserViewModel.user = userBusinessLayer.GetUser(Session["User"].ToString()); return(PartialView("UpdataUser", createUserViewModel)); }
//[MultiButton("入库")] public ActionResult MakeTableSubmit(string Sumbit) { if (Sumbit == null && IsIntoOutWaretor) { return(new EmptyResult()); } Session["Table_Id"] = null; //string Sumbit = "入库"; Out_Into_ware out_Into_Ware = new Out_Into_ware(); out_Into_Ware.Make_date = DateTime.Now;//时间 UserBusinessLayer userBusinessLayer = new UserBusinessLayer(); WarehouseBusinessLayer warehouseBusinessLayer = new WarehouseBusinessLayer(); OutIntoWareBusinessLayer outIntoWareBusinessLayer1 = new OutIntoWareBusinessLayer(); User user = userBusinessLayer.GetUser(Session["User"].ToString()); out_Into_Ware.User_id = user.U_Id; //负责人编号 out_Into_Ware.Ware_id = warehouseBusinessLayer.GetId(user.U_point); //仓库编号 //创建表单号 Table_Id = "12343"; if (Sumbit == "商品入库") { I_type = "入库"; IsIntoOutWaretor = true; out_Into_Ware.type = IO_Type.INTO; //out_Into_Ware.Table_Id = "INTO" + Table_Id; out_Into_Ware.Table_Id = outIntoWareBusinessLayer1.GetMaxTable(IO_Type.INTO); } else if (Sumbit == "商品出库") { I_type = "出库"; IsIntoOutWaretor = true; out_Into_Ware.type = IO_Type.OUT; //out_Into_Ware.Table_Id = "OUT" + Table_Id; out_Into_Ware.Table_Id = outIntoWareBusinessLayer1.GetMaxTable(IO_Type.OUT); } //Session["Table_Id"] = out_Into_Ware.Table_Id; Table_Id = out_Into_Ware.Table_Id; //存入数据库 OutIntoWareBusinessLayer outIntoWareBusinessLayer = new OutIntoWareBusinessLayer(); outIntoWareBusinessLayer.InsertOut_Into_ware(out_Into_Ware); return(RedirectToAction("RedirectInOutWarehouse")); }
public ActionResult DoLogin(LoginUserViewModel loginUser, string submitAction) { switch (submitAction) { case "Login": UserBusinessLayer bl = new UserBusinessLayer(); User user = bl.GetUser(loginUser.UserName, loginUser.Password); if (user == null) { return(View("Index", loginUser)); } FormsAuthentication.SetAuthCookie(user.UserName, false); return(RedirectToAction("Index", "User")); default: return(View("Index", new LoginUserViewModel())); } }
public ActionResult Delete(FormCollection fcNotUsed, int id) { UserBusinessLayer ubl = new UserBusinessLayer(); UserProfile user = ubl.GetUser(id); if (user == null || user.isDeleteUser) { return(HttpNotFound()); } user.isDeleteUser = true; ubl.ModifyUser(user); if (!user.isDeleteUser) { return(Content("Error occurs")); } return(RedirectToAction("UserIndex")); }
public ActionResult UpdataUser(User user, string BtnSubmit) { //给Session["UserTable"]取反,使重定向后依然能够显示usertable //Session["UserTable"] = !Convert.ToBoolean(Session["UserTable"]); //Session["LoginRecord"] = !Convert.ToBoolean(Session["LoginRecord"]); UserBusinessLayer userBusinessLayer = new UserBusinessLayer(); if (BtnSubmit == "提交更改") { //userBusinessLayer.InsertUser(user); userBusinessLayer.UpdataUsers(Session["User"].ToString(), user); return(RedirectToAction("Information")); } else if (BtnSubmit == "取消") { return(RedirectToAction("Information")); } //UpdataUser不需要控制器来决定,这段代码没用 CreateUserViewModel createUserViewModel = new CreateUserViewModel(); createUserViewModel.user = userBusinessLayer.GetUser(Session["User"].ToString()); return(PartialView("UpdataUser", createUserViewModel)); }