Ejemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(JMP.MDL.jmp_operatingsystem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into jmp_operatingsystem(");
            strSql.Append("o_system,o_app_id,o_count,o_time");
            strSql.Append(") values (");
            strSql.Append("@o_system,@o_app_id,@o_count,@o_time");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@o_system", SqlDbType.NVarChar, -1),
                new SqlParameter("@o_app_id", SqlDbType.Int,       4),
                new SqlParameter("@o_count",  SqlDbType.Int,       4),
                new SqlParameter("@o_time",   SqlDbType.DateTime)
            };

            parameters[0].Value = model.o_system;
            parameters[1].Value = model.o_app_id;
            parameters[2].Value = model.o_count;
            parameters[3].Value = model.o_time;

            object obj = DbHelperSQLTotal.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public JMP.MDL.jmp_operatingsystem GetModel(int o_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select o_id, o_system, o_app_id, o_count, o_time  ");
            strSql.Append("  from jmp_operatingsystem ");
            strSql.Append(" where o_id=@o_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@o_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = o_id;


            JMP.MDL.jmp_operatingsystem model = new JMP.MDL.jmp_operatingsystem();
            DataSet ds = DbHelperSQLTotal.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["o_id"].ToString() != "")
                {
                    model.o_id = int.Parse(ds.Tables[0].Rows[0]["o_id"].ToString());
                }
                model.o_system = ds.Tables[0].Rows[0]["o_system"].ToString();
                if (ds.Tables[0].Rows[0]["o_app_id"].ToString() != "")
                {
                    model.o_app_id = int.Parse(ds.Tables[0].Rows[0]["o_app_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["o_count"].ToString() != "")
                {
                    model.o_count = int.Parse(ds.Tables[0].Rows[0]["o_count"].ToString());
                }
                if (ds.Tables[0].Rows[0]["o_time"].ToString() != "")
                {
                    model.o_time = DateTime.Parse(ds.Tables[0].Rows[0]["o_time"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(JMP.MDL.jmp_operatingsystem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update jmp_operatingsystem set ");

            strSql.Append(" o_system = @o_system , ");
            strSql.Append(" o_app_id = @o_app_id , ");
            strSql.Append(" o_count = @o_count , ");
            strSql.Append(" o_time = @o_time  ");
            strSql.Append(" where o_id=@o_id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@o_id",     SqlDbType.Int,       4),
                new SqlParameter("@o_system", SqlDbType.NVarChar, -1),
                new SqlParameter("@o_app_id", SqlDbType.Int,       4),
                new SqlParameter("@o_count",  SqlDbType.Int,       4),
                new SqlParameter("@o_time",   SqlDbType.DateTime)
            };

            parameters[0].Value = model.o_id;
            parameters[1].Value = model.o_system;
            parameters[2].Value = model.o_app_id;
            parameters[3].Value = model.o_count;
            parameters[4].Value = model.o_time;
            int rows = DbHelperSQLTotal.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        public string TerminalCount(string type)
        {
            string stime = string.IsNullOrEmpty(Request["stime"]) ? DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") : Request["stime"]; //开始时间
            string etime = string.IsNullOrEmpty(Request["etime"]) ? DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") : Request["etime"]; //结束时间
            string htmls = "{\"chart\": {\"caption\": \"\",\"subCaption\": \"\",\"numberSuffix\": \"%\",\"paletteColors\": \"#0075c2\",\"bgColor\": \"FFFFFF\",\"showBorder\": \"0\",\"showCanvasBorder\": \"0\",\"usePlotGradientColor\": \"0\",\"plotBorderAlpha\": \"10\",\"placeValuesInside\": \"1\",\"valueFontColor\": \"#ffffff\",\"showAxisLines\": \"1\",\"axisLineAlpha\": \"25\",\"divLineAlpha\": \"10\",\"alignCaptionWithCanvas\": \"0\",\"showAlternateVGridColor\": \"0\",\"captionFontSize\": \"14\",\"subcaptionFontSize\": \"14\",\"subcaptionFontBold\": \"0\",\"toolTipColor\": \"#ffffff\",\"toolTipBorderThickness\": \"0\",\"toolTipBgColor\": \"#000000\",\"toolTipBgAlpha\": \"80\",\"toolTipBorderRadius\": \"2\",\"toolTipPadding\": \"5\" }";

            htmls += ",\"data\": [";
            string datastr = "";
            int    searchType = 2; string searchname = UserInfo.UserNo;
            string a_name = string.IsNullOrEmpty(Request["a_name"]) ? "" : Request["a_name"];

            if (!string.IsNullOrEmpty(a_name) && a_name != "所有应用")
            {
                searchType = 1;
                searchname = a_name;
            }
            switch (type)
            {
            case "statistics":
                #region 手机品牌
                JMP.BLL.jmp_statistics        jmp_statisticsbll = new JMP.BLL.jmp_statistics();
                List <JMP.MDL.jmp_statistics> jmp_statisticslist = jmp_statisticsbll.GetListTjCount(stime, etime, searchType, searchname);
                JMP.MDL.jmp_statistics        statimodel = jmp_statisticsbll.modelCoutn(stime, etime);
                int sjpp = 1; decimal ppbl = 0;
                if (statimodel != null)
                {
                    sjpp = statimodel.s_count;
                }
                if (jmp_statisticslist.Count > 0)
                {
                    foreach (var item in jmp_statisticslist)
                    {
                        if (sjpp == 1)
                        {
                            ppbl = 0;
                        }
                        else
                        {
                            ppbl = (decimal.Parse(item.s_count.ToString()) / decimal.Parse(sjpp.ToString())) * 100;
                        }
                        datastr += "{\"label\": \"" + item.s_brand + "\", \"value\": \"" + String.Format("{0:N2}", ppbl) + "\"},";
                    }
                }
                else
                {
                    return("0");
                }
                #endregion
                break;

            case "modelnumber":
                #region 型号
                JMP.BLL.jmp_modelnumber        modelnumberbll = new JMP.BLL.jmp_modelnumber();
                List <JMP.MDL.jmp_modelnumber> modelnumberlist = modelnumberbll.GetListTjCount(stime, etime, searchType, searchname);
                JMP.MDL.jmp_modelnumber        xhmodel = modelnumberbll.modelTjCount(stime, etime);
                int xxcount = 1; decimal xxbl = 0;
                if (xhmodel != null)
                {
                    xxcount = xhmodel.m_count;
                }
                if (modelnumberlist.Count > 0)
                {
                    foreach (var mo in modelnumberlist)
                    {
                        if (xxcount == 1)
                        {
                            xxbl = 0;
                        }
                        else
                        {
                            xxbl = (decimal.Parse(mo.m_count.ToString()) / decimal.Parse(xxcount.ToString())) * 100;
                        }
                        datastr += "{\"label\": \"" + mo.m_sdkver + "\", \"value\": \"" + String.Format("{0:N2}", xxbl) + "\"},";
                    }
                }
                else
                {
                    return("0");
                }
                #endregion
                break;

            case "operatingsystem":
                #region 操作系统
                JMP.BLL.jmp_operatingsystem        operatingsystembll = new JMP.BLL.jmp_operatingsystem();
                List <JMP.MDL.jmp_operatingsystem> operatingsystemlist = operatingsystembll.GetListTjCount(stime, etime, searchType, searchname);
                JMP.MDL.jmp_operatingsystem        opmdel = operatingsystembll.ModelTjCount(stime, etime);
                int opcount = 1; decimal xtbl = 0;
                if (opmdel != null)
                {
                    opcount = opmdel.o_count;
                }
                if (operatingsystemlist.Count > 0)
                {
                    foreach (var op in operatingsystemlist)
                    {
                        if (opcount == 1)
                        {
                            xtbl = 0;
                        }
                        else
                        {
                            xtbl = (decimal.Parse(op.o_count.ToString()) / decimal.Parse(opcount.ToString())) * 100;
                        }
                        datastr += "{\"label\": \"" + op.o_system + "\", \"value\": \"" + String.Format("{0:N2}", xtbl) + "\"},";
                    }
                }
                else
                {
                    return("0");
                }
                #endregion
                break;

            case "resolution":
                #region 分辨率
                JMP.BLL.jmp_resolution        oresolutionbll = new JMP.BLL.jmp_resolution();
                List <JMP.MDL.jmp_resolution> resolutionlist = oresolutionbll.GetListTjCount(stime, etime, searchType, searchname);
                JMP.MDL.jmp_resolution        remodel = oresolutionbll.modelTjCount(stime, etime);
                int recount = 1; decimal fblbl = 0;
                if (remodel != null)
                {
                    recount = remodel.r_count;
                }
                if (resolutionlist.Count > 0)
                {
                    foreach (var re in resolutionlist)
                    {
                        if (recount == 1)
                        {
                            fblbl = 0;
                        }
                        else
                        {
                            fblbl = (decimal.Parse(re.r_count.ToString()) / decimal.Parse(recount.ToString())) * 100;
                        }
                        datastr += "{\"label\": \"" + re.r_screen + "\", \"value\": \"" + String.Format("{0:N2}", fblbl) + "\"},";
                    }
                }
                else
                {
                    return("0");
                }
                #endregion
                break;

            case "network":
                #region 网络
                JMP.BLL.jmp_network        networkbll = new JMP.BLL.jmp_network();
                List <JMP.MDL.jmp_network> networklist = networkbll.GetListTjCount(stime, etime, searchType, searchname);
                JMP.MDL.jmp_network        nemodel = networkbll.modelTjCount(stime, etime);
                int necoutn = 1; decimal wlbl = 0;
                if (nemodel != null)
                {
                    necoutn = nemodel.n_count;
                }
                if (networklist.Count > 0)
                {
                    foreach (var ne in networklist)
                    {
                        if (necoutn == 1)
                        {
                            wlbl = 0;
                        }
                        else
                        {
                            wlbl = (decimal.Parse(ne.n_count.ToString()) / decimal.Parse(necoutn.ToString())) * 100;
                        }
                        datastr += "{\"label\": \"" + ne.n_network + "\", \"value\": \"" + String.Format("{0:N2}", wlbl) + "\"},";
                    }
                }
                else
                {
                    return("0");
                }
                #endregion
                break;

            case "operator":
                #region 运营商
                JMP.BLL.jmp_operator        operatorbll = new JMP.BLL.jmp_operator();
                List <JMP.MDL.jmp_operator> operatorlist = operatorbll.GetListTjCount(stime, etime, searchType, searchname);
                JMP.MDL.jmp_operator        opmodel = operatorbll.modelTjCount(stime, etime);
                int opmocount = 1; decimal yys = 0;
                if (opmodel != null)
                {
                    opmocount = opmodel.o_count;
                }
                if (operatorlist.Count > 0)
                {
                    foreach (var ope in operatorlist)
                    {
                        if (opmocount == 1)
                        {
                            yys = 0;
                        }
                        else
                        {
                            yys = (decimal.Parse(ope.o_count.ToString()) / decimal.Parse(opmocount.ToString())) * 100;
                        }
                        datastr += "{\"label\": \"" + ope.o_nettype + "\", \"value\": \"" + String.Format("{0:N2}", yys) + "\"},";
                    }
                }
                else
                {
                    return("0");
                }
                #endregion
                break;

            case "province":
                #region 省份
                JMP.BLL.jmp_province        prbll = new JMP.BLL.jmp_province();
                List <JMP.MDL.jmp_province> prlist = prbll.GetListTjCount(stime, etime, searchType, searchname);
                JMP.MDL.jmp_province        prmode = prbll.modelTjCount(stime, etime);
                int prcount = 1; decimal prs = 0;

                if (prmode != null)
                {
                    prcount = prmode.p_count;
                }
                if (prlist.Count > 0)
                {
                    foreach (var ope in prlist)
                    {
                        if (prcount == 1)
                        {
                            prs = 0;
                        }
                        else
                        {
                            prs = (decimal.Parse(ope.p_count.ToString()) / decimal.Parse(prcount.ToString())) * 100;
                        }
                        datastr += "{\"label\": \"" + ope.p_province + "\", \"value\": \"" + String.Format("{0:N2}", prs) + "\"},";
                    }
                }
                else
                {
                    return("0");
                }
                #endregion
                break;
            }
            if (datastr.Length > 0)
            {
                datastr = datastr.Remove(datastr.Length - 1);//去掉最后一个“,”号
            }
            htmls += datastr;
            htmls += "]}";
            return(htmls);
        }