public ActionResult RequestModify() { dto_ModifyRequest drm = B_User.GetModifyRequest(UserId); if (drm != null) { drm.FromSchoolName = B_BaseRedis.GetSchool(drm.FromSchoolId).SchoolName; drm.ToSchoolName = B_BaseRedis.GetSchool(drm.ToSchoolId).SchoolName; } ViewBag.Model = drm; ViewBag.Provinces = Const.Provinces; return(PartialView()); }
public static dto_ModifyRequest GetModifyRequest(int userId) { dto_ModifyRequest model = null; using (MySqlDataReader dr = MySqlHelper.ExecuteReader(Util.GetConnectString(UserConnString), "select Id, UserId, FromSchoolId, ToSchoolId, Reason, Status, CreateDate from T_ModifyRequest where UserId = @UserId and Status = 0 limit 1", "@UserId".ToInt32InPara(userId))) { if (dr != null && dr.HasRows) { model = MySqlDBHelper.ConvertDataReaderToEntitySingle <dto_ModifyRequest>(dr); } } return(model); }
public JsonResult AddModifyRequest(int schoolId, string reason) { dto_User u = B_UserRedis.GetUser(UserId); dto_ModifyRequest mr = new dto_ModifyRequest() { UserId = UserId, FromSchoolId = u.SchoolId, ToSchoolId = schoolId, Reason = reason, CreateDate = DateTime.Now, Status = 0 }; int i = B_User.AddModifyRequest(mr); if (i != 0) { mr.Id = i; mr.CreateDateStr = mr.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"); mr.FromSchoolName = B_BaseRedis.GetSchool(mr.FromSchoolId).SchoolName; mr.ToSchoolName = B_BaseRedis.GetSchool(mr.ToSchoolId).SchoolName; return(Json(mr)); } return(null); }