コード例 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(JMP.MDL.jmp_province model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into jmp_province(");
            strSql.Append("p_province,p_appid,p_count,p_time");
            strSql.Append(") values (");
            strSql.Append("@p_province,@p_appid,@p_count,@p_time");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@p_province", SqlDbType.NVarChar, 50),
                new SqlParameter("@p_appid",    SqlDbType.Int,       4),
                new SqlParameter("@p_count",    SqlDbType.Int,       4),
                new SqlParameter("@p_time",     SqlDbType.DateTime)
            };

            parameters[0].Value = model.p_province;
            parameters[1].Value = model.p_appid;
            parameters[2].Value = model.p_count;
            parameters[3].Value = model.p_time;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #2
0
ファイル: jmp_province.cs プロジェクト: sunman001/dxpay
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <JMP.MDL.jmp_province> DataTableToList(DataTable dt)
        {
            List <JMP.MDL.jmp_province> modelList = new List <JMP.MDL.jmp_province>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                JMP.MDL.jmp_province model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new JMP.MDL.jmp_province();
                    if (dt.Rows[n]["p_id"].ToString() != "")
                    {
                        model.p_id = int.Parse(dt.Rows[n]["p_id"].ToString());
                    }
                    model.p_province = dt.Rows[n]["p_province"].ToString();
                    if (dt.Rows[n]["p_appid"].ToString() != "")
                    {
                        model.p_appid = int.Parse(dt.Rows[n]["p_appid"].ToString());
                    }
                    if (dt.Rows[n]["p_count"].ToString() != "")
                    {
                        model.p_count = int.Parse(dt.Rows[n]["p_count"].ToString());
                    }
                    if (dt.Rows[n]["p_time"].ToString() != "")
                    {
                        model.p_time = DateTime.Parse(dt.Rows[n]["p_time"].ToString());
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public JMP.MDL.jmp_province GetModel(int p_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select p_id, p_province, p_appid, p_count, p_time  ");
            strSql.Append("  from jmp_province ");
            strSql.Append(" where p_id=@p_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@p_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = p_id;


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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["p_id"].ToString() != "")
                {
                    model.p_id = int.Parse(ds.Tables[0].Rows[0]["p_id"].ToString());
                }
                model.p_province = ds.Tables[0].Rows[0]["p_province"].ToString();
                if (ds.Tables[0].Rows[0]["p_appid"].ToString() != "")
                {
                    model.p_appid = int.Parse(ds.Tables[0].Rows[0]["p_appid"].ToString());
                }
                if (ds.Tables[0].Rows[0]["p_count"].ToString() != "")
                {
                    model.p_count = int.Parse(ds.Tables[0].Rows[0]["p_count"].ToString());
                }
                if (ds.Tables[0].Rows[0]["p_time"].ToString() != "")
                {
                    model.p_time = DateTime.Parse(ds.Tables[0].Rows[0]["p_time"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(JMP.MDL.jmp_province model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update jmp_province set ");

            strSql.Append(" p_province = @p_province , ");
            strSql.Append(" p_appid = @p_appid , ");
            strSql.Append(" p_count = @p_count , ");
            strSql.Append(" p_time = @p_time  ");
            strSql.Append(" where p_id=@p_id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@p_id",       SqlDbType.Int,       4),
                new SqlParameter("@p_province", SqlDbType.NVarChar, 50),
                new SqlParameter("@p_appid",    SqlDbType.Int,       4),
                new SqlParameter("@p_count",    SqlDbType.Int,       4),
                new SqlParameter("@p_time",     SqlDbType.DateTime)
            };

            parameters[0].Value = model.p_id;
            parameters[1].Value = model.p_province;
            parameters[2].Value = model.p_appid;
            parameters[3].Value = model.p_count;
            parameters[4].Value = model.p_time;
            int rows = DbHelperSQLTotal.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
ファイル: jmp_province.cs プロジェクト: sunman001/dxpay
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(JMP.MDL.jmp_province model)
 {
     return(dal.Update(model));
 }
コード例 #6
0
ファイル: jmp_province.cs プロジェクト: sunman001/dxpay
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(JMP.MDL.jmp_province model)
 {
     return(dal.Add(model));
 }
コード例 #7
0
ファイル: specialController.cs プロジェクト: dmhai/dxpay
        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);
        }