Esempio n. 1
0
 /// <summary>
 /// 获取所有代码数据
 /// </summary>
 /// <returns></returns>
 public DataTable GetAllCode()
 {
     if (HttpContext.Current.Application["Code_tb"] == null)
     {
         var query = new BmobQuery();
         query.Limit(500);
         var       future = Bmob.FindTaskAsync <CodeModel>("Code_tb", query);
         DataTable table  = new DataTable();
         table.Columns.Add(new DataColumn("ObjectId", typeof(string)));
         table.Columns.Add(new DataColumn("Title", typeof(string)));
         table.Columns.Add(new DataColumn("Code", typeof(string)));
         table.Columns.Add(new DataColumn("Author", typeof(string)));
         if (future.Result is IBmobWritable)
         {
             int i = 0;
             foreach (object data in future.Result.results)
             {
                 DataRow row = table.NewRow();
                 row["ObjectId"] = future.Result.results[i].objectId;
                 row["Title"]    = future.Result.results[i].Title;
                 row["Code"]     = future.Result.results[i].Code;
                 row["Author"]   = future.Result.results[i].Author;
                 table.Rows.Add(row); i++;
             }
         }
         Operation.Code_Data = table;
         DataSynchronous("Code_tb");
         return(table);
     }
     else
     {
         Operation.Code_Data = (DataTable)HttpContext.Current.Application["Code_tb"]; return(Operation.Code_Data);
     }
 }
Esempio n. 2
0
        /// <summary>
        ///     下载代理数据
        /// </summary>
        /// <returns></returns>
        private ProxyItems DownloadProxyList(int sinceId, int count)
        {
            //创建一个BmobQuery查询对象
            BmobQuery query = new BmobQuery();

            //查询playerName的值为bmob的记录
            query.WhereEqualTo("isvip", false);
            query.Limit(count);
            query.Skip(sinceId);

            ProxyItems items = new ProxyItems();

            var future = Bmob.FindTaskAsync <ProxyServers>(ProxyServers.TABLE_NAME, query);

            //对返回结果进行处理
            var list = future.Result.results;

            if (list != null && list.Count > 0)
            {
                items.items = new List <ProxyServer>();
                foreach (var model in list)
                {
                    var proxy = model.Get();
                    items.items.Add(proxy);
                }
            }
            else
            {
                items = null;
            }


            return(items);
        }
Esempio n. 3
0
        public void queryCommodity(string category, string subcategory)
        {
            var bmobQuery = new BmobQuery();

            if (category.Equals("促销"))
            {
                bmobQuery.WhereEqualTo("Promotion", "true");
            }
            else if (category.Equals("广告"))
            {
                bmobQuery.WhereEqualTo("AD", "true");
            }
            else
            {
                bmobQuery.WhereEqualTo("Category", category);
            }
            if (subcategory != null)
            {
                bmobQuery.WhereEqualTo("CategorySub", subcategory);
            }
            bmobQuery.Limit(1000);
            _bmobWindows.Find <Commodity>("Commodity", bmobQuery, (resp, ex) =>
            {
                if (ex != null)
                {
                    Debug.WriteLine("查询出错:" + ex.Message);
                    return;
                }
                var commodities = resp.results;
                _view.commodityShow(commodities);
            });
        }
Esempio n. 4
0
    /// <summary>
    /// 寻找数据根据条件
    /// </summary>
    private IEnumerator FindByCondition(string score, Action action = null)
    {
        BmobQuery query = new BmobQuery();

        //设置最多返回20条记录
        query.Limit(20);
//        //条件 大于500的
//        query.WhereGreaterThan(score, 500);
        //降序排列
        query.OrderByDescending(score);

        bool isFindOver = false;

        GameStart.instance.StartCoroutine(BmobManager.Instance.ConditionFind <BmobTab_RankingList>(query, BmobTab_RankingList.TABLENAME,
                                                                                                   (List <BmobTab_RankingList> list, bool isOver) =>
        {
            mPlayerInfoList = list;
            isFindOver      = true;
            Debug.Log("找到了数据");
        }));
        while (!isFindOver)
        {
            yield return(new WaitForSeconds(0.1f));
        }
        if (action != null)
        {
            action();
        }
        if (mPlayerInfoList == null)
        {
            mPlayerInfoList = new List <BmobTab_RankingList>();
        }
    }
