public ActionResult EditInfo() { var id = Convert.ToInt64(Request["id"]); var tdata = T_UserSaveService.LoadEntities(x => x.ID == id && x.delflag == 0).DefaultIfEmpty(); var temp = from a in tdata select new { a.ID, a.TextName, a.PresonName, a.PresonPhoto, a.Address, a.Money, a.HuxingStrID, a.Mianji, a.LouCheng, a.ZhuanxiuStrID, a.Chaoxiang, a.Items, a.Bak }; return(Json(temp, JsonRequestBehavior.AllowGet)); //return Content(Common.SerializerHelper.SerializeToString(new { sData = tdata, msg = "ok" })); }
//分配个人存储信息 public ActionResult FenPeiUserSave() { var Eid = Request["Eid"] != null?Convert.ToInt64(Request["Eid"]) : 0; var UserID = Request["UserID"] != null?Convert.ToInt32(Request["UserID"]) : 0; var temp = T_UserSaveService.LoadEntities(x => x.ID == Eid).FirstOrDefault(); temp.UserID = UserID; if (T_UserSaveService.EditEntity(temp)) { return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { msg = "分配错误请联系管理员!" }, JsonRequestBehavior.AllowGet)); } }
public ActionResult SeeImage() { long id = Convert.ToInt64(Request["id"]); T_UserSave temp = T_UserSaveService.LoadEntities(x => x.ID == id).FirstOrDefault(); string ret = string.Empty; string retId = string.Empty; foreach (UserSaveImage usi in temp.UserSaveImages) { ret = ret.Length > 0 ? ret + "," + usi.Image_str : usi.Image_str; retId = retId.Length > 0 ? retId + "," + usi.ID.ToString() : usi.ID.ToString(); } if (temp != null) { return(Json(new { sdata = ret, retId = retId, msg = "ok" }, JsonRequestBehavior.AllowGet)); } else { return(Content(Common.SerializerHelper.SerializeToString(new { msg = "no" }))); } }
public ActionResult AddUser(T_UserSave tus) { if (tus.ID == 0) { T_UserSave userins = T_UserSaveService.LoadEntities(x => x.TextName == tus.TextName && x.UserID == LoginUser.ID).FirstOrDefault(); if (userins == null) { tus.AddTime = MvcApplication.GetT_time(); tus.delflag = 0; tus.UserID = LoginUser.ID; tus.Money = tus.Money * 10000; tus.SumMoneyID = GetMoney(tus.Money.ToString()); tus.MianjiID = GeiMinji(tus.Mianji.ToString()); T_UserSaveService.AddEntity(tus); var Mid = T_UserSaveService.LoadEntities(x => x.TextName == tus.TextName).FirstOrDefault(); #region 图片处理 List <string> List_str = new List <string>(); var Str_list = Request["MenuIcon"]; if (Str_list.Trim().Length > 0) { var Lsp = Str_list.Split(','); foreach (string stt in Lsp) { #region 读取存储图片数据 HttpPostedFileBase file = Request.Files[stt]; if (file != null) { string filename = Path.GetFileName(file.FileName); //获取上传的文件名 string fileExt = Path.GetExtension(filename); //获取扩展名 #region MyRegion if (fileExt == ".jpg" || fileExt == ".png" || fileExt == ".gif" || fileExt == ".jpeg" || fileExt == ".bmp") { var user = UserInfoService.LoadEntities(x => x.ID == LoginUser.MasterID).FirstOrDefault(); if (user == null) { T_UserSaveService.DeleteEntity(Mid); return(Content("no:主号ID错误,为获取倒主号ID无法建立存储路径!")); } string dir = "/UserSaveImage/" + user.UName + "/" + LoginUser.UName + "/" + MvcApplication.GetT_time().ToString("yyyy-MM-dd") + "/"; Directory.CreateDirectory(Path.GetDirectoryName(Request.MapPath(dir))); string filenewName = Guid.NewGuid().ToString(); string fulldir = dir + filenewName + fileExt; file.SaveAs(Request.MapPath(fulldir)); List_str.Add(fulldir); } else { T_UserSaveService.DeleteEntity(Mid); return(Content("no:文件类型错误,文件扩展名错误!")); } #endregion } else { T_UserSaveService.DeleteEntity(Mid); return(Content("no:请上传图片文件")); } #endregion } //写入数据 foreach (string str in List_str) { UserSaveImage usi = new UserSaveImage(); usi.UserSaveID = Mid.ID; usi.Image_str = str; UserSaveImageService.AddEntity(usi); } } #endregion return(Content("ok")); } else { return(Content("no:信息名称不可重复添加!")); } } else { var Editdata = T_UserSaveService.LoadEntities(x => x.ID == tus.ID).FirstOrDefault(); if (Editdata != null) { Editdata.Items = tus.Items; Editdata.TextName = tus.TextName; Editdata.PresonName = tus.PresonName; Editdata.PresonPhoto = tus.PresonPhoto; Editdata.Address = tus.Address; Editdata.Money = tus.Money; Editdata.ZhuanxiuStrID = tus.ZhuanxiuStrID; Editdata.Mianji = tus.Mianji; Editdata.LouCheng = tus.LouCheng; Editdata.HuxingStrID = tus.HuxingStrID; Editdata.Chaoxiang = tus.Chaoxiang; Editdata.Bak = tus.Bak; if (T_UserSaveService.EditEntity(Editdata)) { return(Content("ok")); } else { return(Content("no:信息名称不可重复添加!")); } } else { return(Content("no:无修改数据!")); } } }