コード例 #1
0
        /// <summary>
        /// 获取最新资讯
        /// </summary>
        /// <returns></returns>
        public AdertiseResponse GetAdertiseInfo()
        {
            AdertiseResponse advertiseResponse = new AdertiseResponse();
            string           strRequest        = new JavaScriptSerializer().Serialize(new { CXLX = AdvertiseCxlx.All.GetHashCode().ToString() });
            bool             result            = false;
            string           errorMsg          = string.Empty;
            var response = WSInterface.GetResponse(strRequest, InterfaceType.AdvertiseQuery, ref result, out errorMsg);

            if (result)
            {
                advertiseResponse = JsonConvert.DeserializeObject <AdertiseResponse>(response);
            }

            return(advertiseResponse);
        }
コード例 #2
0
        /// <summary>
        /// 获取广告信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GetAdertiseHandler(object sender, EventArgs e)
        {
            try
            {
                AdertiseResponse advertiseResponse = mainWindowService.GetAdertiseInfo();

                var NewestInfoList = advertiseResponse.ZXZXS;
                var ggInfoList     = advertiseResponse.GGZS;
                GgInfo = ggInfoList;

                if (ggInfoList != null && ggInfoList.Any())
                {
                    ggInfoList.ForEach((o) =>
                    {
                        o.GG_TITLE = CommonHelper.CutStringByte(o.GG_TITLE, 50);
                        DateTime dt;
                        var b = DateTime.TryParse(o.GG_TIME, out dt);
                        if (b)
                        {
                            o.GG_TIME = dt.ToString("yyyy-MM-dd");
                        }
                    });

                    GgInfoList1 = ggInfoList.Take(3).ToList();

                    GgInfoList2 = ggInfoList.Skip(3).Take(3).ToList();
                }

                if (NewestInfoList != null && NewestInfoList.Any())
                {
                    NewestInfoList.ForEach((o) =>
                    {
                        o.ZXMC = CommonHelper.CutStringByte(o.ZXMC, 50);
                    });

                    NewestInfoList1 = NewestInfoList.Take(3).ToList();

                    NewestInfoList2 = NewestInfoList.Skip(3).Take(3).ToList();
                }
            }
            catch (Exception ex)
            {
                Logging.Log4NetHelper.Error(typeof(MainWindow), Message.GetAdertiesError + ex.Message + System.Environment.NewLine + ex.StackTrace);
            }
        }