public ActionResult ViewReport(int?classid, int id = 0) { ViewClass @class = null; ViewClassReport report = null; if (classid > 0) { @class = client.Get((int)classid); report = @class.Reports[0]; } else if (id > 0) { ClassReportServiceClient rc = new ClassReportServiceClient(); report = rc.Get(id); @class = client.Get(report.ClassId); } int nowIndex = 0; for (int i = 0; i < @class.Reports.Count; i++) { if (@class.Reports[i].Id == report.Id) { nowIndex = i; break; } } //更多中移除当前活动 @class.Reports.RemoveAt(nowIndex); ViewBag.Class = @class; return(View(report)); }
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 AddReport() { JavaScriptSerializer seria = new JavaScriptSerializer(); ViewClassReport report = seria.Deserialize <ViewClassReport>(Request.Form["data"]); ClassReportServiceClient client = new ClassReportServiceClient(); report.UserId = 0; client.Add(report); //qiqi 2015-11-23 //start 把Content中图片添加到相册YogaPicture,类型:6 YogaPictureServiceClient picclient = new YogaPictureServiceClient(); Regex rg = new Regex("src=\"([^\"]+)\"", RegexOptions.IgnoreCase); var m = rg.Match(report.Content); while (m.Success) { ViewYogaPicture picModel = new ViewYogaPicture(); picModel.PictureOriginal = m.Groups[1].Value;//这里就是图片路径 picModel.PictureType = 6; picModel.CreateTime = DateTime.Now; picModel.PictureName = "活动相册"; picModel.Uid = 100316;//管理员 picModel.CreateUser = 100316; picModel.PictureContent = "活动相册"; picModel.HitNum = 0; picModel.iAudio = 1; picModel.PictureSmall = ""; picModel.AlbumId = 0; picModel.EvaluateId = 0; picModel.Comid = 0; picModel.PictureLarge = ""; picModel.PictureMiddle = ""; picModel.PircureSize = ""; picModel.CommentCount = 0; picModel.LikeCount = 0; picModel.NotLikeCount = 0; picModel.CommentLimite = 0; picModel.LastChangeTime = DateTime.Now; picclient.Add(picModel); m = m.NextMatch(); } //end return(Json(report)); }
// 添加活动报道 public ActionResult AddReport(int classId, int?id) { ViewClassReport report = new ViewClassReport(); if (id != null) { ClassReportServiceClient client = new ClassReportServiceClient(); report = client.Get((int)id); } else { report.Id = 0; report.ClassId = 0; } return(View(report)); }
public JsonResult Delete(int id, int UserId) { try { // TODO: Add delete logic here //活动导师 //ClassTeacherServiceClient teahclient = new ClassTeacherServiceClient(); //List<ViewClassTeacher> ctlist = teahclient.GetClass_Id(id); //if (ctlist.Count() > 0) //{ // foreach (var i in ctlist) // { // teahclient.Delete(i.Id.ToString()); // } //} ////兴趣 //InterestServiceClient insertClient = new InterestServiceClient(); //List<ViewInterestedClass> interlist = insertClient.GetListClassId(id); //if (interlist.Count() > 0) //{ // foreach (var i in interlist) // { // i.Class = null; // insertClient.Delete(i.Id.ToString()); // } //} //活动报道 ClassReportServiceClient clentRep = new ClassReportServiceClient(); if (clentRep.GetClassId(id).Count() == 0) { //活动 ClassServiceClient client = new ClassServiceClient(); ViewClass model = client.Get(id); model.IsDeleted = true; client.Edit(model); return(Json(new { code = 0 })); } return(Json(new { code = 2 })); } catch { return(Json(new { code = 1 })); } }
/// <summary> /// /// </summary> /// <param name="id">报道ClassId</param> /// <param name="classReportId">报道id</param> /// <param name="page"></param> /// <returns></returns> public ActionResult ActivityReportDetailsPage(int id, int classReportId, int page = 1) { ViewBag.id = id; int rcount = 0; int pagesize = 10; ViewClass entity = new ViewClass(); entity = client.Get(id); if (entity.iReadNums == null) { entity.iReadNums = 1; } else { entity.iReadNums++; } client.Edit(entity); ViewBag.iShareNums = entity.iShareNums == null ? 0 : entity.iShareNums; ViewBag.Entity = entity; ViewBag.interCount = interclient.Count(id); //分享人数 ViewBag.MsgInfo = method.listMessage(id, 3, page, out rcount); //评论 YogisModelsServiceClient ymClient = new YogisModelsServiceClient(); //老师粉丝 FollowServiceClient followClient = new FollowServiceClient(); int teacherFollowCount = 0; foreach (var item in entity.Teachers) { //followClient.GetFollowUidList(item.UserId, 1, 1, out teacherFollowCount); //ViewData[item.UserId.ToString()] = teacherFollowCount; var ymModel = ymClient.GetById((int)item.TeacherId); int num = followClient.GetFollowByCount(ymModel.UID); ViewData[item.UserId.ToString()] = num; } //发起人粉丝 ViewBag.Sponsor = followClient.GetFollowByCount(entity.UserId); Webdiyer.WebControls.Mvc.PagedList <ViewtMessageGroup> messlist = new Webdiyer.WebControls.Mvc.PagedList <ViewtMessageGroup>(ViewBag.MsgInfo, page, pagesize, rcount); if (Request.IsAjaxRequest()) { return(PartialView("PartialMessage", messlist)); } ViewData["ClassStatus"] = Session["ClassStatus"]; using (ClassReportServiceClient rClient = new ClassReportServiceClient()) { List <ViewClassReport> classReportList = rClient.GetClassId(id); ViewBag.ClassReport = classReportList; ViewBag.ClassReportShow = new ViewClassReport(); if (classReportList.Any()) { if (classReportId == -99) { ViewBag.ClassReportShow = classReportList.First(); } else { ViewBag.ClassReportShow = classReportList.First(p => p.Id == classReportId); } } } return(View(messlist)); }