public ActionResult GetUserInfoById(int id) { Ren _ren = unitOfWork.rensRepository.GetByID(id); string json = JsonHelper.JsonSerializerBySingleData(_ren); return(Content(json)); }
public ActionResult Shenqing(int?id) { Message msg = new Message(); if (id == null) { msg.MessageStatus = "false"; msg.MessageInfo = "找不到ID"; } else { Ren ren = unitOfWork.rensRepository.GetByID(id); if (!ren.RenQuanxian.Contains("peiduren")) { ren.RenQuanxian = ren.RenQuanxian + ",peiduren"; ren.PeiduStatus = "shenqing"; } unitOfWork.rensRepository.Update(ren); unitOfWork.Save(); msg.MessageStatus = "true"; msg.MessageInfo = "申请成功"; } return(Json(msg, JsonRequestBehavior.AllowGet)); }
public static Ren GetRenById(int id) { UnitOfWork unitOfWork = new UnitOfWork(); Ren ren = unitOfWork.rensRepository.GetByID(id); return(ren); }
public ActionResult ShengjiPeibanshi() { string userAgent = Request.UserAgent; string CODE = Request["code"]; string STATE = Request["state"]; if (string.IsNullOrEmpty(CODE)) { return(RedirectToAction("WechatLogin", new { redirectUrl = "http://peiban.zzd123.com/Ucenter/ShengjiPeibanshi" })); } else { WebchatJsUserinfo userinfo = WechatJsServices.GetUserInfo(userAgent, CODE); var wxusers = unitOfWork.rensRepository.Get(filter: u => u.RenOpenid == userinfo.openid); if (wxusers.Count() > 0) { Ren ren = wxusers.First(); ViewData["renuser"] = ren; return(View()); } else { //你尚未注册 return(RedirectToAction("Register", "Ucenter")); } } }
public ActionResult UCenter(int?page) { if (Session["uid"].ToString() != "" && Session["uid"] != null) { int uid = int.Parse(Session["uid"].ToString()); Ren ren = unitOfWork.rensRepository.GetByID(uid); ViewData["user"] = ren; var yings = unitOfWork.yingsRepository.Get(); Pager pager = new Pager(); pager.table = "YingList"; pager.strwhere = "Canjiaren=" + int.Parse(Session["uid"].ToString()); pager.PageSize = 15; pager.PageNo = page ?? 1; pager.FieldKey = "Id"; pager.FiledOrder = "Id desc"; pager = CommonDal.GetPager(pager); IList <YingList> dataList = DataConvertHelper <YingList> .ConvertToModel(pager.EntityDataTable); var PageList = new StaticPagedList <YingList>(dataList, pager.PageNo, pager.PageSize, pager.Amount); ViewBag.Amount = pager.Amount; return(View(PageList)); } else { return(RedirectToAction("Login", "Account")); } }
public ActionResult AccountSet() { int rid = int.Parse(Session["renid"].ToString()); Ren ren = unitOfWork.rensRepository.GetByID(rid); return(View(ren)); }
public ActionResult UserInfo() { int rid = int.Parse(Session["renid"].ToString()); Ren ren = unitOfWork.rensRepository.GetByID(rid); ViewData["userinfo"] = ren; return(View("~/Views/UHome/_PartialUserInfo.cshtml")); }
public ActionResult UcenterInfo(int id) { Ren ren = unitOfWork.rensRepository.GetByID(id); ViewData["user"] = ren; return(View("~/Views/Ucenter/_PartialUcenterInfo.cshtml")); }
public ActionResult EditPassword() { int rid = int.Parse(Session["renid"].ToString()); Ren ren = unitOfWork.rensRepository.GetByID(rid); ViewBag.rid = rid; return(View()); }
public ActionResult Create(Ren ren) { ren.CreateTime = System.DateTime.Now; ren.RenPassword = CommonTools.EncryptToMD5(ren.RenPassword); if (ModelState.IsValid) { unitOfWork.rensRepository.Insert(ren); unitOfWork.Save(); return(RedirectToAction("Index", "Home")); } return(View("/Account/Register", ren)); }
public ActionResult AccountSet(Ren ren) { if (ModelState.IsValid) { unitOfWork.rensRepository.Update(ren); unitOfWork.Save(); ViewBag.msg = "个人资料已更新!"; return(View(ren)); } ViewBag.msg = "发生错误,个人资料未更新!"; return(View(ren)); }
public ActionResult AccountSetting() { if (Session["uid"].ToString() != "" && Session["uid"] != null) { int uid = int.Parse(Session["uid"].ToString()); Ren ren = unitOfWork.rensRepository.GetByID(uid); return(View(ren)); } else { return(RedirectToAction("Login", "Account")); } }
private void button1_Click(object sender, EventArgs e) { var r = new Ren { id = textBox1.TextLength == 0 ? 0 : Convert.ToInt32(textBox1.Text) }; if (TyUdp.Getudp().Fun("GetRen", TyConvert.ObjToJson(r), out var json)) { dataGridView1.DataSource = TyConvert.JsonToObj <List <Ren> >(json); } else { MessageBox.Show(json); } }
public ActionResult ShenqingPeiduren(int id) { if (Session["uid"].ToString() != "" && Session["uid"] != null) { int uid = int.Parse(Session["uid"].ToString()); Ren ren = unitOfWork.rensRepository.GetByID(uid); ViewData["user"] = ren; Notice notice = unitOfWork.noticesRepository.GetByID(id); return(View(notice)); } else { return(RedirectToAction("Login", "Account")); } }
public ActionResult Shenhe(int id, string status) { Message msg = new Message(); Ren ren = unitOfWork.rensRepository.GetByID(id); ren.PeiduStatus = status; unitOfWork.rensRepository.Update(ren); unitOfWork.Save(); msg.MessageStatus = "true"; msg.MessageInfo = "审核成功"; return(Json(msg, JsonRequestBehavior.AllowGet)); }
public ActionResult AccountSetting(Ren ren) { if (ModelState.IsValid) { Ren nren = unitOfWork.rensRepository.GetByID(ren.Id); nren.RenNickName = ren.RenNickName; nren.RenName = ren.RenName; nren.RenSex = ren.RenSex; nren.RenBirthday = ren.RenBirthday; nren.RenYijuhua = ren.RenYijuhua; nren.RenInfo = ren.RenInfo; nren.RenAvatar = ren.RenAvatar; unitOfWork.rensRepository.Update(nren); unitOfWork.Save(); return(RedirectToAction("Ucenter", "Ucenter")); } return(View(ren)); }
public ActionResult Register(Ren ren) { ren.Status = true; ren.RenQuanxian = "xueyuan"; ren.CreateTime = System.DateTime.Now; ren.RenPassword = CommonTools.ToMd5(ren.RenPassword); ren.RenYijuhua = "本人很懒,什么也没留下"; ren.RenInfo = "本人很懒,什么也没留下"; ren.RenAvatar = "/Resource/img/avatar.jpg"; ren.RenName = ren.RenNickName; if (ModelState.IsValid) { unitOfWork.rensRepository.Insert(ren); unitOfWork.Save(); return(RedirectToAction("Login", "Account")); } return(View(ren)); }
public ActionResult EditPassword(FormCollection fc) { string old_password = fc["RenPassword"].ToString(); string new_password = fc["NewPassword"].ToString(); string re_password = fc["RePassword"].ToString(); int rid = int.Parse(fc["Id"].ToString()); Ren ren = unitOfWork.rensRepository.GetByID(rid); if (string.IsNullOrEmpty(old_password) || string.IsNullOrEmpty(new_password) || string.IsNullOrEmpty(re_password)) { ViewBag.msg = "密码不能为空"; ViewBag.rid = ren.Id; return(View()); } else { if (ren.RenPassword == CommonTools.ToMd5(old_password)) { if (new_password == re_password) { ren.RenPassword = CommonTools.ToMd5(new_password); unitOfWork.rensRepository.Update(ren); unitOfWork.Save(); ViewBag.msg = "个人资料已更新!"; ViewBag.rid = ren.Id; return(View()); } else { ViewBag.msg = "两次输入密码不一致,请重新输入"; ViewBag.rid = ren.Id; return(View()); } } else { ViewBag.msg = "旧密码输入错误"; ViewBag.rid = ren.Id; return(View()); } } }
public ActionResult GetuserinfoByunionid(string unionid) { string json = string.Empty; Ren ren = new Ren(); var userlist = unitOfWork.rensRepository.Get(filter: u => u.RenUnionid == unionid); if (userlist.Count() > 0) { ren = userlist.First(); json = JsonHelper.JsonSerializerBySingleData(ren); } else { Message msg = new Message(); msg.MessageInfo = "此用户尚未注册"; msg.MessageStatus = "false"; msg.MessageUrl = ""; json = JsonHelper.JsonSerializerBySingleData(msg); } return(Content(json)); }
public ActionResult DakaContent(int bid) { if (Session["uid"].ToString() != "" && Session["uid"] != null) { int uid = int.Parse(Session["uid"].ToString()); Ren ren = unitOfWork.rensRepository.GetByID(uid); ViewData["user"] = ren; Biji biji = unitOfWork.bijisRepository.GetByID(bid); var dianzan = unitOfWork.bijiDianzansRepository.Get(filter: u => u.DianzanBiji == bid && u.Dianzanren == ren.Id && u.Dianzan == true); ViewBag.dianzan = false; if (dianzan.Count() > 0) { ViewBag.dianzan = true; } return(View(biji)); } else { return(RedirectToAction("Login", "Account")); } }
public ActionResult Register(Ren ren) { Ren yaoqingren = new Ren(); yaoqingren = unitOfWork.rensRepository.GetByID(ren.Yaoqingren); var regrens = unitOfWork.rensRepository.Get(filter: u => u.RenOpenid == ren.RenOpenid); if (regrens.Count() > 0) { return(RedirectToAction("ShengjiVIP", "Ucenter")); } else { if (ModelState.IsValid) { if (string.IsNullOrEmpty(ren.RenNickName.ToString())) { return(RedirectToAction("Register", "Ucenter")); } //if (string.IsNullOrEmpty(ren.Yaoqingren.ToString()) || string.IsNullOrEmpty(yaoqingren.RenNickName)) if (string.IsNullOrEmpty(ren.Yaoqingren.ToString()) || yaoqingren == null) { ren.Yaoqingren = 10001; } ren.RenPassword = CommonTools.ToMd5(ren.RenPassword); unitOfWork.rensRepository.Insert(ren); unitOfWork.Save(); return(RedirectToAction("Index", "Home")); } else { return(RedirectToAction("Register", "Ucenter")); } } }
public ActionResult Ren(int rid) { Ren ren = unitOfWork.rensRepository.GetByID(rid); return(View(ren)); }
public ActionResult Login(FormCollection fc) { System.Web.HttpContext.Current.Session["uname"] = ""; string username = fc["RenUserEmail"]; string password = CommonTools.ToMd5(fc["RenPassword"].ToString()); bool rememberme = fc["RememberMe"] == null ? false : true; string reurnUrl = fc["ReturnUrl"]; var rens = unitOfWork.rensRepository.Get(filter: u => u.RenUserEmail == username && u.RenPassword == password); if (rens.Count() > 0) { Ren ren = rens.First(); if (ren.Status) { HttpCookie cookie = new HttpCookie("uname"); cookie.Value = username; System.Web.HttpContext.Current.Response.Cookies.Add(cookie); HttpCookie cookieid = new HttpCookie("uid"); cookieid.Value = ren.Id.ToString(); System.Web.HttpContext.Current.Response.Cookies.Add(cookieid); System.Web.HttpContext.Current.Session["uid"] = ren.Id.ToString(); System.Web.HttpContext.Current.Session["uname"] = ren.RenUserEmail; System.Web.HttpContext.Current.Session["guanliyuan"] = "false"; System.Web.HttpContext.Current.Session["peiduren"] = "false"; if (ren.RenQuanxian.Contains("peiduren") && ren.PeiduStatus == "success") { System.Web.HttpContext.Current.Session["peiduren"] = "true"; } if (ren.RenQuanxian.Contains("guanliyuan")) { System.Web.HttpContext.Current.Session["guanliyuan"] = "true"; } FormsAuthentication.SetAuthCookie(username, rememberme); if (string.IsNullOrEmpty(reurnUrl)) { return(RedirectToAction("Ucenter", "Ucenter")); } else { ViewBag.msg = "没有权限"; return(Redirect(reurnUrl)); } } else { ViewBag.msg = "此已经被禁用,不允许登陆"; return(View()); } } else { ViewBag.msg = "用户名或密码错误了"; return(View()); } }
public ActionResult Daka(RenwuDaka daka) { Ren ren = unitOfWork.rensRepository.GetByID(daka.RenwuZhixingzhe); Renwu renwu = unitOfWork.renwusRepository.GetByID(daka.RenwuName); if (ModelState.IsValid) { unitOfWork.renwuDakasRepository.Insert(daka); unitOfWork.Save(); WechatTemplateMessage msgData = new WechatTemplateMessage { touser = ren.RenOpenid, template_id = "YfnxngfPAXv5hgSkDGKS-3bd5aScpZgwlRr1Jn85fWc", url = "http://peiban.zzd123.com/Wap/ArticleContent?id=" + daka.Id, data = new { first = new { value = "你好,完成作业通知。", color = "#173177" }, keyword1 = new { value = ren.RenNickName, color = "#173177" }, keyword2 = new { value = renwu.Title, color = "#173177" }, keyword3 = new { value = DateTime.Now.ToString("yyyy-MM-dd hh:mm"), color = "#173177" }, remark = new { value = "每一次陪伴都是人生的美好。" } } }; string access_token = AccessTokenService.GetAccessToken(); string postdata = JsonConvert.SerializeObject(msgData); string result = WechatMessageServices.SendTempletMessge(access_token, postdata); WechatResult wechatResult = JsonConvert.DeserializeObject <WechatResult>(result); if (wechatResult.errcode == 0) { ViewBag.msg = "模板消息发送成功!操作代码如下:"; ViewBag.result = result; } else { ViewBag.msg = "模板消息发送失败!错误代码如下:"; ViewBag.result = result; } return(RedirectToAction("DakaList", "UHome")); } return(View(daka)); }