public ActionResult GxFreelanceWxLogin() { GetUserInfoDal getuserinfodal = new GetUserInfoDal(); string openid = CookieHelper.GetCookieValue("openid"); string user_id = getuserinfodal.GetUserID(openid); string user_name = getuserinfodal.GetUserName(user_id); string membership = getuserinfodal.GetMemberType(user_id); if (membership == "个人会员") { if (user_name == "")//信息未完善 { //System.Web.HttpContext.Current.Response.Write("<script language=javascript>alert(\"请先完善会员信息\")" + "</script>"); return(View("GxFreelanceWxPersonal")); } else { return(View()); } } else { System.Web.HttpContext.Current.Response.Write("<script language=javascript>alert(\"企业会员,无法注册\");window.location.href = \"GxFreelanceWxClassification\" ;</script>"); //System.Web.HttpContext.Current.Response.Redirect("~/Home/GxFreelanceWxClassification"); //return View("GxFreelanceWxClassification"); return(View()); } }
public ActionResult Register() //用户注册2.0测试版本 { GetUserInfoDal getuserinfodal = new GetUserInfoDal(); string openid = CookieHelper.GetCookieValue("openid"); string user_id = getuserinfodal.GetUserID(openid); user user1 = new user(); user1.UserID = user_id; user1.Profession = Request["profession"]; user1.Function = Request["function"]; user1.Education = Request["education"]; user1.Field = Request["field"]; user1.Sex = Request["sex"]; user1.Selfintroduction = Request["selfintroduction"]; user1.SearchID = Guid.NewGuid().ToString("N"); user1.Success = "0"; user1.Address = Request["address"]; LoginBll login = new LoginBll(); string isregistered = login.IsRegistered(user_id, user1.Profession); int registernumber = login.RegisterNumber(user_id); if (isregistered == "yes")//注册过当前职业 { return(Content("fail")); } else { if (registernumber >= 2) { return(Content("registermax")); } else { string isregistered2 = login.IsRegistered(user_id); if (isregistered2 == "yes") { user1.UserNumber = login.GetUserNumberByUserId(user_id); } else { string number = login.GetLastNumber(); //得到最新的编号 int a = Convert.ToInt32(number) + 1; user1.UserNumber = a.ToString(); login.UpdateLastNumber(a.ToString()); //跟新最新的编号 } login.Register(user1); return(Content("ok")); } } }
public ActionResult SetPersonalInfo(PersonalInfoModel Personal) { LoginBll LoginInfoBll = new LoginBll(); string responseText = ""; GetUserInfoDal getuserinfodal = new GetUserInfoDal(); string openid = CookieHelper.GetCookieValue("openid"); string user_id = getuserinfodal.GetUserID(openid); string fileExt = ""; List <string> filename = new List <string>(); //string chat_head_name = Request["chat_head_name"]; //string id_card_name = Request["id_card_name"]; int cnt = System.Web.HttpContext.Current.Request.Files.Count; for (int i = 0; i < cnt; i++) { HttpPostedFile hpf = System.Web.HttpContext.Current.Request.Files[i]; string filenames = Path.GetFileName(hpf.FileName); fileExt = Path.GetExtension(hpf.FileName).ToLower();//带.的后缀 filename.Add(filenames); string fileFilt = ".jpg|.jpeg|.png|.JPG|.PNG|......"; if ((fileFilt.IndexOf(fileExt) <= -1) || (fileExt == "") || (hpf.ContentLength > 4 * 1024 * 1024)) { continue; } // string filepath = HttpContext.Server.MapPath("../xwhz_uploadimages/template/" + filenames); ///string filepath = context.Server.MapPath("E:\\inetpub\\wwwroot\\sj_uploadimage\\ZJZ_PIC\\" + hpf.FileName); if (i == 0) { hpf.SaveAs("D:\\MVCRoot\\gxdzwx\\gxdzimages\\gxdzwxlogin\\personal\\chat_head\\" + filenames); // hpf.SaveAs("G:\\Visual Studio\\image\\" + filenames); } if (i == 1) { hpf.SaveAs("D:\\MVCRoot\\gxdzwx\\gxdzimages\\gxdzwxlogin\\personal\\id_card\\" + filenames); // hpf.SaveAs("G:\\Visual Studio\\image\\" + filenames); } // hpf.SaveAs("G://Visual Studio//IMP"); // var mappedPath = System.Web.Hosting.HostingEnvironment.MapPath("~/"); // hpf.SaveAs(filepath); } responseText = LoginInfoBll.SetPersonalInfo(Personal, filename, user_id); return(Content(responseText)); }
//判断是否会员登录 public override void OnActionExecuting(ActionExecutingContext filterContext) //public string isOrNotUser() { GetUserInfoDal getuserinfodal = new GetUserInfoDal(); //string responseText = ""; try { string openid = CookieHelper.GetCookieValue("openid"); if (openid == null) { //未取到openid } else { string url1 = System.Web.HttpContext.Current.Request.Url.AbsoluteUri; //获取当前url端木雲 2018/3/26 21:22:46 string url2 = "http://egov.jinyuc.com/gxdzwx/gxdzwxlogin/?openid= " + openid + "&url1=" + url1; //登录界面 string url3 = System.Web.HttpContext.Current.Request.Url.AbsoluteUri; //获取当前url端木雲 2018/3/26 21:22:46 string url4 = "http://egov.jinyuc.com/gxdzwx/gxdzwxlogin/Register/GxLoginRegisterPersonal/?openid= " + openid + "&url1=" + url3; //完善信息界面 string user_id = getuserinfodal.GetUserID(openid); string username = getuserinfodal.GetUserName(user_id); if (user_id == "none")//如果没有注册 { //System.Web.HttpContext.Current.Response.Write("<script language=javascript>location.replace("+url2+")" + "</script>"); //System.Web.HttpContext.Current.Response.Write("window.parent.location.href=" + url2 + "</script>"); System.Web.HttpContext.Current.Response.Redirect(url2); } else { string login_flag = CookieHelper.GetCookieValue("login_flag"); if (login_flag != "1") { //非会员,跳转登陆页面 System.Web.HttpContext.Current.Response.Redirect(url2); } } } } catch { } }
public ActionResult GxfaWxIndex(string openid) { /////获取openid if (openid == null) { ////openid = "oXx_Mw7JSzz218WpGTprNfSaHC7k";//鹏伟峰 openid = "oXx_Mw-hx0yNF3wIELsf_RP6cJoA";//我的 string user_id = getuserinfodal.GetUserID(openid); string membership = getuserinfodal.GetMemberType(user_id); string username = getuserinfodal.GetUserName(user_id, membership); CookieHelper.ClearCookie("openid"); CookieHelper.SetCookie("openid", openid); Session["user_id"] = user_id; Session["user_name"] = username; string url1 = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;//获取当前url端木雲 2018/3/26 21:22:46 string url2 = "http://egov.jinyuc.com/gxdzwx/gxdzwxlogin/?openid= " + openid + "&url1=" + url1; Session["RegisterUrl"] = url2; Session["url"] = url2; string url3 = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;//获取当前url端木雲 2018/3/26 21:22:46 string url4 = "http://egov.jinyuc.com/gxdzwx/gxdzwxlogin/Register/GxLoginRegisterPersonal/?openid= " + openid + "&url1=" + url3; Session["FinishRegisterUrl"] = url4; ViewBag.openid = openid; } else { ViewBag.openid = openid; CookieHelper.ClearCookie("openid"); CookieHelper.SetCookie("openid", openid); string url1 = System.Web.HttpContext.Current.Request.Url.AbsoluteUri;//获取当前url端木雲 2018/3/26 21:22:46 string url2 = "http://egov.jinyuc.com/gxdzwx/gxdzwxlogin/?openid= " + openid + "&url1=" + url1; Session["url"] = url2; string user_id = getuserinfodal.GetUserID(openid); if (user_id == "none") { } Session["user_id"] = user_id; Session["user_name"] = user_id; //Session["user_id"] = "70"; //Session["user_name"] = "70"; } return(View()); }