Esempio n. 5
0
        public static async Task <QueryCallbackData <BmobModel> > queryAllModelsMessage()
        {
            BmobQuery query = new BmobQuery();

            query.Limit(100);
            return(await Bmob.FindTaskAsync <BmobModel>(BmobModel.table_name, query));
        }
Esempio n. 6
0
        public object GetQueryNumOfCourse(String classId)
        {
            var query = new BmobQuery();

            query.Limit(300);
            query.WhereEqualTo("classId", classId);
            var        query1   = new BmobQuery();
            HttpCookie cookie1  = HttpContext.Current.Request.Cookies["CurrentCourse"];
            String     Id       = cookie1["CourseId"];
            int        courseId = int.Parse(Id);

            query1.WhereEqualTo("courseId", courseId);
            query = query.And(query1);
            query.OrderByDescending("totalNum");
            var future = Bmob.FindTaskAsync <Feedback>("Feedback", query);

            try
            {
                feedbackList = future.Result.results;
                foreach (var f in feedbackList)     //由于BmobModel中有BmobInt类型不能直接显示到页面中,所以需要对字段的类型进行处理,变为相对应的ViewModel格式。
                {
                    Feedback_View feedback_view = new Feedback_View();
                    feedback_view.objectId = f.objectId;
                    feedback_view.username = f.username;
                    feedback_view.nickname = f.nickname;
                    feedback_view.totalNum = f.totalNum.Get();
                    fList.Add(feedback_view);
                }
                return(ResultToJson.toJson(fList));
            }
            catch
            {
                return("获取失败");
            }
        }
Esempio n. 7
0
        public static IPromise <List <Mark> > queryFuzzyMarks(Coordinate coodinate, int limit)
        {
            BmobQuery query = new BmobQuery();

            query.WhereNear("position", new BmobGeoPoint(coodinate.latitude, coodinate.lontitude));
            query.Limit(limit);
            Debug.LogError("1");
            List <Mark>            marks = new List <Mark>();
            Promise <List <Mark> > p     = new Promise <List <Mark> >(async(resolve, reject) =>
            {
                Debug.LogError(2);
                QueryCallbackData <Marks> data = await Bmob.FindTaskAsync <Marks>(Marks.table_name, query);
                Debug.LogError(333);
                Debug.LogError(data.results.Count);

                foreach (var mark in data.results)
                {
                    marks.Add(new Mark {
                        coordinate = new Coordinate(mark.coordinate.Latitude.Get(), mark.coordinate.Longitude.Get()), id = mark.objectId
                    });
                }
                Debug.LogError(323);
                resolve(marks);
                Debug.LogError(334);
                //Window.instance.startCoroutine(getMark(resolve, reject, query));
            });

            return(p);
            //return promise;
            //Bmob.CreateTaskAsync()
            //query.
        }
Esempio n. 8
0
        [HttpGet]                       //定义访问方式(Post或Get方法)
        public object Get()             //返回数据的函数,如果是Get方法则方法名为Get开头,若是Post则使用Post开头。
        {
            HttpCookie cookie1  = HttpContext.Current.Request.Cookies["CurrentCourse"];
            String     id       = cookie1["CourseId"];
            int        courseId = int.Parse(id);
            var        query    = new BmobQuery();

            query.Limit(300);
            query.WhereEqualTo("courseId", courseId);
            query.OrderBy("id");
            var future = Bmob.FindTaskAsync <Examination>("Examination", query);

            try
            {
                examinationList = future.Result.results;
                foreach (var e in examinationList)     //由于BmobModel中有BmobInt类型不能直接显示到页面中,所以需要对字段的类型进行处理,变为相对应的ViewModel格式。
                {
                    Examination_View examination_View = new Examination_View();
                    examination_View.objectId     = e.objectId;
                    examination_View.name         = e.name;
                    examination_View.questionList = e.questionList;
                    examination_View.id           = e.id.Get();
                    examination_View.difficulty   = e.difficulty.Get();
                    examination_View.courseId     = e.courseId.Get();
                    eList.Add(examination_View);
                }
            }
            catch
            {
            }
            return(ResultToJson.toJson(eList));      //返回数据需要json格式
        }
