public ActionResult Login(FormCollection fc) { ViewModels.Message rsp = new ViewModels.Message(); string username = fc["yhmc"]; string password = fc["yhmm"]; //ViewBa.LgoginState = "登录后:"+username+","+password; DAL.yh yhdal = new DAL.yh(); Model.yh yh = yhdal.GetModelByYhmc(username); if (yh != null && yh.yhmm == Utils.MD5(password)) { FormsAuthentication.SetAuthCookie(username, false); //设置Session ViewModels.YhSession yhSession = new ViewModels.YhSession() { yh = yh, currentXtid = 8 }; Session["yhsession"] = yhSession; //跳转 //return RedirectToAction("Index"); rsp.sno = 1; } else { rsp.sno = 2; rsp.msg = "用户名或密码错误"; } return(Json(rsp, JsonRequestBehavior.DenyGet)); }
public ActionResult Add(Model.yh yh) { ViewModels.Message rsp = new ViewModels.Message(); if (yh == null) { rsp.sno = 0; rsp.msg = "未输入用户信息"; } else { yh.yhmm = Utils.MD5(yh.yhmm); if (dal.Add(yh) > 0) { rsp.sno = 1; rsp.msg = "成功"; } else { rsp.sno = 0; rsp.msg = "数据操作失败"; } } return(Json(rsp, JsonRequestBehavior.DenyGet)); }
public ActionResult List() { //返回系统用户列表 DataSet ds = dal.GetList(""); List <Model.yh> yhs = new List <Model.yh>(); foreach (DataRow dr in ds.Tables[0].Rows) { Model.yh yh = dal.DataRowToModel(dr); yhs.Add(yh); } return(View(yhs)); }
public ActionResult Edit(int yhid) { ViewModels.YhEditDTO yheditdto = new ViewModels.YhEditDTO(); Model.yh yh = dal.GetModel(yhid); //用户功能 BLL.Yhbll yhbll = new BLL.Yhbll(); List <ViewModels.YhgnDTO> yhgns = yhbll.getYhgnDTO(yhid); //用户角色 List <ViewModels.YhjsDTO> yhjss = yhbll.getYhjsDTO(yhid); yheditdto.yh = yh; yheditdto.yhgns = yhgns; yheditdto.yhjss = yhjss; return(View(yheditdto)); }