Ejemplo n.º 1
0
        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="context"></param>
        private void GetDowDetail(HttpContext context)
        {
            GetUserNameHandler   common    = new GetUserNameHandler();
            ClickDetailService   Clickbll  = new ClickDetailService();
            string               result    = "";
            JsonModel            jsonModel = null;
            JavaScriptSerializer jss       = new System.Web.Script.Serialization.JavaScriptSerializer();

            try
            {
                ResourcesInfo resource = new ResourcesInfo();
                Hashtable     ht       = new Hashtable();
                ht.Add("PageIndex", context.Request["PageIndex"].SafeToString());
                ht.Add("PageSize", context.Request["PageSize"].SafeToString());

                jsonModel = common.AddCreateNameForData(Clickbll.GetPage(ht, true), 1, true);

                //result = "{\"result\":" + jss.Serialize(jsonModel) + "}";
            }
            catch (Exception ex)
            {
                jsonModel = new JsonModel()
                {
                    errNum  = 400,
                    errMsg  = ex.Message,
                    retData = ""
                };
                LogService.WriteErrorLog(ex.Message);
            }
            result = "{\"result\":" + jss.Serialize(jsonModel) + "}";
            context.Response.Write(result);
            context.Response.End();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 点击下载评价
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="ClickType"></param>
        /// <param name="IDCard"></param>
        private void UpdateClick(string ID, string ClickType, string IDCard, string Evalue)
        {
            ClickDetailService clickBll = new ClickDetailService();
            Hashtable          ht       = new Hashtable();

            ht.Add("TableName", "ClickDetail");
            ClickDetail clickModeol = new ClickDetail();

            JsonModel jsonmodel = clickBll.GetPage(ht, false, " and ResourcesID=" + ID + " and CreateUID='" + IDCard + "' and ClickType=" + ClickType);

            if (jsonmodel.errNum == 0)
            {
                List <Dictionary <string, object> > list = (List <Dictionary <string, object> >)jsonmodel.retData;
                int ClickNum = 0;
                int ClickID  = 0;
                foreach (Dictionary <string, object> result in list)
                {
                    ClickNum = Convert.ToInt32(result["ClickNum"]);
                    ClickID  = Convert.ToInt32(result["ID"]);
                }
                if (int.Parse(Evalue) > 0)
                {
                    clickModeol.ClickNum = int.Parse(Evalue);
                }
                else
                {
                    clickModeol.ClickNum = ClickNum + 1;
                }
                clickModeol.EditTime  = DateTime.Now;
                clickModeol.LastTime  = DateTime.Now;
                clickModeol.ClickType = byte.Parse(ClickType);
                clickModeol.EditUID   = IDCard;
                clickModeol.ID        = ClickID;
                clickBll.Update(clickModeol);
            }
            else
            {
                if (Evalue.Length > 0)
                {
                    clickModeol.ClickNum = int.Parse(Evalue);
                }
                else
                {
                    clickModeol.ClickNum = 1;
                }
                clickModeol.ClickTime   = DateTime.Now;
                clickModeol.CreateTime  = DateTime.Now;
                clickModeol.EditTime    = DateTime.Now;
                clickModeol.LastTime    = DateTime.Now;
                clickModeol.ClickType   = byte.Parse(ClickType);
                clickModeol.CreateUID   = IDCard;
                clickModeol.EditUID     = IDCard;
                clickModeol.ResourcesID = int.Parse(ID);
                clickModeol.IsDelete    = 0;
                jsonmodel = clickBll.Add(clickModeol);
            }
        }