Esempio n. 9
0
    /// <summary>
    /// 读取金币记录
    /// </summary>
    public void loadJinBI()
    {
        this.Items.Clear();
        BmobQuery query = new BmobQuery();

        query.WhereEqualTo("jieShouUserId", JYCaoZuo.getCaoZuo().user.userId);
        query.OrderByDescending("createdAt");
        query.Limit(50);
        bmob.Find <message>("message", query, (resp, exception) =>
        {
            if (exception != null)
            {
                JYCaoZuo.getCaoZuo().showMessagem("查询异常" + exception.Message);

                return;
            }
            JYCaoZuo.getCaoZuo().showMessagem("查 结果" + resp);
            this.page.Dispatcher.BeginInvoke(delegate
            {
                foreach (message li in resp.results)
                {
                    JYJinBiJiLuMode mode = new JYJinBiJiLuMode();
                    mode.MessgeType      = li.messgeType;
                    mode.SendUserId      = li.sendUserId;
                    mode.JieShouUserId   = li.jieShouUserId;
                    mode.Title           = li.title;
                    mode.Content         = li.content;
                    mode.CreatTime       = li.createdAt;
                    mode.objiectId       = li.objectId;
                    // liShiJiLu li = resp.results[0];
                    this.Items.Add(mode);
                }
            });
        });
    }
Esempio n. 10
0
        public static async Task <QueryCallbackData <Mark> > queryFuzztMarksAsync(Coordinate coodinate, int limit)
        {
            BmobQuery query = new BmobQuery();

            query.WhereNear("position", new BmobGeoPoint(coodinate.latitude, coodinate.lontitude));
            query.Limit(limit);
            return(await Bmob.FindTaskAsync <Mark>(Mark.table_name, query));
        }
Esempio n. 11
0
        public IList <TB_TechniqueMission> FindUnFinishMission()
        {
            BmobQuery query = new BmobQuery();

            query.WhereGreaterThanOrEqualTo("FinishDate", InvailDate);
            query.Limit(1000);
            return(FindByQuery(query));
        }
Esempio n. 12
0
        public void FindTest()
        {
            var query = new BmobQuery();

            query.Limit(1);
            var future = Bmob.FindTaskAsync <GameObject>(TABLENAME, query);

            FinishedCallback(future.Result, null);
        }
Esempio n. 13
0
        //获取所有数据
        public IEnumerable <TModel> GetAll(string BmobTable)
        {
            var query = new BmobQuery();

            query.Limit(500);
            var future = Bmob.FindTaskAsync <TBmobModel>(BmobTable, query);
            var model  = DataMapperHelper.MapList <TModel>(future.Result.results);

            return(model);
        }
