Ejemplo n.º 1
0
 public JsonResult DeleteInterest(int classId)
 {
     if (user.Uid > 0)
     {
         InterestServiceClient client = new InterestServiceClient();
         if (client.Exists(classId, user.Uid))
         {
             int r = client.Delete(classId, user.Uid);
             if (r > 0)
             {
                 return(Json(new Result(0, "这个兴趣已经消失了")));
             }
             else
             {
                 return(Json(new Result(1, "删除失败,请重试")));
             }
         }
         else
         {
             return(Json(new Result(1, "你似乎没有关注过这个活动")));
         }
     }
     else
     {
         return(Json(new Result(1, "登陆后再试试吧")));
     }
 }
Ejemplo n.º 2
0
        public BDWMInterest()
        {
            InitializeComponent();

            dt.Columns.Add("id", typeof(Int32));
            dt.Columns.Add("name", typeof(string));
            dgQueryResult.ItemsSource = dt.DefaultView;

            AuthHeader h = new AuthHeader();

            //读取
            if (File.Exists(strFilePath))//读取时先要判读INI文件是否存在
            {
                strSec     = System.IO.Path.GetFileNameWithoutExtension(strFilePath);
                h.username = ContentValue(strSec, "Username");
                h.password = Common.DecryptDES(ContentValue(strSec, "Password"), "WpfQuery");//ContentValue(strSec, "Password");
                h.token    = ContentValue(strSec, "Token");
            }
            else
            {
                MessageBox.Show("account.ini文件不存在");
                return;
            }
            InterestServiceClient client = new InterestServiceClient();

            InterestType[] response;
            ResHeader      resHeader = client.getInterest(h, out response);

            foreach (var ba in response)
            {
                dt.Rows.Add(ba.interestId, ba.interestName);
            }
        }
Ejemplo 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
        }
Ejemplo n.º 4
0
        public static void getAllCustomInterest()
        {
            InterestServiceClient service = new InterestServiceClient();

            AuthHeader authHeader = new AuthHeader();

            HeaderUtil.loadHeader(authHeader);

            CustomInterestType[] interests = null;

            ResHeader resHeader = service.getAllCustomInterest(authHeader, out interests);

            Console.WriteLine("InterestService.getAllCustomInterest(): ");
            ObjectDumper.WriteResponse(resHeader, interests);
        }
Ejemplo n.º 5
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();
 }
Ejemplo n.º 6
0
        public JsonResult AddInterest(int classId)
        {
            ViewInterestedClass   model  = new ViewInterestedClass();
            InterestServiceClient client = new InterestServiceClient();

            if (client.Exists(classId, user.Uid))
            {
                model.Id = client.Delete(classId, user.Uid);
            }
            else
            {
                model.ClassId = classId;
                model.UserId  = user.Uid;
                model.Id      = client.Add(model);
            }
            InterestServiceClient interestClient = new InterestServiceClient();
            int GetCount = interestClient.ClassInterests(classId, 1, 10).RecordCount;

            return(Json(new { code = GetCount }));
        }
Ejemplo n.º 7
0
        public ActionResult ViewActivity(int id)
        {
            //, bool isOrder = false ViewBag.isOrder = isOrder;
            ViewBag.id = id;
            ClassServiceClient       client  = new ClassServiceClient();
            YogaDicItemServiceClient dclient = new YogaDicItemServiceClient();
            ViewClass model             = client.Get(id);
            List <ViewYogaDicItem> dics = dclient.GetSelectList(model.TopicIds);

            model.TopicIds = "";
            //主题
            foreach (var item in dics)
            {
                if (model.TopicIds == "")
                {
                    model.TopicIds = item.ItemName;
                }
                else
                {
                    model.TopicIds = model.TopicIds + " " + item.ItemName;
                }
            }
            //发起人头像
            model.Poster = client.GetAvatars(model.UserId.ToString())[0];

            //兴趣
            InterestServiceClient interestClient = new InterestServiceClient();

            ViewBag.IsInterest    = interestClient.Exists(id, user.Uid);
            ViewBag.InterestCount = interestClient.ClassInterests(id, 1, 10).RecordCount;

            ////老师粉丝
            //FollowServiceClient followClient = new FollowServiceClient();
            //int teacherFollowCount = 0;
            //foreach (var item in model.Teachers)
            //{
            //    followClient.GetFollowUidList(item.UserId, 1, 1, out teacherFollowCount);
            //    ViewData[item.UserId.ToString()] = teacherFollowCount;
            //}

            YogisModelsServiceClient ymClient = new YogisModelsServiceClient();
            //老师粉丝
            FollowServiceClient followClient = new FollowServiceClient();

            foreach (var item in model.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(model.UserId);

            //参加
            OrderServiceClient orderClient = new OrderServiceClient();
            // 只查询出有效的订单
            PageResult <ViewOrder> orders = orderClient.GetByClass(id, 1, 6000);

            //等待加入
            #region
            string uids      = "";
            int    joinCount = 0;
            foreach (ViewOrder item in orders.Objects)
            {
                if (uids == "")
                {
                    uids = item.UserId.ToString();
                }
                else
                {
                    uids += "," + item.UserId;
                }
                joinCount += item.Number;
            }
            ViewBag.JoinCount = joinCount;
            List <UserListItem> orderAvatars   = client.GetAvatars(uids == "" ? "0" : uids);
            List <UserListItem> allJoinAvatars = new List <UserListItem>();
            foreach (var item in orders.Objects)
            {
                foreach (var ui in orderAvatars)
                {
                    if (item.UserId == ui.ID)
                    {
                        for (int i = 0; i < item.Number; i++)
                        {
                            allJoinAvatars.Add(ui);
                        }
                    }
                }
            }
            ViewData["AllJoinAvatars"] = allJoinAvatars;
            #endregion

            return(View(model));
        }