示例#1
0
        public HttpResponseMessage Addclickrate([FromBody] U_Url_ClickRate rate)
        {
            int res = 0;

            if (!string.IsNullOrEmpty(rate.UserAgents) && !string.IsNullOrEmpty(rate.UrlId))
            {
                res = new U_Url_ClickRateBLL().Add(rate);
            }
            return(JsonConvert.SerializeObject(res).ToHttpResponseMessage());
        }
        public void Addclickrate(string UserAgents, string UrlId, string Ip, string Msg)
        {
            U_Url_ClickRate rate = new U_Url_ClickRate();

            rate.Id         = GetStr.GetGuid;
            rate.UserAgents = UserAgents;
            rate.UrlId      = UrlId;
            rate.Ip         = Ip;
            rate.Msg        = Msg;
            rate.ClickDate  = GetStr.GetCurrentDate;
            if (!string.IsNullOrEmpty(rate.UserAgents) && !string.IsNullOrEmpty(rate.UrlId))
            {
                clickRateBll.Add(rate);
            }
        }
示例#3
0
        public void Addclickrate(string UserAgents, string UrlId, string Ip, string Msg)
        {
            U_Url_ClickRate rate = new U_Url_ClickRate();

            rate.Id         = GetStr.GetGuid;
            rate.UserAgents = UserAgents;
            rate.UrlId      = UrlId;
            rate.Ip         = Ip;
            rate.Msg        = Msg;
            rate.ClickDate  = GetStr.GetCurrentDate;
            if (!string.IsNullOrEmpty(rate.UserAgents) && !string.IsNullOrEmpty(rate.UrlId))
            {
                var r = HttpHelp.Post <string, U_Url_ClickRate>(ActionEnum.Addclickrate, rate);
            }
        }