Esempio n. 14
0
    public void loadDuiHuanList()
    {
        this.itemsForDuiHuan.Clear();
        BmobQuery query = new BmobQuery();

        query.OrderByDescending("createdAt");
        query.WhereEqualTo("duiHuanType", 1);
        BmobQuery query2 = new BmobQuery();

        query2.WhereEqualTo("duiHuanType", 0);
        query.Or(query2);
        // query.WhereEqualTo("duiHuan", JYCaoZuo.getCaoZuo().user.userId);
        query.Limit(10);
        bmob.Find <duiHuan>("duiHuan", query, (resp, exception) =>
        {
            if (exception != null)
            {
                JYCaoZuo.getCaoZuo().showMessagem("查询异常" + exception.Message);

                return;
            }
            JYCaoZuo.getCaoZuo().showMessagem("查 结果" + resp);
            this.page.Dispatcher.BeginInvoke(delegate
            {
                foreach (duiHuan li in resp.results)
                {
                    JYDuiHuanJiLuModel duicell = new JYDuiHuanJiLuModel();
                    try
                    {
                        duicell.userId = li.userId;
                        duicell.name   = "*" + li.shiMing.Substring(1, li.shiMing.Length - 1);
                        duicell.qq     = li.qq;

                        string type = "无";
                        if (li.duiHuanType == 0)
                        {
                            type = "等待发货";
                        }
                        if (li.duiHuanType == 1)
                        {
                            type = "已发货";
                        }

                        duicell.content = int.Parse(li.jinE) / 10.0 + "元" + "(" + type + "--" + li.createdAt + ")";

                        duicell.likeNumber = "+" + li.likeNumber;
                        duicell.objictId   = li.objectId;
                    }
                    catch { }
                    this.itemsForDuiHuan.Add(duicell);
                }
            });
        });
    }
Esempio n. 15
0
        public object GetSelectedQuestion(int unitId, String knowledgeId, int difficulty)
        {
            var query = new BmobQuery();

            query.Limit(300);
            HttpCookie cookie1  = HttpContext.Current.Request.Cookies["CurrentCourse"];
            String     Id       = cookie1["CourseId"];
            int        courseId = int.Parse(Id);

            query.WhereEqualTo("courseId", courseId);
            var query1 = new BmobQuery();

            query1.WhereEqualTo("unitId", unitId);
            var query2 = new BmobQuery();

            query2.WhereEqualTo("knowledgeId", knowledgeId);
            var query3 = new BmobQuery();

            query3.WhereEqualTo("difficulty", difficulty);
            query2 = query2.And(query3);
            query1 = query1.And(query2);
            query  = query.And(query1);
            var future = Bmob.FindTaskAsync <Question>("Question", query);

            try
            {
                questionList = future.Result.results;
                foreach (var q in questionList)     //由于BmobModel中有BmobInt类型不能直接显示到页面中,所以需要对字段的类型进行处理,变为相对应的ViewModel格式。
                {
                    Question_View question_view = new Question_View();
                    question_view.id          = q.id.Get();
                    question_view.difficulty  = q.difficulty.Get();
                    question_view.totalNum    = q.totalNum.Get();
                    question_view.rightNum    = q.rightNum.Get();
                    question_view.question    = q.question;
                    question_view.a           = q.a;
                    question_view.b           = q.b;
                    question_view.c           = q.c;
                    question_view.d           = q.d;
                    question_view.answer      = q.answer;
                    question_view.analysis    = q.analysis;
                    question_view.courseId    = q.courseId.Get();
                    question_view.unitId      = q.unitId.Get();
                    question_view.knowledgeId = q.knowledgeId;
                    qList.Add(question_view);
                }
                return(ResultToJson.toJson(qList));
            }
            catch
            {
                return("获取失败");
            }
        }
