/// <summary> /// 登录 /// </summary> /// <returns></returns> public ActionResult UserLogin(LoginRequest login) { if (Request.HttpMethod == "POST") { Response <User> response = new Entity.Response <User>(); Request <LoginRequest> request = new Entity.Request <LoginRequest>(); LoginRequest data = new LoginRequest() { UserName = login.UserName, TrueName = login.TrueName, TellPhone = login.TellPhone, PassWord = login.PassWord }; request.Data = data; request.RequestKey = Guid.NewGuid().ToString(); request.RequsetTime = DateTime.Now; response = logic.UserLogin(request); if (response != null && response.IsSuccess) { TempData["User"] = response.Result; return(Json(new { response.Result })); } else { return(Json(new { response.ErrorMsg })); } } else { return(View()); } }
/// <summary> /// 添加加班记录 /// </summary> /// <param name="data"></param> /// <returns></returns> public ActionResult AddJB(JBRecord data) { if (Request.HttpMethod == "POST") { Response response = new Entity.Response(); Request <JBRecord> request = new Request <JBRecord>(); request.Data = data; request.RequestKey = Guid.NewGuid().ToString(); request.RequsetTime = DateTime.Now; response = logic.AddJBRecord(request); return(Json(new { response })); } else { return(View()); } }
public ActionResult UserEdit(User user) { if (Request.HttpMethod == "POST") { Response response = new Entity.Response(); Request <User> request = new Request <Entity.User>(); request.Data = user; request.RequestKey = Guid.NewGuid().ToString(); request.RequsetTime = DateTime.Now; response = logic.EditUser(request); return(Json(new { response.IsSuccess })); } else { return(View()); } }
/// <summary> /// 注册 /// </summary> /// <returns></returns> public ActionResult UserRegist(User user) { try { if (Request.HttpMethod == "POST") { Response response = new Entity.Response(); Request <User> request = new Entity.Request <User>(); User data = new Entity.User() { UserName = user.UserName, TrueName = user.TrueName, PassWord = user.PassWord, TellPhone = user.TellPhone, Department = user.Department, Status = user.Status, //ExistHours = 0, Remark = user.Remark, AddTime = DateTime.Now, ModifiedTime = DateTime.Now }; request.Data = data; request.RequestKey = Guid.NewGuid().ToString(); request.RequsetTime = DateTime.Now; response = logic.AddUser(request); if (response != null && response.IsSuccess) { return(Json(response.IsSuccess, JsonRequestBehavior.AllowGet)); //return Json(new { data = list }); } else { return(Json(response.IsSuccess)); } } else { return(View()); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 删除加班记录 /// </summary> /// <param name="data"></param> /// <returns></returns> public ActionResult DeleteJB(JBRecord data) { if (Request.HttpMethod == "POST") { Response response = new Entity.Response(); if (data != null) { Request <int> request = new Request <int>(); request.Data = data.JID; request.RequestKey = Guid.NewGuid().ToString(); request.RequsetTime = DateTime.Now; response = logic.DelJBRecord(request); } return(Json(new { response })); } else { return(View()); } }
public ActionResult UserDelete(User user) { if (Request.HttpMethod == "POST") { Response response = new Entity.Response(); if (user != null) { Request <int> request = new Request <int>(); request.Data = user.UserID; request.RequestKey = Guid.NewGuid().ToString(); request.RequsetTime = DateTime.Now; response = logic.DelUser(request); } return(Json(new { response })); } else { return(View()); } }