示例#4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType     = "application/json";
            context.Response.Charset         = "utf-8";
            context.Response.Buffer          = true;
            context.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
            context.Response.AddHeader("pragma", "no-cache");
            context.Response.AddHeader("cache-control", "");
            context.Response.CacheControl = "no-cache";
            string returnInfo = string.Empty;
            string method     = context.Request.QueryString["method"].ToLower();
            string parameter  = context.Request.QueryString["key"];
            string parameter2 = context.Request.QueryString["key2"];

            switch (method)
            {
            case "geturlalldata":
                if (parameter == "undefined")
                {
                    parameter = "1";
                }
                if (!string.IsNullOrEmpty(parameter) && !string.IsNullOrEmpty(parameter2) && parameter != "undefined")
                {
                    returnInfo = JsonConvert.SerializeObject(GetMenuList(Convert.ToInt16(parameter), parameter2));
                }
                else if (!string.IsNullOrEmpty(parameter))
                {
                    returnInfo = JsonConvert.SerializeObject(GetMenuList(Convert.ToInt16(parameter), null));
                }
                break;

            case "getcurrentobj":
                if (!string.IsNullOrEmpty(parameter))
                {
                    returnInfo = JsonConvert.SerializeObject(GetMeu(parameter));
                }
                break;

            case "gettypedata":
                returnInfo = JsonConvert.SerializeObject(UrlTypeBLL.UrlTypeListManager.OrderByDescending(n => n.SortDesc));
                break;

            case "geturlentity":
                if (!string.IsNullOrEmpty(parameter))
                {
                    returnInfo = JsonConvert.SerializeObject(bll.FindPrimaryId(string.Format("AND Types='{0}'", parameter)).OrderBy(n => n.SortDesc));
                }
                break;

            case "addclickrate":
                U_Url_ClickRate rate = new U_Url_ClickRate();
                rate.Id         = GetStr.GetGuid;
                rate.UserAgents = context.Request.QueryString["b"];
                rate.UrlId      = context.Request.QueryString["a"];
                rate.Ip         = context.Request.QueryString["c"];
                rate.Msg        = context.Request.QueryString["d"];
                rate.ClickDate  = GetStr.GetCurrentDate;
                if (!string.IsNullOrEmpty(rate.UserAgents) && !string.IsNullOrEmpty(rate.UrlId))
                {
                    clickRateBll.Add(rate);
                }
                break;

            case "geturlmodify":
                returnInfo = GeturlModify(parameter);
                break;

            case "getclickrateday":
                returnInfo = GetClickRateDay(parameter, parameter2);
                break;

            case "getclickratemonth":
                returnInfo = GetClickRateMonth(parameter, parameter2);
                break;

            case "getcheckresult":
                returnInfo = GetCheckResult(parameter, parameter2);
                break;

            case "leaveamessage":
                returnInfo = LeaveAMessage(parameter, parameter2);
                break;

            case "log":
                returnInfo = Log(parameter, parameter2);
                break;
            }
            context.Response.Write(returnInfo);
        }
        private HttpResponseMessage _processrequest(string method, string parameter, string parameter2)
        {
            string returnInfo = string.Empty;

            if (method.IsNotNull())
            {
                U_Url_ClickRateBLL clickRateBll = new U_Url_ClickRateBLL();
                U_Url_TypeBLL      bllType      = new U_Url_TypeBLL();
                U_Url_ListBLL      bllMenuList  = new U_Url_ListBLL();
                U_Url_ListBLL      bll          = new U_Url_ListBLL();
                switch (method)
                {
                case "geturlalldata":
                    returnInfo = JsonConvert.SerializeObject(_geturlalldata(parameter, parameter2));
                    break;

                case "getcurrentobj":
                    if (!string.IsNullOrEmpty(parameter))
                    {
                        returnInfo = JsonConvert.SerializeObject(bll.Find(string.Format("AND ID='{0}'", parameter)));
                    }
                    break;

                case "gettypedata":
                    returnInfo = JsonConvert.SerializeObject(UrlTypeBLL.UrlTypeListManager.OrderByDescending(n => n.SortDesc));
                    break;

                case "geturlentity":
                    if (!string.IsNullOrEmpty(parameter))
                    {
                        returnInfo = JsonConvert.SerializeObject(bll.FindList(string.Format("AND Types='{0}'", parameter)).OrderBy(n => n.SortDesc));
                    }
                    break;

                case "addclickrate":
                    U_Url_ClickRate rate = new U_Url_ClickRate();
                    //rate.Id = GetStr.GetGuid;
                    //rate.UserAgents = context.Request.QueryString["b"];
                    //rate.UrlId = context.Request.QueryString["a"];
                    //rate.Ip = context.Request.QueryString["c"];
                    //rate.Msg = context.Request.QueryString["d"];
                    //rate.ClickDate = GetStr.GetCurrentDate;
                    //if (!string.IsNullOrEmpty(rate.UserAgents) && !string.IsNullOrEmpty(rate.UrlId))
                    //{
                    //    clickRateBll.Add(rate);
                    //}
                    break;

                case "geturlmodify":
                    returnInfo = JsonConvert.SerializeObject(new U_Url_ListBLL().QuerySql(string.Format(SqlStr.GetmyModalModify, parameter)).FirstOrDefault());
                    break;

                case "getclickrateday":
                    if (string.IsNullOrEmpty(parameter))
                    {
                        DateTime now = DateTime.Now;
                        parameter = new DateTime(now.Year, now.Month, 1).ToString(GetStr.yyyyMMddmmHHss);
                    }
                    if (string.IsNullOrEmpty(parameter2))
                    {
                        parameter2 = GetStr.GetCurrentDate;
                    }
                    returnInfo = JsonConvert.SerializeObject(clickRateBll.FinList <_ClickRate>(string.Format(SqlStr.GetClickRateDay, parameter, parameter2)));
                    break;

                case "getclickratemonth":
                    if (string.IsNullOrEmpty(parameter))
                    {
                        parameter = DateTime.Now.AddYears(-1).ToString(GetStr.yyyyMMddmmHHss);
                    }
                    if (string.IsNullOrEmpty(parameter2))
                    {
                        parameter2 = GetStr.GetCurrentDate;
                    }
                    returnInfo = JsonConvert.SerializeObject(clickRateBll.FinList <_ClickRate>(string.Format(SqlStr.GetClickRateMonth, parameter, parameter2)));
                    break;

                case "getcheckresult":
                    if (string.IsNullOrEmpty(parameter))
                    {
                        DateTime now = DateTime.Now;
                        parameter = new DateTime(now.Year, now.Month, 1).ToString(GetStr.yyyyMMddmmHHss);
                    }
                    if (string.IsNullOrEmpty(parameter2))
                    {
                        parameter2 = GetStr.GetCurrentDate;
                    }
                    returnInfo = JsonConvert.SerializeObject(clickRateBll.FinList <U_Url_Check>(string.Format(SqlStr.GetCheckResult, parameter, parameter2)));
                    break;

                case "leaveamessage":
                    if (string.IsNullOrEmpty(parameter))
                    {
                        DateTime now = DateTime.Now;
                        parameter = new DateTime(now.Year, now.Month, 1).ToString(GetStr.yyyyMMddmmHHss);
                    }
                    if (string.IsNullOrEmpty(parameter2))
                    {
                        parameter2 = GetStr.GetCurrentDate;
                    }
                    returnInfo = JsonConvert.SerializeObject(clickRateBll.FinList <LeaveAMessage>(string.Format(SqlStr.LeaveAMessage, parameter, parameter2)));
                    break;

                case "log":
                    if (string.IsNullOrEmpty(parameter))
                    {
                        DateTime now = DateTime.Now;
                        parameter = new DateTime(now.Year, now.Month, 1).ToString(GetStr.yyyyMMddmmHHss);
                    }
                    if (string.IsNullOrEmpty(parameter2))
                    {
                        parameter2 = GetStr.GetCurrentDate;
                    }
                    returnInfo = JsonConvert.SerializeObject(clickRateBll.FinList <S_Log>(string.Format(SqlStr.LogSql, parameter, parameter2)));
                    break;
                }
            }
            return(JsonConvert.SerializeObject(returnInfo).ToHttpResponseMessage());
        }