Esempio n. 16
0
        [HttpGet]                      //定义访问方式(Post或Get方法)
        public object Get()            //返回数据的函数,如果是Get方法则方法名为Get开头,若是Post则使用Post开头。
        {
            var        query    = new BmobQuery();
            HttpCookie cookie   = HttpContext.Current.Request.Cookies["UserInfoRemember"];
            String     username = cookie["username"].ToString();

            query.WhereEqualTo("tId", username);
            query.Limit(300);
            var future = Bmob.FindTaskAsync <Course>("Course", query);

            courseList = future.Result.results;
            foreach (var c in courseList)     //由于BmobModel中有BmobInt类型不能直接显示到页面中,所以需要对字段的类型进行处理,变为相对应的ViewModel格式。
            {
                Course_View course_view = new Course_View();
                course_view.id   = c.id.Get();
                course_view.name = c.name;
                if (c.time != null)
                {
                    course_view.times = "查看教学日历";
                    course_view.timeu = c.time.url;
                }
                else
                {
                    course_view.times = "暂无教学日历";
                    course_view.timeu = "";
                }
                if (c.program != null)
                {
                    course_view.programs = "查看课程大纲";
                    course_view.programu = c.program.url;
                }
                else
                {
                    course_view.programs = "暂无课程大纲";
                    course_view.programu = "";
                }
                if (c.experiment != null)
                {
                    course_view.experiments = "查看实验大纲";
                    course_view.experimentu = c.experiment.url;
                }
                else
                {
                    course_view.experiments = "暂无实验大纲";
                    course_view.experimentu = "";
                }
                cList.Add(course_view);
            }
            return(ResultToJson.toJson(cList));    //返回数据需要json格式
        }
Esempio n. 17
0
        public object GetQueryFeedback(String classId, int unitId)
        {
            var query = new BmobQuery();

            query.Limit(300);
            query.WhereEqualTo("classId", classId);
            var        query1   = new BmobQuery();
            HttpCookie cookie1  = HttpContext.Current.Request.Cookies["CurrentCourse"];
            String     Id       = cookie1["CourseId"];
            int        courseId = int.Parse(Id);

            query1.WhereEqualTo("courseId", courseId);
            var query2 = new BmobQuery();

            query2.WhereEqualTo("unitId", unitId);
            query1 = query1.And(query2);
            query  = query.And(query1);
            //query.OrderByDescending("rightNum");
            var future = Bmob.FindTaskAsync <Feedback>("Feedback", query);

            try
            {
                feedbackList = future.Result.results;
                foreach (var f in feedbackList)     //由于BmobModel中有BmobInt类型不能直接显示到页面中,所以需要对字段的类型进行处理,变为相对应的ViewModel格式。
                {
                    Feedback_View feedback_view = new Feedback_View();
                    feedback_view.objectId = f.objectId;
                    feedback_view.username = f.username;
                    feedback_view.nickname = f.nickname;
                    feedback_view.totalNum = f.totalNum.Get();
                    feedback_view.rightNum = f.rightNum.Get();
                    if (feedback_view.totalNum != 0)
                    {
                        feedback_view.accuracy = 100 * feedback_view.rightNum / feedback_view.totalNum;
                    }
                    fList.Add(feedback_view);
                }
                List <Feedback_View> feedbackSortList = new List <Feedback_View>();
                feedbackSortList = fList.OrderByDescending(s => s.accuracy).ToList();
                return(ResultToJson.toJson(feedbackSortList));
            }
            catch
            {
                return("获取失败");
            }
        }
Esempio n. 18
0
    public void RefreshList()
    {
        //创建一个BmobQuery查询对象
        BmobQuery query = new BmobQuery();

        query.Limit(10);
        bmobUnity.Find <ContentMode>("Content", query, (resp, exception) =>
        {
            if (exception != null)
            {
                print("查询失败, 失败原因为: " + exception.Message);
                return;
            }
            lists.Clear();
            lists = resp.results;
            artMng.Refresh(lists);
        });
    }
