using System.Collections.Generic;
|
using System.Linq;
|
using Common;
|
using Model;
|
using Lib;
|
using BLL;
|
using System.Web.Mvc;
|
using System;
|
|
namespace wms
|
|
{
|
public class HomeController : MasterPage
|
{
|
// GET: Home
|
[LoginFilter]
|
public ActionResult Index()
|
{
|
return View();
|
}
|
|
public ActionResult LoginOut()
|
{
|
//return Redirect("/Login/Login");
|
return Redirect("/Login/Login");
|
}
|
|
[LoginFilter]
|
public ActionResult UserList()
|
{
|
ViewBag.DepartList = LocalHelper.GetDepartList(string.Empty);
|
ViewBag.RoleList = LocalHelper.GetRoleList(string.Empty);
|
return View();
|
}
|
|
[LoginFilter]
|
public ActionResult AddUser()
|
{
|
string userCode = Request.QueryString.Get("UserCode");
|
if (userCode.IsEmpty())
|
{
|
ViewBag.DepartList = LocalHelper.GetDepartList(string.Empty);
|
ViewBag.RoleList = LocalHelper.GetRoleList(string.Empty);
|
ViewBag.Admin = new UserInfo();
|
|
}
|
else
|
{
|
IDALUserInfo provider = new DALUserInfo();
|
UserInfo entity = provider.GetModel(userCode);
|
entity = entity == null ? new UserInfo() : entity;
|
ViewBag.RoleList = LocalHelper.GetRoleList(entity.RoleName);
|
ViewBag.DepartList = LocalHelper.GetDepartList(entity.DepartName);
|
ViewBag.Admin = entity;
|
|
}
|
return View();
|
}
|
|
[LoginFilter]
|
public ActionResult AdminPass()
|
{
|
return View();
|
}
|
[LoginFilter]
|
public ActionResult ChangePass()
|
{
|
return View();
|
}
|
|
[LoginFilter]
|
public ActionResult RoleList()
|
{
|
return View();
|
}
|
|
[LoginFilter]
|
public ActionResult AddRole()
|
{
|
string RoleNum = Request.QueryString.Get("RoleNum");
|
if (RoleNum.IsEmpty())
|
{
|
ViewBag.Role = new Roles();
|
}
|
else
|
{
|
IDALRoles provider = new DALRoles();
|
Roles entity = provider.GetModel(RoleNum);
|
entity = entity == null ? new Roles() : entity;
|
ViewBag.Role = entity;
|
|
}
|
return View();
|
|
}
|
|
[LoginFilter]
|
public ActionResult DepartMentList()
|
{
|
return View();
|
}
|
|
[LoginFilter]
|
public ActionResult AddDepartMent()
|
{
|
string DepartNum = Request.QueryString.Get("DepartNum");
|
if (DepartNum.IsEmpty())
|
{
|
ViewBag.Depart = new DepartMent();
|
}
|
else
|
{
|
IDALDepartMent provider = new DALDepartMent();
|
DepartMent entity = provider.GetModel(DepartNum);
|
entity = entity == null ? new DepartMent() : entity;
|
ViewBag.Depart = entity;
|
|
}
|
return View();
|
}
|
|
[LoginFilter]
|
public ActionResult ResMenuList()
|
{
|
return View();
|
}
|
[LoginFilter]
|
public ActionResult AddResMenu()
|
{
|
string ResNum = Request.QueryString.Get("ResNum");
|
if (ResNum.IsEmpty())
|
{
|
ViewBag.ResParentMenu = LocalHelper.GetResMenuList(string.Empty);
|
ViewBag.ResMenu = new ResMenu();
|
|
}
|
else
|
{
|
IDALResMenu provider = new DALResMenu();
|
ResMenu entity = provider.GetModel(ResNum);
|
entity = entity == null ? new ResMenu() : entity;
|
ViewBag.ResParentMenu = LocalHelper.GetResMenuList(entity.ParentName);
|
ViewBag.ResMenu = entity;
|
|
}
|
return View();
|
}
|
|
public ActionResult RolePermisson()
|
{
|
return View();
|
}
|
|
public ActionResult GetBtn()
|
{
|
var dd = Request["UserCode"];
|
var dd2 = Request["Title"];
|
if (UserBtn != null)
|
{
|
// if (dd.ToString() == UserBtn.UserCode && !(dd2.ToString()).IsEmpty())
|
if (!(dd2.ToString()).IsEmpty())
|
{
|
List<GetBtn> btns = UserBtn.Btns.Where(a => a.PrantName == dd2.ToString()).ToList<GetBtn>();
|
|
if (btns == null) return Content(null);
|
|
List<PriBtns> lbts = new List<PriBtns>();
|
|
//Hashtable ht = new Hashtable();
|
PriBtns pbts = new PriBtns();
|
pbts.Name = "add";
|
pbts.Css = btns[0].Add;
|
lbts.Add(pbts);
|
|
PriBtns pbts1 = new PriBtns();
|
pbts1.Name = "edit";
|
pbts1.Css = btns[0].Edit;
|
lbts.Add(pbts1);
|
|
PriBtns pbts2 = new PriBtns();
|
pbts2.Name = "del";
|
pbts2.Css = btns[0].Del;
|
lbts.Add(pbts2);
|
|
PriBtns pbts3 = new PriBtns();
|
pbts3.Name = "audit";
|
pbts3.Css = btns[0].Audit;
|
lbts.Add(pbts3);
|
|
PriBtns pbts4 = new PriBtns();
|
pbts4.Name = "delete";
|
pbts4.Css = btns[0].Del;
|
lbts.Add(pbts4);
|
|
PriBtns pbts5 = new PriBtns();
|
pbts5.Name = "print";
|
pbts5.Css = btns[0].Print;
|
lbts.Add(pbts5);
|
|
PriBtns pbts6 = new PriBtns();
|
pbts6.Name = "reset";
|
pbts6.Css = btns[0].Reset;
|
lbts.Add(pbts6);
|
|
PriBtns pbts7 = new PriBtns();
|
pbts7.Name = "permission";
|
pbts7.Css = btns[0].Permission;
|
lbts.Add(pbts7);
|
|
|
PriBtns pbts8 = new PriBtns();
|
pbts8.Name = "input";
|
pbts8.Css = btns[0].Input;
|
lbts.Add(pbts8);
|
|
PriBtns pbts9 = new PriBtns();
|
pbts9.Name = "output";
|
pbts9.Css = btns[0].Output;
|
lbts.Add(pbts9);
|
|
PriBtns pbts10 = new PriBtns();
|
pbts10.Name = "stocktaking";
|
pbts10.Css = btns[0].Stocktaking;
|
lbts.Add(pbts10);
|
|
PriBtns pbts11 = new PriBtns();
|
pbts11.Name = "buildtask";
|
pbts11.Css = btns[0].Buildtask;
|
lbts.Add(pbts11);
|
|
PriBtns pbts12 = new PriBtns();
|
pbts12.Name = "setstock";
|
pbts12.Css = btns[0].Setstock;
|
lbts.Add(pbts12);
|
|
PriBtns pbts13 = new PriBtns();
|
pbts13.Name = "out";
|
pbts13.Css = btns[0].Out;
|
lbts.Add(pbts13);
|
|
PriBtns pbts14 = new PriBtns();
|
pbts14.Name = "send";
|
pbts14.Css = btns[0].Send;
|
lbts.Add(pbts14);
|
|
PriBtns pbts15 = new PriBtns();
|
pbts15.Name = "complete";
|
pbts15.Css = btns[0].Complete;
|
lbts.Add(pbts15);
|
|
PriBtns pbts16 = new PriBtns();
|
pbts16.Name = "cancel";
|
pbts16.Css = btns[0].Cancel;
|
lbts.Add(pbts16);
|
|
PriBtns pbts17 = new PriBtns();
|
pbts17.Name = "jiePi";
|
pbts17.Css = btns[0].jiePi;
|
lbts.Add(pbts17);
|
|
PriBtns pbts18 = new PriBtns();
|
pbts18.Name = "run";
|
pbts18.Css = btns[0].run;
|
lbts.Add(pbts18);
|
|
string json = JsonHelper.IListToJson(lbts, "List");
|
|
return Content(json);
|
}
|
}
|
|
|
return Content(null);
|
}
|
/// <summary>
|
/// 判断密码使用时间是否大于30
|
/// </summary>
|
/// <returns></returns>
|
public ActionResult IsPasswordExpired()
|
{
|
string json = "False";
|
if (LoginUser != null)
|
{
|
var UpdateTime = LoginUser.UpdateTime;
|
var NowTime = DateTime.Now;
|
TimeSpan span = NowTime.Subtract(UpdateTime);
|
if (span.Days + 1 > 30)
|
{
|
json = "True";
|
}
|
}
|
|
return Content(json);
|
}
|
|
public ActionResult Top()
|
{
|
return View();
|
}
|
public ActionResult Left()
|
{
|
return View();
|
}
|
public ActionResult Right()
|
{
|
return View();
|
}
|
public ActionResult Title()
|
{
|
return View();
|
}
|
public ActionResult HomeIframe()
|
{
|
return View();
|
}
|
}
|
}
|