일반 데이터 형식 프론트 데스크톱 디스플레이

2973 단어
unction GetStat() {
            $.post("/Admin/Cooperator/GetCoopStat", { cooperate: $("#cooperator").val() }, function (data) {
                StatData = eval("(" + data + ")");
                strContent = "";
                if (StatData == "") {
                    $(".page_text").remove();
                } else {
                    for (var x in StatData) {
                        if (!isNaN(x)) {
                            $(".page_text").remove();
                            var strStat = $("<div class='page_text'></div>");
                            strStat.append(" : <font>{0}</font>, <font>{1}</font><br />".format(StatData[x].MSLCount, StatData[x].SLCount));
                            strStat.append(" : <font>{0}</font>, <font>{1}</font>".format(StatData[x].MSUCount, StatData[x].SUCount));
                            $(".fenye_con").before(strStat);
                        }
                    }
                }
            });
        }
// 
        public ActionResult GetCoopStat(string cooperate)
        {
            ContentResult vResult = new ContentResult();
            List<t_s_co_store_list_statistics> lst = cb.GetCoopStat(cooperate);
            var lst2 = lst.Select(l =>
                new CoopStat
                {
                    MSTCount = l.mainstore_total_count,
                    MSLCount = l.mainstore_linked_count,
                    MSUCount = l.mainstore_unlinked_count,
                    STCount = l.store_total_count,
                    SLCount = l.store_linked_count,
                    SUCount = l.store_unlinked_count
                }).ToList();
            vResult.Content = lst2.ToJson();
            return vResult;
        }

        public class CoopStat
        {
            public int? MSTCount { get; set; } // 
            public int? MSLCount { get; set; }// 
            public int? MSUCount { get; set; }// 
            public int? STCount { get; set; }// 
            public int? SLCount { get; set; }// 
            public int? SUCount { get; set; }// 
        }
        public List<t_s_co_store_list_statistics> GetCoopStat(string cooperate)
        {
            return vContext.t_s_co_store_list_statistics.Where(m => m.cooperate_code == cooperate).ToList();
        }
        /// <summary> 
        ///   
        /// </summary> 
        /// <param name="obj"> </param> 
        /// <returns>json </returns> 
        public static string ToJson(this object obj)
        {
            JavaScriptSerializer serialize = new JavaScriptSerializer();
            return serialize.Serialize(obj);
        }

좋은 웹페이지 즐겨찾기