public void ProcessRequest(HttpContext context) { HttpFileCollection files = context.Request.Files; for (int i = 0; i < files.Count; i++) { HttpPostedFile file = files[i]; StudentsUser user = context.Session["user_"] as StudentsUser; string fileName = context.Server.MapPath("~/uploads") + "//" + user.Sfzh + ".jpg"; file.SaveAs(fileName); using (StudentInfoBLL bll = new StudentInfoBLL()) { StudentInfo selectInfo = bll.getEntity(user.Sfzh); selectInfo.PicPath = "//uploads//" + user.Sfzh + ".jpg"; bll.Update(selectInfo); } } //context.Response.ContentType = "text/plain"; //context.Response.Write("Hello World"); }
public static string saveInfo(string SignUpNum, string Zkzh, string Sfzh, string Mobile, string Nation, string ZZMM, int Health, string KSLB, string AreaCode, string Byxx, string BYLB, string LikeSpecial, string Tel, string Yzbm, string Txdz, string FrsZY, string SecZy, int IsAdjust, string AcceptPeople) { int code = 1; string message = "保存成功!!"; string strCsrq = Sfzh.Substring(6, 4) + "-" + Sfzh.Substring(10, 2) + "-" + Sfzh.Substring(12, 2); int _XB = 0;//n女 if (int.Parse(Sfzh.Substring(14, 3)) % 2 != 0) { _XB = 1;//男 } string PicPath = HttpContext.Current.Session["PicPath_"].ToString(); if (PicPath != null) { try { StudentInfo _setInfo = new StudentInfo(); _setInfo.AcceptPeople = AcceptPeople; _setInfo.AreaCode = AreaCode; _setInfo.BYLB = BYLB; _setInfo.Byyx = Byxx; _setInfo.Csrq = DateTime.Parse(strCsrq); _setInfo.Health = Health; _setInfo.KSLB = KSLB; _setInfo.LikeSpecial = LikeSpecial; _setInfo.Mobile = Mobile; _setInfo.Nation = Nation; _setInfo.Sfzh = Sfzh; _setInfo.Tel = Tel; _setInfo.Txdz = Txdz; _setInfo.Xb = _XB; _setInfo.Yzbm = Yzbm; _setInfo.ZZMM = ZZMM; _setInfo.PicPath = PicPath; using (StudentInfoBLL bll = new StudentInfoBLL()) { if (bll.getEntity(Sfzh) == null) { bll.Insert(_setInfo); } else { bll.Update(_setInfo); } } Wish _Wish = new Wish(); _Wish.IsAdjust = IsAdjust; _Wish.FrsZY = FrsZY; _Wish.SecZY = SecZy; _Wish.Sfzh = Sfzh; using (WishBLL bll = new WishBLL()) { if (bll.getEntity(Sfzh) == null) { bll.Insert(_Wish); } else { bll.Update(_Wish); } } } catch (Exception) { code = 0; message = "数据合法性错误,请检查!"; } } else { code = 0; message = "后台数据错误!!"; } return(JsonConvert.SerializeObject(new { code = code, message = message })); }