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(ViewModels.CdAddDTO model) { ViewModels.Message rsp = new ViewModels.Message(); DAL.cd cddal = new DAL.cd(); Model.cd cdmodel = new Model.cd(); //cdmodel.gnid = gnmodel.gnid; cdmodel.cdjb = model.cdjb; cdmodel.xtid = model.xtid; cdmodel.sjcdid = model.sjcdid; cdmodel.cdmc = model.cdmc; cdmodel.xsjb = model.xsjb; cdmodel.bhcdgn = model.bhcdgn; cdmodel.icon = model.icon; cdmodel.dkfs = model.dkfs; if (model.cdjb == 3) { BLL.Gnbll gnbll = new BLL.Gnbll(); Model.gn gnmodel = gnbll.getGnModelByName(model.controller, model.action); cdmodel.gnid = gnmodel.gnid; } if (cddal.Add(cdmodel) > 0) { rsp.sno = 1; } else { rsp.sno = 2; rsp.msg = "数据操作失败"; } return(Json(rsp, JsonRequestBehavior.DenyGet)); }
public ActionResult YhjsEdit(int yhid = 0, string jsids = "") { ViewModels.Message rsp = new ViewModels.Message(); DAL.yhjs yhjsdal = new DAL.yhjs(); if (yhid > 0) { //先删除用户所属角色 if (yhjsdal.deleteByYhid(yhid)) { if (!string.IsNullOrEmpty(jsids)) { //添加功能 string[] jsidArr = jsids.Split('#'); foreach (string jsid in jsidArr) { yhjsdal.Add(new Model.yhjs { yhid = yhid, jsid = Convert.ToInt32(jsid) }); } } rsp.sno = 1; } else { rsp.sno = 2; rsp.msg = "数据操作失败"; } } 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 JsgnEdit(int jsid, string gnids) { ViewModels.Message rsp = new ViewModels.Message(); DAL.jsgn jsgndal = new DAL.jsgn(); if (jsid > 0) { //先删除角色所有权限 if (jsgndal.deleteByJsid(jsid)) { if (!string.IsNullOrEmpty(gnids)) { //添加功能 string[] gnidArr = gnids.Split('#'); foreach (string gnid in gnidArr) { jsgndal.Add(new Model.jsgn { jsid = jsid, gnid = Convert.ToInt32(gnid) }); } } rsp.sno = 1; } else { rsp.sno = 2; rsp.msg = "数据操作失败"; } } else { rsp.sno = 2; rsp.msg = "未指定操作角色"; } return(Json(rsp, JsonRequestBehavior.DenyGet)); }
public ActionResult Edit(Model.js js) { ViewModels.Message rsp = new ViewModels.Message(); if (dal.Update(js)) { rsp.sno = 1; } else { rsp.sno = 2; rsp.msg = "数据操作失败"; } return(Json(rsp, JsonRequestBehavior.DenyGet)); }
public ActionResult Delete(int yhid) { ViewModels.Message rsp = new ViewModels.Message(); if (dal.Delete(yhid)) { rsp.sno = 1; rsp.msg = "成功"; } else { rsp.sno = 0; rsp.msg = "数据操作失败"; } return(Json(rsp, JsonRequestBehavior.DenyGet)); }
public ActionResult YhGnList(int[] gnids) { ViewModels.Message b = new ViewModels.Message(); int yhid = 1;//要从用户登录信息中获取 DAL.yhgn yhgndal = new DAL.yhgn(); foreach (int gnid in gnids) { yhgndal.Add(new Model.yhgn { yhid = yhid, gnid = gnid }); } b.sno = 1; return(Json(b, JsonRequestBehavior.DenyGet)); }
public ActionResult Add(Model.js model) { ViewModels.Message b = new ViewModels.Message(); if (ModelState.IsValid) { if (dal.Add(model) > 0) { b.sno = 1; } else { b.sno = 3; b.msg = "数据操作失败"; } } else { b.sno = 2; b.msg = "数据校验失败"; } return(Json(b, JsonRequestBehavior.DenyGet)); }