Esempio n. 19
0
        public object GetQuestionStatistic(int unitId)
        {
            var query = new BmobQuery();

            query.Limit(300);
            HttpCookie cookie1  = HttpContext.Current.Request.Cookies["CurrentCourse"];
            String     id       = cookie1["CourseId"];
            int        courseId = int.Parse(id);

            query.WhereEqualTo("courseId", courseId);
            var query1 = new BmobQuery();

            query1.WhereEqualTo("unitId", unitId);
            query = query.And(query1);
            //query.OrderByDescending("rightNum");
            var future = Bmob.FindTaskAsync <Question>("Question", query);

            try
            {
                questionList = future.Result.results;
                foreach (var q in questionList)     //由于BmobModel中有BmobInt类型不能直接显示到页面中,所以需要对字段的类型进行处理,变为相对应的ViewModel格式。
                {
                    Question_View question_view = new Question_View();
                    question_view.id       = q.id.Get();
                    question_view.question = q.question;
                    question_view.totalNum = q.totalNum.Get();
                    question_view.rightNum = q.rightNum.Get();

                    if (question_view.totalNum != 0)
                    {
                        question_view.accuracy = 100 * question_view.rightNum / question_view.totalNum;
                    }
                    qList.Add(question_view);
                }

                questionSortList = qList.OrderByDescending(s => s.accuracy).ToList();

                return(ResultToJson.toJson(questionSortList));
            }
            catch
            {
                return("获取失败");
            }
        }
Esempio n. 20
0
    public void RefreshData(Action <List <EntityData> > callBack)
    {
        BmobQuery query = new BmobQuery();

        query.Limit(10);
        bmobUnity.Find <EntityData>("Content", query, (resp, exception) =>
        {
            if (exception != null)
            {
                print("查询失败, 失败原因为: " + exception.Message);
                return;
            }
            enLists.Clear();
            enLists = resp.results;
            if (callBack != null)
            {
                callBack(enLists);
            }
        });
    }
Esempio n. 21
0
        public IList <E> FindByQuery(BmobQuery query, int limit = 1000)
        {
            IList <E> data = new List <E>();

            try
            {
                query.Limit(limit);
                var result = Bomb().FindTaskAsync <E>(GetTableName(), query);
                data = new List <E>(result.Result.results);
            }
            catch (AggregateException ex)
            {
                ErrorMessage = ex.InnerException.Message;
            }
            catch (Exception ex2)
            {
                ErrorMessage = ex2.Message;
            }
            return(data);
        }
Esempio n. 22
0
        public static async Task <QueryCallbackData <Marks> > queryFuzztMarksAsync(Coordinate coodinate, int limit)
        {
            BmobQuery query = new BmobQuery();

            query.WhereNear("position", new BmobGeoPoint(coodinate.latitude, coodinate.lontitude));
            query.Limit(limit);
            List <Mark> marks = new List <Mark>();

            return(await Bmob.FindTaskAsync <Marks>(Marks.table_name, query));

            /*Debug.LogError(333);
            *  Debug.LogError(data.results.Count);
            *
            *  foreach (var mark in data.results)
            *  {
            *   marks.Add(new Mark { coordinate = new Coordinate(mark.coordinate.Latitude.Get(), mark.coordinate.Longitude.Get()), id = mark.objectId });
            *  }
            *  Debug.LogError(323);
            *  resolve(marks);
            *  Debug.LogError(334);*/
        }
Esempio n. 23
0
        [HttpGet]                       //定义访问方式(Post或Get方法)
        public object Get(int unitId)   //返回数据的函数,如果是Get方法则方法名为Get开头,若是Post则使用Post开头。
        {
            var query = new BmobQuery();

            query.Limit(300);
            query.WhereEqualTo("unitId", unitId);
            var future = Bmob.FindTaskAsync <Knowledge>("Knowledge", query);

            knowledgeList = future.Result.results;
            foreach (var k in knowledgeList)     //由于BmobModel中有BmobInt类型不能直接显示到页面中,所以需要对字段的类型进行处理,变为相对应的ViewModel格式。
            {
                Knowledge_View knowledge_view = new Knowledge_View();
                knowledge_view.id       = k.id.Get();
                knowledge_view.name     = k.name;
                knowledge_view.courseId = k.courseId.Get();
                knowledge_view.unitId   = k.unitId.Get();

                kList.Add(knowledge_view);
            }
            return(ResultToJson.toJson(kList));      //返回数据需要json格式
        }
