public YogaPictureController()
 {
     client        = new YogaPictureServiceClient();
     list          = new List <ViewYogaPicture>();
     userDetclient = new YogaUserDetailServiceClient();
     userclient    = new YogaUserServiceClient();
     modelclient   = new YogisModelsServiceClient();
 }
Esempio n. 2
0
 public WriteLogController()
 {
     model         = new ViewtWriteLog();
     client        = new tWriteLogServiceClient();
     list          = new List <ViewtWriteLog>();
     userClient    = new YogaUserServiceClient();
     userDetclient = new YogaUserDetailServiceClient();
     modelclient   = new YogisModelsServiceClient();
     method        = new method();
     learclient    = new tLearingServiceClient();
     picclient     = new YogaPictureServiceClient();
 }
Esempio n. 3
0
        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
        }
Esempio n. 4
0
        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
        }
Esempio n. 5
0
        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
        }
Esempio n. 6
0
        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 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
        }
Esempio n. 8
0
 public method()
 {
     client              = new ClassServiceClient();
     dicclient           = new YogaDicItemServiceClient();
     interclient         = new InterestServiceClient();
     msgclient           = new tMessageServiceClient();
     clientUser          = new YogaUserServiceClient();
     clientbanner        = new tBannerServiceClient();
     udclient            = new YogaUserDetailServiceClient();
     modelsclient        = new YogisModelsServiceClient();
     userloginInfoclient = new tUserLoginInfoServiceClient();
     tinstaclient        = new tInstationInfoServiceClient();
     followclient        = new FollowServiceClient();
     zanclient           = new tZanModelsServiceClient();
     messageclient       = new tMessageServiceClient();
     cenclient           = new IYogaKoo.Client.CentersServiceClient();
 }
Esempio n. 9
0
        /// <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());
        }
        //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;
            }
        }
Esempio n. 11
0
        //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();
            }
        }
Esempio n. 12
0
        /// <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);
        }
Esempio n. 13
0
        /// <summary>
        /// 获得当前人的级别
        /// </summary>
        /// <param name="uid">用户ID</param>
        /// <returns></returns>
        public static string GetCurrentLevel(BasicInfo bas)
        {
            string levelname = string.Empty;

            if (bas != null)
            {
                int type = bas.UserType.Value;

                if (type == 0)
                {
                    //习练者
                    using (YogaUserDetailServiceClient userclient = new YogaUserDetailServiceClient())
                    {
                        ViewYogaUserDetail userdetail = userclient.GetYogaUserDetailById(bas.Uid);
                        if (userdetail != null)
                        {
                            int level = userdetail.Ulevel;
                            switch (level)
                            {
                            case (0):
                                levelname = MemberLevel.基础习练者.ToString();
                                break;

                            case (1):
                                levelname = MemberLevel.初级习练者.ToString();
                                break;

                            case (2):
                                levelname = MemberLevel.中级习练者.ToString();
                                break;

                            case (3):
                                levelname = MemberLevel.高级习练者.ToString();
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
                else
                {
                    //导师
                    using (YogisModelsServiceClient modelclient = new YogisModelsServiceClient())
                    {
                        ViewYogisModels model = modelclient.GetById(bas.Uid);
                        if (model != null)
                        {
                            int level = model.YogisLevel.Value;
                            switch (level)
                            {
                            case (0):
                                levelname = TeacherLevel.初级老师.ToString();
                                break;

                            case (1):
                                levelname = TeacherLevel.中级老师.ToString();
                                break;

                            case (2):
                                levelname = TeacherLevel.高级老师.ToString();
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
            return(levelname);
        }
Esempio n. 14
0
        /// <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));
        }
Esempio n. 15
0
        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));
        }