public tInstationInfoController() { ViewBag.user = user; method = new method(); client = new tInstationInfoServiceClient(); list = new List <ViewtInstationInfo>(); zanclient = new tZanModelsServiceClient(); followclient = new FollowServiceClient(); messageclient = new tMessageServiceClient(); clientUser = new YogaUserServiceClient(); clientModel = new YogisModelsServiceClient(); udclient = new YogaUserDetailServiceClient(); writelogclient = new tWriteLogServiceClient(); #region 登录者的级别 if (user.UserType == 0) { ViewYogaUserDetail temp = new ViewYogaUserDetail(); temp = udclient.GetYogaUserDetailById(user.Uid); if (temp != null) { ViewBag.level = temp.Ulevel; ViewBag.Gender = temp.Gender; } } else//导师级别 { ViewYogisModels vyogism = new ViewYogisModels(); vyogism = clientModel.GetYogisModelsById(user.Uid); if (vyogism != null) { ViewBag.level = vyogism.YogisLevel; ViewBag.Gender = vyogism.Gender; } } #endregion #region 站内信-信息数量 int tinstatcount = 0; int follcount = 0; int zancount = 0; int msgcount = 0; method.InstationInfo(user.Uid, out tinstatcount, out follcount, out zancount, out msgcount); ViewBag.tinstatcount = tinstatcount; ViewBag.follcount = follcount; ViewBag.zancount = zancount; ViewBag.msgcount = msgcount; ViewBag.AllCount = tinstatcount + follcount + zancount + msgcount; #endregion }
public LearnController() { ViewBag.user = user; client = new tLearingServiceClient(); dicclient = new YogaDicItemServiceClient(); interclient = new InterestServiceClient(); msgclient = new tMessageServiceClient(); clientUser = new YogaUserServiceClient(); userDetclient = new YogaUserDetailServiceClient(); method = new method(); Signclient = new tSignServiceClient(); zanclient = new tZanModelsServiceClient(); #region 登录者的级别 if (user.UserType == 0) { ViewYogaUserDetail temp = new ViewYogaUserDetail(); temp = userDetclient.GetYogaUserDetailById(user.Uid); if (temp != null) { ViewBag.level = temp.Ulevel; } } else//导师级别 { ViewYogisModels vyogism = new ViewYogisModels(); using (YogisModelsServiceClient mclient = new YogisModelsServiceClient()) { vyogism = mclient.GetYogisModelsById(user.Uid); if (vyogism != null) { ViewBag.level = vyogism.YogisLevel; } } } #endregion #region 站内信-信息数量 int tinstatcount = 0; int follcount = 0; int zancount = 0; int msgcount = 0; method.InstationInfo(user.Uid, out tinstatcount, out follcount, out zancount, out msgcount); ViewBag.tinstatcount = tinstatcount; ViewBag.follcount = follcount; ViewBag.zancount = zancount; ViewBag.msgcount = msgcount; ViewBag.AllCount = tinstatcount + follcount + zancount + msgcount; #endregion }
public YogaGuruController() { ViewBag.user = user; client = new YogisModelsServiceClient(); clientUser = new YogaUserServiceClient(); clientMsg = new tMessageServiceClient(); clientFoll = new FollowServiceClient(); clientDetail = new YogaUserDetailServiceClient(); logClient = new tWriteLogServiceClient(); clientPic = new YogaPictureServiceClient(); dicclient = new YogaDicItemServiceClient(); zanclient = new tZanModelsServiceClient(); method = new method(); #region 登录者的级别 if (user.UserType == 0) { ViewYogaUserDetail temp = new ViewYogaUserDetail(); temp = clientDetail.GetYogaUserDetailById(user.Uid); if (temp != null) { ViewBag.level = temp.Ulevel; } } else { ViewYogisModels vyogism = new ViewYogisModels(); vyogism = client.GetYogisModelsById(user.Uid); if (vyogism != null) { ViewBag.level = vyogism.YogisLevel; } } #endregion #region 站内信-信息数量 int tinstatcount = 0; int follcount = 0; int zancount = 0; int msgcount = 0; method.InstationInfo(user.Uid, out tinstatcount, out follcount, out zancount, out msgcount); ViewBag.tinstatcount = tinstatcount; ViewBag.follcount = follcount; ViewBag.zancount = zancount; ViewBag.msgcount = msgcount; ViewBag.AllCount = tinstatcount + follcount + zancount + msgcount; #endregion }
public YogaPicController() { ViewBag.user = user; client = new YogaPictureServiceClient(); mclient = new YogisModelsServiceClient(); yogauserclient = new YogaUserDetailServiceClient(); list = new List <ViewYogaPicture>(); wlogclient = new tWriteLogServiceClient(); classclient = new ClassServiceClient(); method = new method(); classRepotclient = new ClassReportServiceClient(); #region 登录者的级别 if (user.UserType == 0) { ViewYogaUserDetail temp = new ViewYogaUserDetail(); temp = yogauserclient.GetYogaUserDetailById(user.Uid); if (temp != null) { ViewBag.level = temp.Ulevel; ViewBag.Gender = temp.Gender; } } else { ViewYogisModels vyogism = new ViewYogisModels(); vyogism = mclient.GetYogisModelsById(user.Uid); if (vyogism != null) { ViewBag.level = vyogism.YogisLevel; ViewBag.Gender = vyogism.Gender; } } #endregion #region 站内信-信息数量 int tinstatcount = 0; int follcount = 0; int zancount = 0; int msgcount = 0; method.InstationInfo(user.Uid, out tinstatcount, out follcount, out zancount, out msgcount); ViewBag.tinstatcount = tinstatcount; ViewBag.follcount = follcount; ViewBag.zancount = zancount; ViewBag.msgcount = msgcount; ViewBag.AllCount = tinstatcount + follcount + zancount + msgcount; #endregion }
public JsonResult Detailslistuser(string sContent) { try { list = client.GetByContent(sContent); SearchInstationInfo entity = new SearchInstationInfo(); List <SearchInstationInfo> listinfo = new List <SearchInstationInfo>(); string strUserType = ""; foreach (var item in list) { entity = new SearchInstationInfo(); ViewYogaUser userEntity = userclient.GetById(item.Uid.Value); strUserType += userEntity.UserType + ","; if (userEntity != null) { if (string.IsNullOrEmpty(userEntity.NickName)) { entity.NickName = modelsclient.GetYogisModelsById(item.Uid.Value).RealName; } else { entity.NickName = userEntity.NickName; } entity.UId = item.Uid.Value; } listinfo.Add(entity); } // ViewBag.sType = strUserType.Distinct();//判断是习练者/导师/全部 return(Json(new { code = strUserType.Distinct(), listinfo = listinfo }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { code = 1 })); } }
public tQuestionController() { ViewBag.user = user; client = new YogisModelsServiceClient(); clientUser = new YogaUserServiceClient(); clientDetail = new YogaUserDetailServiceClient(); method = new method(); #region 登录者的级别 if (user.UserType == 0) { ViewYogaUserDetail temp = new ViewYogaUserDetail(); temp = clientDetail.GetYogaUserDetailById(user.Uid); if (temp != null) { ViewBag.level = temp.Ulevel; } } else { ViewYogisModels vyogism = new ViewYogisModels(); vyogism = client.GetYogisModelsById(user.Uid); if (vyogism != null) { ViewBag.level = vyogism.YogisLevel; } } #endregion #region 站内信-信息数量 int tinstatcount = 0; int follcount = 0; int zancount = 0; int msgcount = 0; method.InstationInfo(user.Uid, out tinstatcount, out follcount, out zancount, out msgcount); ViewBag.tinstatcount = tinstatcount; ViewBag.follcount = follcount; ViewBag.zancount = zancount; ViewBag.msgcount = msgcount; ViewBag.AllCount = tinstatcount + follcount + zancount + msgcount; #endregion }
/// <summary> /// 取他/她人 :姓别 /// </summary> /// <param name="id"></param> /// <returns></returns> public string Gender(int id) { string strGender = "她"; ViewYogaUser yogauser = new ViewYogaUser(); yogauser = clientUser.GetYogaUserById(id); if (yogauser.UserType == 0) { ViewYogaUserDetail temp = new ViewYogaUserDetail(); temp = udclient.GetYogaUserDetailById(id); if (temp != null) { if (temp.Gender != null) { if (temp.Gender.Value == 0) { strGender = "她"; } else { strGender = "他"; } } } } else { ViewYogisModels vyogism = new ViewYogisModels(); vyogism = modelsclient.GetYogisModelsById(id); if (vyogism != null) { if (vyogism.Gender != null) { if (vyogism.Gender.Value == 0) { strGender = "她"; } else { strGender = "他"; } } } } return(strGender); }
public PartialViewResult Index(string Uid, DateTime?createTime, int page = 1) { int count = 0; // list=client.GetYogaPicturePageList(page, 10, out count); list = client.GetYogaPicturePageList(0); var finq = (from l in list group l by new { PictureType = l.PictureType, Uid = l.Uid, iAudio = l.iAudio, CreateTime = l.CreateTime } into grouped orderby grouped.Key.CreateTime descending select new ViewYogaPicture { PictureType = grouped.Key.PictureType, Uid = grouped.Key.Uid, iAudio = grouped.Key.iAudio, CreateTime = grouped.Key.CreateTime }); if (!string.IsNullOrEmpty(Uid)) { ViewYogaUserDetail model = userDetclient.GetByRealName(Uid); if (model != null) { finq = finq.Where(x => x.Uid == model.UID); } else { ViewYogisModels models = modelclient.GetByRealName(Uid); if (models != null) { finq = finq.Where(x => x.Uid == models.UID); } } } if (createTime != null) { finq = finq.Where(x => x.CreateTime >= createTime.Value); } count = finq.Count(); var finqlist = finq.OrderBy(x => x.CreateTime).Skip((page - 1) * 10).Take(10).ToList(); PagedList <ViewYogaPicture> pagelist = new PagedList <ViewYogaPicture>(finqlist, page, 10, count); List <ViewYogaPictureGroup> listGroup = new List <ViewYogaPictureGroup>(); foreach (var item in finqlist) { ViewYogaPictureGroup model = new ViewYogaPictureGroup(); model.entity = item; using (YogisModelsServiceClient uclient = new YogisModelsServiceClient()) { ViewYogisModels mm = uclient.GetYogisModelsById(item.Uid); if (mm != null) { model.RealName = mm.RealName; if (string.IsNullOrEmpty(mm.RealName)) { ViewYogaUserDetail mmm = userDetclient.GetYogaUserDetailById(item.Uid); if (mmm != null) { model.RealName = mmm.RealName_cn; } } } else { ViewYogaUserDetail mmm = userDetclient.GetYogaUserDetailById(item.Uid); if (mmm != null) { model.RealName = mmm.RealName_cn; } if (mmm != null) { model.RealName = mmm.RealName_cn; } } } listGroup.Add(model); } ViewBag.listGroup = listGroup; return(PartialView("Index", pagelist)); }
/// <summary> /// 升级导师审核中页面 /// </summary> /// <returns></returns> public ActionResult Audit() { #region 登录者的级别 if (user.UserType == 0) { } else//导师级别 { ViewYogisModels vyogism = new ViewYogisModels(); vyogism = mclient.GetYogisModelsById(user.Uid); if (vyogism != null) { ViewBag.level = vyogism.YogisLevel; } } #endregion int id = user.Uid; ViewYogisModels model = new ViewYogisModels(); using (YogisModelsServiceClient client = new YogisModelsServiceClient()) { model = client.GetYogisModelsById(id); if (model != null) { #region //昵称 using (YogaUserServiceClient YogaUserServiceClient = new YogaUserServiceClient()) { ViewBag.NickName = YogaUserServiceClient.GetYogaUserById(model.UID).NickName ?? ""; } #region 会馆 if (!string.IsNullOrEmpty(model.CenterID)) { string[] cenlist = model.CenterID.Split(','); List <ViewCenters> listcenter = new List <ViewCenters>(); using (CentersServiceClient CentersServiceClient = new CentersServiceClient()) { listcenter = CentersServiceClient.GetCentersUid(); string strCentValue = ""; foreach (var i in cenlist) { foreach (var itemCenter in listcenter) { if (i.ToString() == itemCenter.CenterId.ToString()) { strCentValue += itemCenter.CenterName + ','; } } } ViewBag.CentValue = strCentValue; } } #endregion #region 流派 if (!string.IsNullOrEmpty(model.YogaTypeid)) { string[] YogaTypeidlist = model.YogaTypeid.Split(','); List <ViewYogaDicItem> listcenter2 = new List <ViewYogaDicItem>(); using (YogaDicItemServiceClient YogaDicItemServiceClient = new YogaDicItemServiceClient()) { listcenter2 = YogaDicItemServiceClient.GetYogaDicItemList(); string strYogaTypeidValue = ""; foreach (var j in YogaTypeidlist) { foreach (var itemDic in listcenter2) { if (j.ToString() == itemDic.ID.ToString()) { strYogaTypeidValue += itemDic.ItemName + ','; } } } ViewBag.YogaTypeidValue = strYogaTypeidValue; } } #endregion #region 导师列表 if (!string.IsNullOrEmpty(model.TeachYogis)) { string[] TeachYogislist = model.TeachYogis.Split(','); ViewYogisModels model3 = new ViewYogisModels(); string strTeachYogisValue = ""; foreach (var k in TeachYogislist) { model3 = client.GetById(Convert.ToInt32(k)); if (model3 != null) { strTeachYogisValue += model3.RealName + ','; } } ViewBag.TeachYogisValue = strTeachYogisValue; } #endregion //国籍 if (!string.IsNullOrEmpty(model.Nationality)) { if (model.Nationality != "0") { using (YogaDicItemServiceClient YogaDicItemServiceClient = new YogaDicItemServiceClient()) { ViewBag.Nationality = YogaDicItemServiceClient.GetYogaDicItemById(Convert.ToInt32(model.Nationality)).ItemName ?? ""; } } } //国家 if (model.CountryID != null && model.CountryID != 0) { using (YogaDicItemServiceClient YogaDicItemServiceClient = new YogaDicItemServiceClient()) { ViewBag.CountryID = YogaDicItemServiceClient.GetYogaDicItemById(model.CountryID.Value).ItemName ?? ""; } } else { ViewBag.CountryID = ""; } //地址; 省 城市 城区 if (model.ProvinceID != null && model.ProvinceID != 0) { using (YogaDicItemServiceClient YogaDicItemServiceClient = new YogaDicItemServiceClient()) { ViewBag.ProvinceID = YogaDicItemServiceClient.GetYogaDicItemById(model.ProvinceID.Value).ItemName ?? ""; } } else { ViewBag.ProvinceID = ""; } if (model.CityID != null && model.CityID != 0) { using (YogaDicItemServiceClient YogaDicItemServiceClient = new YogaDicItemServiceClient()) { ViewBag.CityID = YogaDicItemServiceClient.GetYogaDicItemById(model.CityID.Value).ItemName ?? ""; } } else { ViewBag.CityID = ""; } if (model.DistrictID != null && model.DistrictID != 0) { using (YogaDicItemServiceClient YogaDicItemServiceClient = new YogaDicItemServiceClient()) { ViewBag.DistrictID = YogaDicItemServiceClient.GetYogaDicItemById(model.DistrictID.Value).ItemName ?? ""; } } else { ViewBag.DistrictID = ""; } ViewBag.Address = ViewBag.ProvinceID + "--" + ViewBag.CityID + "--" + ViewBag.DistrictID; #endregion } else { ViewBag.CentValue = ""; ViewBag.YogaTypeidValue = ""; ViewBag.TeachYogisValue = ""; } } YogiProfileServiceClient proClient = new YogiProfileServiceClient(); ViewYogiProfile pro = proClient.GetYogiProfileById(id); if (pro != null) { ViewBag.pro = pro; } //using (YogaPictureServiceClient clientpic = new YogaPictureServiceClient()) //{ // List<ViewYogaPicture> pic = clientpic.GetUidList(id); // if (pic != null) // { // ViewBag.Pic = pic; // } //} return(View(model)); }
//BasicInfo user = Commons.Helper.Login.GetCurrentUser(); public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Charset = "utf-8"; System.Drawing.Bitmap bitmap = null; //按截图区域生成Bitmap System.Drawing.Image thumbImg = null; //被截图 System.Drawing.Graphics gps = null; //存绘图对象 System.Drawing.Image finalImg = null; //最终图片 try { string pointX = context.Request.Params["pointX"]; //X坐标 string pointY = context.Request.Params["pointY"]; //Y坐标 string imgUrl = context.Request.Params["imgUrl"]; //被截图图片地址 string rlSize = context.Request.Params["maxVal"]; //截图矩形的大小 string iType = context.Request.Params["iType"]; //0 习练者; 1 导师 string Uid = context.Request.Params["Uid"]; //用户Uid int finalWidth = 300; int finalHeight = 300; if (!string.IsNullOrEmpty(pointX) && !string.IsNullOrEmpty(pointY) && !string.IsNullOrEmpty(imgUrl)) { string ext = System.IO.Path.GetExtension(imgUrl).ToLower(); //上传文件的后缀(小写) bitmap = new System.Drawing.Bitmap(Convert.ToInt32(rlSize), Convert.ToInt32(rlSize)); thumbImg = System.Drawing.Image.FromFile(HttpContext.Current.Server.MapPath(imgUrl)); System.Drawing.Rectangle rl = new System.Drawing.Rectangle(Convert.ToInt32(pointX), Convert.ToInt32(pointY), Convert.ToInt32(rlSize), Convert.ToInt32(rlSize)); //得到截图矩形 gps = System.Drawing.Graphics.FromImage(bitmap); //读到绘图对象 gps.DrawImage(thumbImg, 0, 0, rl, System.Drawing.GraphicsUnit.Pixel); finalImg = PubClass.GetThumbNailImage(bitmap, finalWidth, finalHeight); string finalPath = "/Files/avatar/original/" + Uid + "/" + DateTime.Now.ToFileTime() + ext; finalImg.Save(HttpContext.Current.Server.MapPath(finalPath)); if (!string.IsNullOrEmpty(iType)) { if (iType == "0") { ViewYogaUserDetail listModel = new ViewYogaUserDetail(); using (YogaUserDetailServiceClient clientModels = new YogaUserDetailServiceClient()) { listModel = clientModels.GetYogaUserDetailById(Convert.ToInt32(Uid)); if (!string.IsNullOrEmpty(listModel.DisplayImg)) { string[] ids = listModel.DisplayImg.Split(';'); if (ids.Count() > 1) { if (!string.IsNullOrEmpty(ids[1])) { PubClass.FileDel(HttpContext.Current.Server.MapPath("~" + ids[1])); } listModel.DisplayImg = ids[0] + ";" + finalPath; } else { listModel.DisplayImg = finalPath + ";"; } } else { listModel.DisplayImg = finalPath + ";"; } clientModels.Update(listModel); } } else if (iType == "1") { ViewYogisModels Model = new ViewYogisModels(); using (YogisModelsServiceClient client = new YogisModelsServiceClient()) { Model = client.GetYogisModelsById(Convert.ToInt32(Uid)); if (!string.IsNullOrEmpty(Model.DisplayImg)) { string[] ids = Model.DisplayImg.Split(';'); if (ids.Count() > 1) { if (!string.IsNullOrEmpty(ids[1])) { PubClass.FileDel(HttpContext.Current.Server.MapPath("~" + ids[1])); } Model.DisplayImg = ids[0] + ";" + finalPath; } else { Model.DisplayImg = finalPath + ";"; } } else { Model.DisplayImg = finalPath + ";"; } client.Update(Model); } } } bitmap.Dispose(); thumbImg.Dispose(); gps.Dispose(); finalImg.Dispose(); GC.Collect(); //PubClass.FileDel(HttpContext.Current.Server.MapPath(imgUrl)); context.Response.Write(finalPath); } } catch (Exception) { throw; } }
public ViewCenters GetAllMechanis(int id, out int mycount, int page = 1) { ViewCenters c = new ViewCenters(); using (CentersServiceClient client = new CentersServiceClient()) { c = client.GetCentersById(id); } ViewBag.centerid = id; #region 评价列表 int count = 0; int pagesize = 10; List <ViewEvaluatesGroup> listGroupMsg = new List <ViewEvaluatesGroup>(); using (EvaluatesServiceClient clientEval = new EvaluatesServiceClient()) { int tjcount = 0; clientEval.GetRecommendCount(id, out tjcount); ViewBag.Recommend = tjcount; List <ViewEvaluates> evalEntity = new List <ViewEvaluates>(); evalEntity = clientEval.GettEvalUid(id, page, pagesize, out count); mycount = count; foreach (var item in evalEntity) { ViewEvaluatesGroup model = new ViewEvaluatesGroup(); model.entity = item; //评论人 ViewYogaUser usermodel = clientUser.GetYogaUserById(item.FromUid.Value); if (usermodel != null) { model.FromUser = usermodel.NickName; } if (usermodel.UserType == 0) { ViewYogaUserDetail newmodel = clientuserdetail.GetYogaUserDetailById(item.FromUid.Value); if (newmodel != null) { model.DisplayImg = CommonInfo.GetDisplayImg(newmodel.DisplayImg); model.Url = "/YogaUserDetail/Details/" + item.FromUid.Value; } } else { ViewYogisModels newmodel = clientmodel.GetYogisModelsById(item.FromUid.Value); if (newmodel != null) { model.DisplayImg = CommonInfo.GetDisplayImg(newmodel.DisplayImg); model.FromUser = newmodel.RealName; if (newmodel.YogisLevel == 4) { model.Url = "/Yogaguru/Details/" + item.FromUid.Value; } else { model.Url = "/YogisModels/Details/" + item.FromUid.Value; } } } //回复 List <ViewEvaluates> listM = clientEval.GetEvalParentID(item.Evaluateid); List <ViewEvaluatesGroup> entitylist = new List <ViewEvaluatesGroup>(); foreach (var it in listM) { ViewEvaluatesGroup entityMsg = new ViewEvaluatesGroup(); entityMsg.entity = it; //评论人 ViewYogaUser usermodel2 = clientUser.GetYogaUserById(it.FromUid.Value); if (usermodel2 != null) { entityMsg.FromUser = usermodel2.NickName; } entitylist.Add(entityMsg); } model.msgList = entitylist; listGroupMsg.Add(model); } ViewBag.EvalInfo = listGroupMsg; } #endregion return(c); }
public PartialViewResult GetRec(int id, int page = 1) { #region 推荐 int rcount = 0; int pagesize = 10; List <ViewtMessage> recommendEntity = new List <ViewtMessage>(); recommendEntity = clientMsg.GettMessageUidList(id, 1, page, pagesize, out rcount); List <ViewtMessageGroup> listGroupRec = new List <ViewtMessageGroup>(); foreach (var item in recommendEntity) { ViewtMessageGroup model = new ViewtMessageGroup(); model.entity = item; //被留言人 ViewYogaUser yuser = clientUser.GetYogaUserById(item.ToUid.Value); if (yuser != null) { model.ToUser = yuser.NickName; } //留言人 ViewYogaUser usermodel = clientUser.GetYogaUserById(item.FromUid.Value); if (usermodel != null) { model.FromUser = usermodel.NickName; } if (item.FormType == 0) { //习练者头像 using (YogaUserDetailServiceClient clientDet = new YogaUserDetailServiceClient()) { ViewYogaUserDetail ViewDet = new ViewYogaUserDetail(); if (item.FromUid != 0) { model.DisplayImg = clientDet.GetYogaUserDetailById(item.FromUid.Value).DisplayImg; } model.sUrl = "/YogaUserDetail/Details/" + item.FromUid.Value; } } else { //导师头像 using (YogisModelsServiceClient clientDet = new YogisModelsServiceClient()) { ViewYogisModels ViewDet = new ViewYogisModels(); if (item.FromUid != 0) { model.DisplayImg = clientDet.GetYogisModelsById(item.FromUid.Value).DisplayImg; } model.sUrl = "/YogisModels/Details/" + item.FromUid.Value; } } //回复 List <ViewtMessage> listM = clientMsg.GettMessageParentID(item.ID); List <ViewtMessageGroup> entitylist = new List <ViewtMessageGroup>(); foreach (var it in listM) { ViewtMessageGroup entityMsg = new ViewtMessageGroup(); entityMsg.entity = it; //被留言人 ViewYogaUser yuser2 = clientUser.GetYogaUserById(it.ToUid.Value); if (yuser2 != null) { entityMsg.ToUser = yuser2.NickName; } //留言人 ViewYogaUser usermodel2 = clientUser.GetYogaUserById(it.FromUid.Value); if (usermodel2 != null) { entityMsg.FromUser = usermodel2.NickName; } entitylist.Add(entityMsg); } model.msgList = entitylist; listGroupRec.Add(model); } Session["levelid"] = 1; #endregion Webdiyer.WebControls.Mvc.PagedList <ViewtMessageGroup> lrec = new Webdiyer.WebControls.Mvc.PagedList <ViewtMessageGroup>(listGroupRec, page, pagesize, rcount); ViewBag.rcount = rcount; return(PartialView("PartialRec", lrec)); }
/// <summary> /// 瑜伽达人/导师 主页 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Details(int id, int page = 1) { #region 站内信-信息数量 int tinstatcount = 0; int follcount = 0; int zancount = 0; int msgcount = 0; method.InstationInfo(user.Uid, out tinstatcount, out follcount, out zancount, out msgcount); ViewBag.tinstatcount = tinstatcount; ViewBag.follcount = follcount; ViewBag.zancount = zancount; ViewBag.msgcount = msgcount; ViewBag.AllCount = tinstatcount + follcount + zancount + msgcount; #endregion ///Follow iType ViewBag.UserType = 1; ViewBag.id = id; int strUid = user.Uid; int iLoginID = user.Uid;//登录用户ID ViewBag.iLoginID = user.Uid; #region 导师专页 基本信息 ViewYogisModels temp = new ViewYogisModels(); temp = client.GetYogisModelsById(id); if (!temp.IsNullOrEmpty()) { ///昵称 ViewBag.NickName = clientUser.GetYogaUserById(temp.UID).NickName; strUid = temp.UID; ViewBag.strUid = temp.UID; ///位置 string strCountryID = ""; string strProvinceID = ""; string strCityID = ""; string strDistrictID = ""; if (temp.CountryID != null && temp.CountryID != 0) { strCountryID = GetItemName(temp.CountryID.Value) + "· "; } if (temp.ProvinceID != null && temp.ProvinceID != 0) { strProvinceID = GetItemName(temp.ProvinceID.Value) + " · "; } if (temp.CityID != null && temp.CityID != 0) { strCityID = GetItemName(temp.CityID.Value) + " ·"; } if (temp.DistrictID != null && temp.DistrictID != 0) { strDistrictID = GetItemName(temp.DistrictID.Value); } ViewBag.AddRessName = strCountryID + strProvinceID + strCityID + strDistrictID; ///流派 if (!string.IsNullOrEmpty(temp.YogaTypeid)) { string[] ids = temp.YogaTypeid.Split(','); foreach (var i in ids) { ViewBag.YogaTypeid += GetItemName(Convert.ToInt32(i)) + " "; } } else { ViewBag.YogaTypeid = ""; } ViewBag.listGroup = temp; } #endregion //关注 粉丝 人气 ViewFollow viewMoel = new ViewFollow(); using (FollowServiceClient followClient = new FollowServiceClient()) { ViewBag.iCount = followClient.GetFollowByUid(id); ViewBag.FCount = followClient.GetFollowByCount(id); } #region 瑜伽圈 List <ViewFollow> listFollow = new List <ViewFollow>(); listFollow = clientFoll.GetFollowUidQuiltList(id); ViewFollow vm = clientFoll.GetFollowById(iLoginID, strUid); ViewBag.isfollow = vm == null ? false : vm.isfollow; List <ViewFollowUserDetail> list2Group = new List <ViewFollowUserDetail>(); #region string idsUid = string.Join(",", listFollow.Where(a => a.Uid != id).Select(a => a.Uid)); string idsQuiltUid = string.Join(",", listFollow.Where(a => a.QuiltUid != id).Select(a => a.QuiltUid)); string idsval = idsUid + "," + idsQuiltUid; //数组 var idslist = idsval.Split(',').Distinct(); foreach (var item in idslist) { if (!string.IsNullOrEmpty(item)) { ViewFollowUserDetail model = new ViewFollowUserDetail(); ViewYogaUser modelyoga = clientUser.GetYogaUserById(Convert.ToInt32(item)); if (modelyoga.UserType == 0) { //专页id和被关注id是同一个 //习练者 ViewYogaUserDetail udmodel = clientDetail.GetYogaUserDetailById(Convert.ToInt32(item)); model.spic = CommonInfo.GetDisplayImg(udmodel.DisplayImg); model.userurl = "/YogaUserDetail/Details/"; model.uid = udmodel.UID; //登录表 model.nickname = modelyoga.NickName; list2Group.Add(model); } else if (modelyoga.UserType == 1) { #region 导师 ViewYogisModels mmodel = client.GetYogisModelsById(Convert.ToInt32(item)); model.spic = CommonInfo.GetDisplayImg(mmodel.DisplayImg); //登录表 model.nickname = modelyoga.NickName; if (mmodel.YogisLevel != null) { if (mmodel.YogisLevel == 4) { model.userurl = "/YogaGuru/Details/"; model.nickname = mmodel.RealName; } else { model.userurl = "/YogisModels/Details/"; } } else { model.userurl = "/YogisModels/Details/"; } model.uid = mmodel.UID; #endregion list2Group.Add(model); } } } #endregion ViewBag.list2Group = list2Group; #endregion #region 相册 List <ViewYogaPicture> listPic = new List <ViewYogaPicture>(); int piccount = 0; listPic = clientPic.GetYogaPicturePageList(id, 1, 7, out piccount); if (listPic.Count() > 0) { ViewBag.listPic = listPic; } #endregion int rcount = 0; int mcount = 0; int pagesize = 10; ViewBag.msginfo = method.listMessage(id, 0, page, out mcount);//留言 评论 ViewBag.mcount = mcount; ViewBag.rcount = clientMsg.GettMessageUid(id, 1).Count(); #region 我的日志列表 int count = 0; List <ViewtWriteLog> listwriteLog = logClient.GettWriteLogPageList(id, 1, 6, out count); List <ViewtWriteLogGroup> listLog = new List <ViewtWriteLogGroup>(); foreach (var item in listwriteLog) { ViewtWriteLogGroup model = new ViewtWriteLogGroup(); model.entity = item; ViewYogaUser userEntity = clientUser.GetYogaUserById(item.Uid.Value); if (userEntity != null) { model.UserName = userEntity.NickName; } else { model.UserName = ""; } listLog.Add(model); } ViewBag.listLog = listLog; #endregion ViewBag.url = Request.Url.AbsolutePath; Webdiyer.WebControls.Mvc.PagedList <ViewtMessageGroup> l = new Webdiyer.WebControls.Mvc.PagedList <ViewtMessageGroup>(ViewBag.msginfo, page, pagesize, mcount); string strRec = ""; if (!string.IsNullOrEmpty(Request.Form["levelid"])) { strRec = Request.Form["levelid"]; } if (Session["levelid"] != null) { if (string.IsNullOrEmpty(strRec)) { strRec = Session["levelid"].ToString(); } } if (!string.IsNullOrEmpty(strRec)) { if (strRec == "1") { #region 推荐数据 List <ViewtMessage> recommendEntity = new List <ViewtMessage>(); recommendEntity = clientMsg.GettMessageUidList(id, 1, page, pagesize, out rcount); List <ViewtMessageGroup> listGroupRec = new List <ViewtMessageGroup>(); foreach (var item in recommendEntity) { ViewtMessageGroup model = new ViewtMessageGroup(); model.entity = item; model.entity.iZan = zanclient.ZanCount(item.ID, item.FormType.Value); //被留言人 ViewYogaUser yuser = clientUser.GetYogaUserById(item.ToUid.Value); if (yuser != null) { model.ToUser = yuser.NickName; model.UserType = yuser.UserType; } //留言人 ViewYogaUser usermodel = clientUser.GetYogaUserById(item.FromUid.Value); if (usermodel != null) { model.FromUser = usermodel.NickName; model.UserType = usermodel.UserType; } if (item.FormType == 0) { //习练者头像 using (YogaUserDetailServiceClient clientDet = new YogaUserDetailServiceClient()) { ViewYogaUserDetail ViewDet = new ViewYogaUserDetail(); if (item.FromUid != 0) { model.DisplayImg = clientDet.GetYogaUserDetailById(item.FromUid.Value).DisplayImg; } model.sUrl = "/YogaUserDetail/Details/" + item.FromUid.Value; } } else { //导师头像 using (YogisModelsServiceClient clientDet = new YogisModelsServiceClient()) { ViewYogisModels ViewDet = new ViewYogisModels(); if (item.FromUid != 0) { model.DisplayImg = clientDet.GetYogisModelsById(item.FromUid.Value).DisplayImg; } model.sUrl = "/YogisModels/Details/" + item.FromUid.Value; } } //回复 List <ViewtMessage> listM = clientMsg.GettMessageParentID(item.ID); List <ViewtMessageGroup> entitylist = new List <ViewtMessageGroup>(); foreach (var it in listM) { ViewtMessageGroup entityMsg = new ViewtMessageGroup(); entityMsg.entity = it; //被留言人 ViewYogaUser yuser2 = clientUser.GetYogaUserById(it.ToUid.Value); if (yuser2 != null) { entityMsg.ToUser = yuser2.NickName; } //留言人 ViewYogaUser usermodel2 = clientUser.GetYogaUserById(it.FromUid.Value); if (usermodel2 != null) { entityMsg.FromUser = usermodel2.NickName; } entitylist.Add(entityMsg); } model.msgList = entitylist; listGroupRec.Add(model); } ViewBag.RecInfo = listGroupRec; #endregion Session["levelid"] = strRec; Webdiyer.WebControls.Mvc.PagedList <ViewtMessageGroup> l2 = new Webdiyer.WebControls.Mvc.PagedList <ViewtMessageGroup>(ViewBag.RecInfo, page, pagesize, rcount); if (Request.IsAjaxRequest()) { return(PartialView("PartialRec", l2)); } } } if (Request.IsAjaxRequest()) { Session["levelid"] = 0; return(PartialView("PartialRec", l)); } return(View(l)); }
/// <summary> /// 格式化json /// </summary> /// <param name="imgs"></param> /// <returns></returns> private string FormateJson(List <ViewYogaPicture> imgs, int id, int imgid) { //获得当前相册人 ViewCenters center = null; //获得当前相册人 ViewYogisModels model = null; ViewYogaUserDetail udetail = null; ViewYogaUser u = null; YogaUserDetailServiceClient udetailClient = new YogaUserDetailServiceClient(); YogisModelsServiceClient modelClient = new YogisModelsServiceClient(); YogaUserServiceClient userClient = new YogaUserServiceClient(); string defaultimg = string.Empty; string defaultname = string.Empty; using (CentersServiceClient centerClient = new CentersServiceClient()) { center = centerClient.GetCentersById(id); } if (center != null) { defaultimg = center.CenterPortraint; defaultname = center.CenterName; } tMessageServiceClient mesClient = new tMessageServiceClient(); StringBuilder sb = new StringBuilder(); sb.Append("{"); sb.Append("\"code\":1,"); sb.Append("\"album\":\"默认相册\","); sb.Append(String.Format("\"showimages\":\"{0}\",", imgid)); sb.Append("\"thumbList\":["); using (tMessageServiceClient msgClient = new tMessageServiceClient()) { foreach (ViewYogaPicture img in imgs) { sb.Append("{"); sb.Append("\"id\":"); sb.Append(String.Format("\"{0}\",", img.Pid)); sb.Append("\"title\":"); sb.Append("\"相册\","); sb.Append("\"user\":"); sb.Append(String.Format("\"{0}\",", defaultname)); sb.Append("\"avatar\":"); sb.Append(String.Format("\"{0}\",", defaultimg)); sb.Append("\"time\":"); sb.Append(string.Format("\"{0}\",", img.CreateTime == null ? "" : Convert.ToDateTime(img.CreateTime).ToString("yyyy-MM-dd HH:mm"))); sb.Append("\"desc\":"); sb.Append(string.Format("\"{0}\",", img.PictureContent)); sb.Append("\"thumb\":"); sb.Append(string.Format("\"{0}\",", img.PictureOriginal)); sb.Append("\"large\":"); sb.Append(string.Format("\"{0}\",", img.PictureOriginal)); sb.Append("\"comment\":"); sb.Append("["); List <ViewtMessage> messages = mesClient.GettMessageUid(img.Pid, 5); foreach (ViewtMessage v in messages) { string defcovimg = string.Empty; string defname = string.Empty; if (v.FormType == 0) { udetail = udetailClient.GetYogaUserDetailById((int)v.FromUid); if (udetail != null) { defcovimg = CommonInfo.GetDisplayImg(udetail.DisplayImg); } u = userClient.GetYogaUserById((int)v.FromUid); if (u != null) { defname = u.NickName; } } else { model = modelClient.GetYogisModelsById((int)v.FromUid); if (model != null) { defcovimg = CommonInfo.GetDisplayImg(model.DisplayImg); defname = model.RealName; } } sb.Append("{"); sb.Append("\"avatar\":"); sb.Append(String.Format("\"{0}\",", defcovimg)); sb.Append("\"user\":"); sb.Append(String.Format("\"{0}\",", defname)); sb.Append("\"msg\":"); sb.Append(String.Format("\"{0}\"", v.sContent)); sb.Append("},"); } if (messages != null && messages.Count > 0) { sb.Remove(sb.Length - 1, 1); } sb.Append("]"); sb.Append("},"); } } if (imgs != null && imgs.Count > 0) { sb.Remove(sb.Length - 1, 1); } sb.Append("]"); sb.Append("}"); return(sb.ToString()); }
// // GET: /Manage/YogaPicture/Details/5 /// <summary> /// 审核 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult Details(int id, DateTime?CreateTime, string FName) { ViewBag.Uid = id; ViewYogaPicture picInfo = new ViewYogaPicture(); if (CreateTime != null) { picInfo = client.GetYogaPictureByCreateTime(id, CreateTime.Value); } else if (!string.IsNullOrEmpty(FName)) { picInfo = client.GetYogaPictureById(id, FName); } else { picInfo = client.GetYogaPictureById(id); } if (picInfo == null) { return(Content("<script>alert('已经全部删除!');window.location='/YogaPicture/IndexSearch';</script>")); } //获取相册名称(文件夹) string fileInfo = GetAllFolder(id); string[] ids = fileInfo.Split(','); if (ids.Count() > 0) { List <SelectListItem> selectlist = new List <SelectListItem> { }; foreach (var i in ids) { if (!string.IsNullOrEmpty(i)) { selectlist.Add(new SelectListItem { Text = i, Value = i, Selected = false }); } } ViewData["FName"] = selectlist; } // #region ViewBag.picInfo = picInfo; ViewYogisModels model = modelclient.GetYogisModelsById(id); if (model != null) { if (!string.IsNullOrEmpty(model.RealName)) { ViewBag.Name = model.RealName; } else { ViewYogaUserDetail detEntity = userDetclient.GetYogaUserDetailById(id); if (detEntity != null) { if (!string.IsNullOrEmpty(detEntity.RealName_cn)) { ViewBag.Name = detEntity.RealName_cn; } } else { ViewYogaUser userEntity = userclient.GetYogaUserById(id); if (userEntity != null) { if (!string.IsNullOrEmpty(userEntity.NickName)) { ViewBag.Name = userEntity.NickName; } } } } } else { ViewYogaUserDetail detEntity = userDetclient.GetYogaUserDetailById(id); if (detEntity != null) { if (!string.IsNullOrEmpty(detEntity.RealName_cn)) { ViewBag.Name = detEntity.RealName_cn; } } else { ViewYogaUser userEntity = userclient.GetYogaUserById(id); if (userEntity != null) { if (!string.IsNullOrEmpty(userEntity.NickName)) { ViewBag.Name = userEntity.NickName; } } } } #endregion if (!string.IsNullOrEmpty(FName)) { list = client.GetBackUidList(id, FName); } else if (CreateTime != null) { ViewBag.CreateTime = CreateTime; list = client.GetBackUidList(id, CreateTime.Value); } else { list = client.GetBackUidList(id); } ViewBag.list = list; return(View()); }
/// <summary> /// 评论/留言 /// </summary> /// <param name="id"></param> /// <returns></returns> public List <ViewtMessageGroup> listMessage(int id, int iType, int page, out int rcount) { #region 留言 if (page == 0) { page = 1; } int pagesize = 10; List <ViewtMessage> msgEntity = new List <ViewtMessage>(); //msgEntity = msgclient.GettMessageUid(id, 0); msgEntity = msgclient.GettMessageUidList(id, iType, page, pagesize, out rcount); List <ViewtMessageGroup> listGroupMsg = new List <ViewtMessageGroup>(); foreach (var item in msgEntity) { ViewtMessageGroup model = new ViewtMessageGroup(); model.entity = item; model.entity.iZan = zanclient.ZanCount(item.ID, item.FormType.Value); //被留言人 ViewYogaUser yuser = clientUser.GetYogaUserById(item.ToUid.Value); if (yuser != null) { model.ToUser = yuser.NickName; model.UserType = yuser.UserType; } //留言人 ViewYogaUser usermodel = clientUser.GetYogaUserById(item.FromUid.Value); if (usermodel != null) { model.FromUser = usermodel.NickName; model.UserType = usermodel.UserType; } #region 头像 if (item.FormType == 0) { //习练者头像 using (YogaUserDetailServiceClient clientDet = new YogaUserDetailServiceClient()) { ViewYogaUserDetail ViewDet = new ViewYogaUserDetail(); if (item.FromUid != 0) { ViewDet = clientDet.GetYogaUserDetailById(item.FromUid.Value); if (ViewDet != null) { model.DisplayImg = ViewDet.DisplayImg; } model.sUrl = "/YogaUserDetail/Details/" + item.FromUid.Value; } } } else { //导师头像 using (YogisModelsServiceClient clientDet = new YogisModelsServiceClient()) { ViewYogisModels ViewDet = new ViewYogisModels(); if (item.FromUid != 0) { ViewDet = clientDet.GetYogisModelsById(item.FromUid.Value); if (ViewDet != null) { model.DisplayImg = ViewDet.DisplayImg; } model.sUrl = "/YogisModels/Details/" + item.FromUid.Value; } } } #endregion //strPic //回复 List <ViewtMessage> listM = msgclient.GettMessageParentID(item.ID); List <ViewtMessageGroup> entitylist = new List <ViewtMessageGroup>(); foreach (var it in listM) { ViewtMessageGroup entityMsg = new ViewtMessageGroup(); entityMsg.entity = it; //被留言人 ViewYogaUser yuser2 = clientUser.GetYogaUserById(it.ToUid.Value); if (yuser2 != null) { entityMsg.ToUser = yuser2.NickName; } //留言人 ViewYogaUser usermodel2 = clientUser.GetYogaUserById(it.FromUid.Value); if (usermodel2 != null) { entityMsg.FromUser = usermodel2.NickName; } entitylist.Add(entityMsg); } model.msgList = entitylist; listGroupMsg.Add(model); } #endregion return(listGroupMsg); }
//被关注 public ActionResult FollowIndex(int page = 1) { List <ViewFollow> listWhere0 = followclient.GetFollowQuiltUidList(user.Uid, 0, out count); if (count > 0) { //第一次登录 foreach (ViewFollow item in listWhere0) { item.loginType = 1; followclient.Update(item); } } else { List <ViewFollow> listWhere1 = followclient.GetFollowQuiltUidList(user.Uid, 1, out count); if (count > 0) { foreach (ViewFollow item in listWhere1) { item.loginType = 2; followclient.Update(item); } } } List <ViewFollow> followlist = followclient.GetFollowQuiltUidList(user.Uid, page, 10, out count); PagedList <ViewFollow> pagelist = new PagedList <ViewFollow>(followlist, page, 10, count); #region List <ViewFollowUserDetail> listFollowGroup = new List <ViewFollowUserDetail>(); foreach (var item in followlist) { ViewYogaUser userEntity = clientUser.GetYogaUserById(item.Uid); ViewFollowUserDetail model = new ViewFollowUserDetail(); model.FollowersName = userEntity.NickName;//昵称 model.flag = item.iType.Value; model.CreateTime = item.FollowDate; model.iNew = item.loginType.Value; if (userEntity.UserType == 0) { //习练者 ViewYogaUserDetail udmodel = udclient.GetYogaUserDetailById(item.Uid); model.spic = CommonInfo.GetDisplayImg(udmodel.DisplayImg); model.userurl = "/YogaUserDetail/Details/"; model.uid = udmodel.UID; listFollowGroup.Add(model); } else if (userEntity.UserType == 1) { //导师 ViewYogisModels mmodel = clientModel.GetYogisModelsById(item.Uid); model.spic = CommonInfo.GetDisplayImg(mmodel.DisplayImg); if (mmodel.YogisLevel == 4) { model.userurl = "/YogaGuru/Details/"; model.nickname = mmodel.RealName; } else { model.userurl = "/YogisModels/Details/"; } model.uid = mmodel.UID; listFollowGroup.Add(model); } } ViewBag.listFollowGroup = listFollowGroup; #endregion return(View("FollowIndex", pagelist)); }
public ActionResult IndexSearch(int page = 1) { int count = 0; // list=client.GetYogaPicturePageList(page, 10, out count); var list2 = client.GetYogaPicturePageList(0).Where(a => a.PictureType == 2); var finq = (from l in list2 group l by new { PictureName = l.PictureName, Uid = l.Uid, iAudio = l.iAudio, CreateTime = l.CreateTime } into grouped orderby grouped.Key.CreateTime descending select new ViewYogaPicture { PictureName = grouped.Key.PictureName, Uid = grouped.Key.Uid, iAudio = grouped.Key.iAudio, CreateTime = grouped.Key.CreateTime }); count = finq.Count(); var finqlist = finq.Skip((page - 1) * 10).Take(10).ToList(); PagedList <ViewYogaPicture> pagelist = new PagedList <ViewYogaPicture>(finqlist, page, 10, count); List <ViewYogaPictureGroup> listGroup = new List <ViewYogaPictureGroup>(); foreach (var item in finqlist) { ViewYogaPictureGroup model = new ViewYogaPictureGroup(); model.entity = item; using (YogisModelsServiceClient uclient = new YogisModelsServiceClient()) { ViewYogisModels mm = uclient.GetYogisModelsById(item.Uid); if (mm != null) { model.RealName = mm.RealName; if (string.IsNullOrEmpty(mm.RealName)) { ViewYogaUserDetail mmm = userDetclient.GetYogaUserDetailById(item.Uid); if (mmm != null) { model.RealName = mmm.RealName_cn; } } } else { ViewYogaUserDetail mmm = userDetclient.GetYogaUserDetailById(item.Uid); if (mmm != null) { model.RealName = mmm.RealName_cn; } if (mmm != null) { model.RealName = mmm.RealName_cn; } } } listGroup.Add(model); } ViewBag.listGroup = listGroup; return(View(pagelist)); }
//BasicInfo user = Commons.Helper.Login.GetCurrentUser(); //[WebMethod(EnableSession = true)] public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Charset = "utf-8"; System.IO.Stream stream = null; System.Drawing.Image originalImg = null; //原图 System.Drawing.Image thumbImg = null; //缩放图 try { int minWidth = 100; //最小宽度 int minHeight = 100; //最小高度 int maxWidth = 500; //最大宽度 int maxHeight = 500; //最大高度 string resultTip = string.Empty; //返回信息 HttpPostedFile file = context.Request.Files["Filedata"]; //上传文件 string uid = @context.Request.Params["Uid"]; string iType = @context.Request.Params["UserType"]; //string uploadPath = HttpContext.Current.Server.MapPath(@context.Request["folder"]); //得到上传路径 string uploadPath = HttpContext.Current.Server.MapPath("~/Files/avatar/original"); string uploadPathUid = HttpContext.Current.Server.MapPath("~/Files/avatar/original/" + uid); string lastImgUrl = @context.Request.Params["LastImgUrl"]; if (!string.IsNullOrEmpty(lastImgUrl)) { // PubClass.FileDel(HttpContext.Current.Server.MapPath(lastImgUrl)); } if (file != null) { if (!System.IO.Directory.Exists(uploadPath)) { System.IO.Directory.CreateDirectory(uploadPath); } if (!System.IO.Directory.Exists(uploadPathUid)) { System.IO.Directory.CreateDirectory(uploadPathUid); } string ext = System.IO.Path.GetExtension(file.FileName).ToLower(); //上传文件的后缀(小写) if (ext == ".jpg" || ext == ".png") { string flag = "ThumbNail" + DateTime.Now.ToFileTime() + ext; string uploadFilePath = uploadPathUid + "\\" + flag; //缩放图文件路径 stream = file.InputStream; originalImg = System.Drawing.Image.FromStream(stream); if (originalImg.Width > minWidth && originalImg.Height > minHeight) { thumbImg = PubClass.GetThumbNailImage(originalImg, maxWidth, maxHeight); //按宽、高缩放 if (thumbImg.Width > minWidth && thumbImg.Height > minWidth) { thumbImg.Save(uploadFilePath); resultTip = "/Files/avatar/original/" + uid + "/" + flag + "$" + thumbImg.Width + "$" + thumbImg.Height; if (!string.IsNullOrEmpty(iType)) { if (iType == "0") { ViewYogaUserDetail listModel = new ViewYogaUserDetail(); using (YogaUserDetailServiceClient clientModels = new YogaUserDetailServiceClient()) { listModel = clientModels.GetYogaUserDetailById(Convert.ToInt32(uid)); if (!string.IsNullOrEmpty(listModel.DisplayImg)) { string[] ids = listModel.DisplayImg.Split(';'); if (ids.Count() > 1) { if (!string.IsNullOrEmpty(ids[0])) { PubClass.FileDel(HttpContext.Current.Server.MapPath("~" + ids[0].Split('$')[0])); } listModel.DisplayImg = resultTip + ";" + ids[1]; } else { listModel.DisplayImg = resultTip + ";"; } } else { listModel.DisplayImg = resultTip + ";"; } clientModels.Update(listModel); } } else if (iType == "1") { ViewYogisModels Model = new ViewYogisModels(); using (YogisModelsServiceClient client = new YogisModelsServiceClient()) { Model = client.GetYogisModelsById(Convert.ToInt32(uid)); if (!string.IsNullOrEmpty(Model.DisplayImg)) { string[] ids = Model.DisplayImg.Split(';'); if (ids.Count() > 1) { if (!string.IsNullOrEmpty(ids[0])) { PubClass.FileDel(HttpContext.Current.Server.MapPath("~" + ids[0].Split('$')[0])); } Model.DisplayImg = resultTip + ";" + ids[1]; } else { Model.DisplayImg = resultTip + ";"; } } else { Model.DisplayImg = resultTip + ";"; } client.Update(Model); } } } } else { resultTip = "图片比例不符合要求"; } } else { resultTip = "图片尺寸必须大于" + minWidth + "*" + minHeight; } } } else { resultTip = "上传文件为空"; } context.Response.Write(resultTip); } catch (Exception) { throw; } finally { if (originalImg != null) { originalImg.Dispose(); } if (stream != null) { stream.Close(); stream.Dispose(); } if (thumbImg != null) { thumbImg.Dispose(); } GC.Collect(); } }
/// <summary> /// 查看别人的瑜珈圈 /// </summary> /// <param name="Uid"></param> /// <returns></returns> public ActionResult Index(int Uid) { ViewBag.id = Uid; #region 瑜伽圈 list = client.GetFollowQuiltUidList(Uid); List <ViewFollowUserDetail> listGroup = new List <ViewFollowUserDetail>(); foreach (var item in list) { //登录表 ViewYogaUser umodel = yuserclient.GetYogaUserById(item.QuiltUid); ViewFollowUserDetail model = new ViewFollowUserDetail(); model.FollowersName = umodel.NickName; model.flag = item.iType.Value; if (item.iType == 0) { //习练者 ViewYogaUserDetail udmodel = userdetailsclient.GetYogaUserDetailById(item.QuiltUid); model.spic = CommonInfo.GetDisplayImg(udmodel.DisplayImg); model.userurl = "/YogaUserDetail/Details/"; model.uid = udmodel.UID; //登录表 model.nickname = yuserclient.GetYogaUserById(item.QuiltUid).NickName; //粉丝 model.FollowCount = client.GetFollowByCount(item.Uid); model.FollowersCount = client.GetFollowByCount(item.QuiltUid);//你关注的人的粉丝 model.Leval = udmodel.Ulevel; listGroup.Add(model); } else if (item.iType == 1) { //导师 ViewYogisModels mmodel = modelclient.GetYogisModelsById(item.QuiltUid); model.spic = CommonInfo.GetDisplayImg(mmodel.DisplayImg); //登录表 model.nickname = yuserclient.GetYogaUserById(item.QuiltUid).NickName; if (mmodel.YogisLevel != null) { if (mmodel.YogisLevel == 4) { model.userurl = "/YogaGuru/Details/"; model.nickname = mmodel.RealName; } else { model.userurl = "/YogisModels/Details/"; } } else { model.userurl = "/YogisModels/Details/"; } model.uid = mmodel.UID; //粉丝 model.FollowCount = client.GetFollowByCount(item.Uid); model.FollowersCount = client.GetFollowByCount(item.QuiltUid);//你关注的人的粉丝 model.Leval = mmodel.YogisLevel.Value; listGroup.Add(model); } } ViewBag.listGroup = listGroup; #endregion return(View(list)); }
// // GET: /Message/Details/5 public ActionResult MyMessage(int iType, int page = 1) { ViewBag.delif = iType; ViewBag.iType = 2; int count = 0; ViewBag.uid = user.Uid; int pagesize = 10; List <ViewLogsMessages> logsmsgs = new List <ViewLogsMessages>(); ViewLogsMessages lm; List <ViewtWriteLog> ls = logclient.GettWriteLogPageListByMessage(iType, user.Uid, page, pagesize, out count); foreach (ViewtWriteLog log in ls) { lm = new ViewLogsMessages(); //留言人 ViewYogaUser usermodel = clientUser.GetYogaUserById(log.Uid.Value); if (usermodel != null) { ViewBag.currentname = lm.name = usermodel.NickName; if (usermodel.UserType == 0) { ViewBag.url = lm.userurl = "/YogaUserDetail/Details/" + log.Uid; ViewYogaUserDetail ViewDet = udclient.GetYogaUserDetailById((int)log.Uid); if (ViewDet != null) { ViewBag.DisplayImg = CommonInfo.GetDisplayImg(ViewDet.DisplayImg); } } else { ViewBag.url = lm.userurl = "/YogisModels/Details/" + log.Uid; ViewYogisModels ViewDet = mclient.GetYogisModelsById((int)log.Uid); if (ViewDet != null) { ViewBag.DisplayImg = CommonInfo.GetDisplayImg(ViewDet.DisplayImg); } } } lm.id = log.ID.ToString(); lm.title = log.sTitle; lm.imgurl = GetFirstImages(log.sContent); string noContent = NoHTML(log.sContent); if (noContent.Length > 120) { noContent = noContent.Substring(0, 120) + "..."; } lm.content = noContent; int mescount = 0; lm.messages = listMessage(log.ID, 1, 50, out mescount); lm.messagescount = mescount; logsmsgs.Add(lm); } Webdiyer.WebControls.Mvc.PagedList <ViewLogsMessages> pagelist = new Webdiyer.WebControls.Mvc.PagedList <ViewLogsMessages>(logsmsgs, page, pagesize, count); if (Request.IsAjaxRequest()) { return(PartialView("PartialMsg", pagelist)); } else { return(View(pagelist)); } }