Esempio n. 24
0
        public void querySubCategory(string category)
        {
            var bmobQuery = new BmobQuery();

            if (!category.Equals(""))
            {
                bmobQuery.WhereEqualTo("mainCategory", category);
            }
            bmobQuery.Limit(10000);
            _bmobWindows.Find <SubCategory>("SubCategory", bmobQuery, (resp, ex) =>
            {
                if (ex != null)
                {
                    Debug.WriteLine("查询出错:" + ex.Message);
                    MessageBox.Show("查询出错:" + ex.Message);
                    return;
                }
                var subCategories = resp.results;
                _view.subCategoryShow(subCategories);
            });
        }
Esempio n. 25
0
        public void QuestionInfo()              //查询全部题目的函数
        {
            HttpCookie cookie1  = HttpContext.Current.Request.Cookies["CurrentCourse"];
            String     id       = cookie1["CourseId"];
            int        courseId = int.Parse(id);
            var        query    = new BmobQuery();

            query.Limit(300);
            query.WhereEqualTo("courseId", courseId);
            query.OrderBy("id");
            var future = Bmob.FindTaskAsync <Question>("Question", query);

            try
            {
                questionList = future.Result.results;
                foreach (var q in questionList)     //由于BmobModel中有BmobInt类型不能直接显示到页面中,所以需要对字段的类型进行处理,变为相对应的ViewModel格式。
                {
                    Question_View question_view = new Question_View();
                    question_view.objectId    = q.objectId;
                    question_view.id          = q.id.Get();
                    question_view.difficulty  = q.difficulty.Get();
                    question_view.totalNum    = q.totalNum.Get();
                    question_view.rightNum    = q.rightNum.Get();
                    question_view.question    = q.question;
                    question_view.a           = q.a;
                    question_view.b           = q.b;
                    question_view.c           = q.c;
                    question_view.d           = q.d;
                    question_view.answer      = q.answer;
                    question_view.analysis    = q.analysis;
                    question_view.courseId    = q.courseId.Get();
                    question_view.unitId      = q.unitId.Get();
                    question_view.knowledgeId = q.knowledgeId;
                    qList.Add(question_view);
                }
            }
            catch { }
            //如果需要对其中一行数据进行处理,可以记录每以条记录的object值,方便对Bmob数据库进行操作。
        }
Esempio n. 26
0
        public void freashData()
        {
            itemsForShangJin.Clear();
            BmobWindowsPhone bmob = JYCaoZuo.getCaoZuo().bmob;


            BmobQuery que = new BmobQuery();

            que.WhereEqualTo("isJinYan", 0);
            que.WhereEqualTo("renWuId", renWuid);
            que.OrderByDescending("createdAt");
            //   que.Skip(3);
            que.Limit(40);
            bmob.Find <RenWuHuiFu>("RenWuHuiFu", que, (respon, exc) => {
                if (exc != null)
                {
                    //    JYCaoZuo.getCaoZuo().showMessagemBox("回复出错");
                    return;
                }
                if (respon.results.Count > 0)
                {
                    this.Dispatcher.BeginInvoke(delegate {
                        foreach (RenWuHuiFu re in respon.results)
                        {
                            HuiFuMode mo = new HuiFuMode();
                            mo.NiCheng   = re.huiFuNiCheng;
                            mo.Content   = re.huiFuContet;
                            mo.UserId    = re.huiFuUserId;
                            itemsForShangJin.Add(mo);
                        }
                    });
                }
                else
                {
                    //无人评论
                }
            });
        }
Esempio n. 27
0
    /// <summary>
    /// Ranks the data.
    /// </summary>
    void RankData()
    {
        //设置获取表的属性
        BmobQuery queryData = new BmobQuery();

        queryData.OrderByDescending("coin");
        queryData.Limit(10);

        //获取对应的表的内容
        Bmob.Find <BmobGameObject>(TABLENAME, queryData,
                                   (response, exception) => {
            if (exception != null)
            {
                print("数据列表获取失败" + exception);

                return;
            }

            print("数据列表获取成功");

            List <BmobGameObject> list = response.results;

            foreach (var data in list)
            {
                print(data);

                //生成数据列表
                GameObject rankDataUI              = Instantiate(rankDataPrefab);
                rankDataUI.transform.parent        = rankDataParent;
                rankDataUI.transform.localRotation = rankDataPrefab.transform.localRotation;
                rankDataUI.transform.localScale    = Vector3.one;
                rankDataUI.GetComponent <RankDataAttr>().userNmaeText.text = data.userName;
                rankDataUI.GetComponent <RankDataAttr>().coinText.text     = data.coin.ToString();
            }
        }
                                   );
    }
