public ActionResult UserIndex() { UserListViewModel ulvm = new UserListViewModel(); UserBusinessLayer ubl = new UserBusinessLayer(); List <UserProfile> users = ubl.GetUsers(); List <UserViewModel> uvmlist = new List <UserViewModel>(); foreach (UserProfile user in users) { if (!user.isDeleteUser) { UserViewModel uvm = new UserViewModel(); uvm.UserId = user.UserId; uvm.UserName = user.UserName; uvm.isUploadPM = user.isUploadPM; uvm.isSearchPM = user.isSearchPM; uvm.isModifyPM = user.isModifyPM; uvm.isDeletePM = user.isDeletePM; uvmlist.Add(uvm); } } ulvm.UserList = uvmlist; ulvm.isAdmin = true; return(View("UserIndex", ulvm)); }
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 GetUsers() { List <UserDetails> userDList = new List <UserDetails>(); UserListViewModel userLVM = new UserListViewModel(); UserBusinessLayer userBAL = new UserBusinessLayer(); List <UserViewModel> uvmList = new List <UserViewModel>(); userDList = userBAL.GetUsers(); for (int i = 0; i < userDList.Count; i++) { UserViewModel uvm = new UserViewModel(); uvm.UserName = userDList[i].UserName; uvm.Password = userDList[i].Password; uvm.userStatus = (UserStatus)userDList[i].userStatus; uvmList.Add(uvm); } userLVM.users = uvmList; return(View("GetUsers", userLVM)); }
/// <summary> /// 返回在存的全部数据 /// </summary> /// <param name="U_name"></param> /// <returns></returns> public StorageViewModel GetStorageViewModel(bool Display, string U_name, int pageNumber = 1) { StorageViewModel storageViewModel = new StorageViewModel(); storageViewModel.UserName = U_name; storageViewModel.existTableListViewModel = new ExistTableListViewModel(); storageViewModel.existTableListViewModel.Display = Display ? "" : "none"; //storageViewModel.existTableListViewModel.existTableViewModels = new List<ExistTableViewModel>(); List <ExistTableViewModel> existTableViewModels = new List <ExistTableViewModel>(); ExistBusinessLayer existBusinessLayer = new ExistBusinessLayer(); CommodityBusinessLayer commodityBusinessLayer = new CommodityBusinessLayer(); OutIntoWareBusinessLayer outIntoWareBusinessLayer = new OutIntoWareBusinessLayer(); UserBusinessLayer userBusinessLayer = new UserBusinessLayer(); WarehouseBusinessLayer warehouseBusinessLayer = new WarehouseBusinessLayer(); //得到全部在存表中的数据 List <Exist> exists = existBusinessLayer.GetExist(); //Out_Into_ware out_Into_Ware; ExistTableViewModel existTableViewModel; foreach (Exist item in exists) { existTableViewModel = new ExistTableViewModel(); existTableViewModel.exist = item; //out_Into_Ware = outIntoWareBusinessLayer.GetOut_Into_ware(item.IO_Id); //得到姓名 existTableViewModel.U_name = userBusinessLayer.GetUsers("员工编号", item.U_id.ToString()).FirstOrDefault().U_name; //得到仓库名 existTableViewModel.W_name = warehouseBusinessLayer.GetWarehouse("仓库编号", item.W_id.ToString()).FirstOrDefault().Wa_name; existTableViewModel.commodity = commodityBusinessLayer.GetCommodity("商品编号", item.Co_id.ToString()).FirstOrDefault(); //storageViewModel.existTableListViewModel.existTableViewModels.Add(existTableViewModel); existTableViewModels.Add(existTableViewModel); } //每页显示多少条 //int pageSize = int.Parse(ConfigurationManager.AppSettings["pageSize"]); storageViewModel.existTableListViewModel.existTableViewModels = existTableViewModels; return(storageViewModel); }
//[HttpGet] public ActionResult RedirectStorage(int?page) { MyStorageBusinessLayer storageBusinessLayer = new MyStorageBusinessLayer(); //判断是否为管理员,是管理员则为空,不是则为none,对应修改按钮是否显示 bool Display = (level.Admin == (level)Session["level"]); //获取显示的数据 StorageViewModel storageViewMode1; int pageSize = int.Parse(ConfigurationManager.AppSettings["pageSize"]); int pageNumber = page ?? 1; while (IsSearchExist) { //获取user id string U_id = null; if (!S_userMember.Equals(new UserMember())) { if (S_userMember.U_Id != "" || S_userMember.U_name != "") { UserBusinessLayer userBusinessLayer = new UserBusinessLayer(); List <User> users = userBusinessLayer.GetUsers(S_userMember); if (users == null) { break; } U_id = users.FirstOrDefault().U_Id.ToString(); } } //获取全部exist的数据 storageViewMode1 = storageBusinessLayer.GetStorageViewModel(Display, Session["User"].ToString(), pageNumber); //获取comm id集合 List <Commodity> commodities = new List <Commodity>(); if (!S_commodityMember.Equals(new CommodityMember())) { CommodityBusinessLayer commodityBusinessLayer = new CommodityBusinessLayer(); commodities = commodityBusinessLayer.GetCommodities(S_commodityMember); } //获取ware id集合 List <Warehouse> warehouses = new List <Warehouse>(); if (!S_warehouseMember.Equals(new WarehouseMember())) { WarehouseBusinessLayer warehouseBusinessLayer = new WarehouseBusinessLayer(); warehouses = warehouseBusinessLayer.GetWarehouse(S_warehouseMember); } bool[] k = new bool[4]; ExistTableViewModel existTableViewModel; for (int i = storageViewMode1.existTableListViewModel.existTableViewModels.Count() - 1; i >= 0; i--) { k[0] = k[1] = k[2] = k[3] = true; existTableViewModel = storageViewMode1.existTableListViewModel.existTableViewModels[i]; //是否符合物品条件 if (U_id == null || existTableViewModel.exist.U_id.ToString() == U_id) { k[0] = false; } //是否符合物品条件 if (commodities != null && commodities.Count() > 0) { foreach (Commodity commodity in commodities) { if (commodity.Co_Id == existTableViewModel.exist.Co_id) { k[1] = false; break; } } } else { k[1] = false; } //是否符合仓库条件 if (warehouses != null && warehouses.Count() > 0) { foreach (Warehouse warehouse in warehouses) { if (warehouse.Wa_Id == existTableViewModel.exist.W_id) { k[2] = false; break; } } } else { k[2] = false; } //是否符合时间区间 DateTime dateTime = new DateTime(); if ((S_existMember.Star_date.Equals(dateTime.ToString()) || DateTime.Compare(Convert.ToDateTime(S_existMember.Star_date), existTableViewModel.exist.IntoDate) != 1) && (S_existMember.End_date.Equals(dateTime.ToString()) || DateTime.Compare(Convert.ToDateTime(S_existMember.End_date), existTableViewModel.exist.IntoDate) != -1)) { k[3] = false; } //整合条件 if (k[0] || k[1] || k[2] || k[3]) { storageViewMode1.existTableListViewModel.existTableViewModels.Remove(existTableViewModel); } } // storageViewMode1 = storageBusinessLayer.GetStorageViewModel(Display, Session["User"].ToString()); storageViewMode1.existTableListViewModel.iPagedLists = storageViewMode1.existTableListViewModel.existTableViewModels.ToPagedList(pageNumber, pageSize); return(View("Storage", storageViewMode1)); } storageViewMode1 = storageBusinessLayer.GetStorageViewModel(Display, Session["User"].ToString()); storageViewMode1.existTableListViewModel.iPagedLists = storageViewMode1.existTableListViewModel.existTableViewModels.ToPagedList(pageNumber, pageSize); return(View("Storage", storageViewMode1)); }
/// <summary> /// 得到符合条件的在存数据 /// </summary> /// <param name="U_name">登陆人</param> /// <param name="Select">属性</param> /// <param name="name">属性值</param> /// <returns></returns> public StorageViewModel GetStorageViewModel(bool Display, string U_name, string Select, string name, int pageNumber = 1) { StorageViewModel storageViewModel = new StorageViewModel(); storageViewModel.UserName = U_name; storageViewModel.existTableListViewModel = new ExistTableListViewModel(); storageViewModel.existTableListViewModel.Display = Display ? "" : "none"; //storageViewModel.existTableListViewModel.existTableViewModels = new List<ExistTableViewModel>(); List <ExistTableViewModel> existTableViewModels = new List <ExistTableViewModel>(); ExistBusinessLayer existBusinessLayer = new ExistBusinessLayer(); CommodityBusinessLayer commodityBusinessLayer = new CommodityBusinessLayer(); OutIntoWareBusinessLayer outIntoWareBusinessLayer = new OutIntoWareBusinessLayer(); UserBusinessLayer userBusinessLayer = new UserBusinessLayer(); WarehouseBusinessLayer warehouseBusinessLayer = new WarehouseBusinessLayer(); //得到全部在存表中的数据 List <Exist> exists; if (Select == "入库单号" || Select == "商品编号") { exists = existBusinessLayer.GetExist(Select, name); } else { exists = existBusinessLayer.GetExist(); } //Out_Into_ware out_Into_Ware; ExistTableViewModel existTableViewModel; foreach (Exist item in exists) { existTableViewModel = new ExistTableViewModel(); existTableViewModel.exist = item; //out_Into_Ware = outIntoWareBusinessLayer.GetOut_Into_ware(item.IO_Id); //得到姓名 existTableViewModel.U_name = userBusinessLayer.GetUsers("员工编号", item.U_id.ToString()).FirstOrDefault().U_name; if (Select == "入库员工" && existTableViewModel.U_name != name) { continue; } //得到仓库名 existTableViewModel.W_name = warehouseBusinessLayer.GetWarehouse("仓库编号", item.W_id.ToString()).FirstOrDefault().Wa_name; if (Select == "存储仓库" && existTableViewModel.W_name != name) { continue; } //existTableViewModel.commodity = commodityBusinessLayer.GetCommodity("商品编号", item.Co_id.ToString()).FirstOrDefault(); CommodityMember commodityMember = new CommodityMember(); switch (Select) { case "商品编号": commodityMember.Co_Id = name; break; case "商品名称": commodityMember.Co_name = name; break; case "条码编号": commodityMember.Co_bar_code = name; break; case "商品分类": commodityMember.Co_type = name; break; } existTableViewModel.commodity = commodityBusinessLayer.GetCommodities(commodityMember).FirstOrDefault(); //storageViewModel.existTableListViewModel.existTableViewModels.Add(existTableViewModel); existTableViewModels.Add(existTableViewModel); } //每页显示多少条 //int pageSize = int.Parse(ConfigurationManager.AppSettings["pageSize"]); storageViewModel.existTableListViewModel.existTableViewModels = existTableViewModels; return(storageViewModel); }