Esempio n. 28
0
    //---------------------------------------------------------

    /// <summary>
    /// 查询排名数据
    /// </summary>
    public static void DownloadRankList()
    {
        //bmobQuery用于查询相关
        BmobQuery bmobQuery = new BmobQuery();

        //以分数来从高到低排序
        bmobQuery.OrderByDescending("score");
        //只查询前七名
        bmobQuery.Limit(7);

        bmobUnity.Find <Rank>("RankTable", bmobQuery, (resp, exception) =>
        {
            if (exception != null)
            {
                print("查询失败,失败原因为:" + exception.Message);
                return;
            }
            GameData.rankList = resp.results;

            LoadingNetwork.isDoneLoading = true;

            Debug.Log("查询完毕");
        });
    }
Esempio n. 29
0
        [HttpGet]                       //定义访问方式(Post或Get方法)
        public object Get()             //返回数据的函数,如果是Get方法则方法名为Get开头,若是Post则使用Post开头。
        {
            HttpCookie cookie1  = HttpContext.Current.Request.Cookies["CurrentCourse"];
            String     id       = cookie1["CourseId"];
            int        courseId = int.Parse(id);
            var        query    = new BmobQuery();

            query.Limit(300);
            query.WhereEqualTo("courseId", courseId);
            query.OrderBy("id");
            var future = Bmob.FindTaskAsync <Unit>("Unit", query);

            unitList = future.Result.results;
            foreach (var u in unitList)     //由于BmobModel中有BmobInt类型不能直接显示到页面中,所以需要对字段的类型进行处理,变为相对应的ViewModel格式。
            {
                Unit_View unit_view = new Unit_View();
                unit_view.id       = u.id.Get();
                unit_view.name     = u.name;
                unit_view.courseId = u.courseId.Get();

                uList.Add(unit_view);
            }
            return(ResultToJson.toJson(uList));      //返回数据需要json格式
        }
Esempio n. 30
0
        public void querySubCategoryNative(int skip)
        {
            var bmobQuery = new BmobQuery();

            bmobQuery.Skip(skip);
            bmobQuery.Limit(100);
            _bmobWindows.Find <SubCategory>("SubCategory", bmobQuery, (resp, ex) =>
            {
                if (ex != null)
                {
                    Debug.WriteLine("查询出错:" + ex.Message);
                    return;
                }
                var commodities = resp.results;
                Debug.WriteLine("数量:" + commodities.Count);

                commodities.ForEach(subCategory =>
                {
                    subCategory.photoUrl = PresetInfo.UrlBase + subCategory.photoName;
                    batchDownloadPhoto(subCategory.photoUrl, subCategory.photoName);
                    //                    _bmobWindows.Update(subCategory, (responseInfo, exception) =>
                    //                    {
                    //                        if (exception != null)
                    //                        {
                    //                            Debug.WriteLine("修改失败: " + exception.Message);
                    //                            return;
                    //                        }
                    //                        Debug.WriteLine("修改成功: " + subCategory.photoUrl);
                    //                    });
                });
                if (commodities.Count > 0)
                {
                    querySubCategoryNative(skip + 100);
                }
            });
        }
Esempio n. 31
0
 public void FindTest()
 {
     var query = new BmobQuery();
     query.Limit(1);
     var future = Bmob.FindTaskAsync<GameObject>(TABLENAME, query);
     FinishedCallback(future.Result, null);
 }