/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.jmp_statistics model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into jmp_statistics("); strSql.Append("s_brand,s_app_id,s_count,s_time"); strSql.Append(") values ("); strSql.Append("@s_brand,@s_app_id,@s_count,@s_time"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@s_brand", SqlDbType.NVarChar, -1), new SqlParameter("@s_app_id", SqlDbType.Int, 4), new SqlParameter("@s_count", SqlDbType.Int, 4), new SqlParameter("@s_time", SqlDbType.DateTime) }; parameters[0].Value = model.s_brand; parameters[1].Value = model.s_app_id; parameters[2].Value = model.s_count; parameters[3].Value = model.s_time; object obj = DbHelperSQLTotal.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.jmp_trends model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into jmp_trends("); strSql.Append("t_app_id,t_newcount,t_activecount,t_time"); strSql.Append(") values ("); strSql.Append("@t_app_id,@t_newcount,@t_activecount,@t_time"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@t_app_id", SqlDbType.Int, 4), new SqlParameter("@t_newcount", SqlDbType.Int, 4), new SqlParameter("@t_activecount", SqlDbType.Int, 4), new SqlParameter("@t_time", SqlDbType.DateTime) }; parameters[0].Value = model.t_app_id; parameters[1].Value = model.t_newcount; parameters[2].Value = model.t_activecount; parameters[3].Value = model.t_time; object obj = DbHelperSQLTotal.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.jmp_sales_user model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into jmp_sales_user("); strSql.Append("r_moneys,r_date,r_appid"); strSql.Append(") values ("); strSql.Append("@r_moneys,@r_date,@r_appid"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@r_moneys", SqlDbType.Money, 8), new SqlParameter("@r_date", SqlDbType.DateTime), new SqlParameter("@r_appid", SqlDbType.Int, 4) }; parameters[0].Value = model.r_moneys; parameters[1].Value = model.r_date; parameters[2].Value = model.r_appid; object obj = DbHelperSQLTotal.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.jmp_appreport model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into jmp_appreport("); strSql.Append("a_successratio,a_alipay,a_wechat,a_curr,a_arpur,a_datetime,a_time,a_appname,a_appid,a_uerid,a_equipment,a_count,a_success,a_notpay,a_request,a_money,a_qqwallet"); strSql.Append(") values ("); strSql.Append("@a_successratio,@a_alipay,@a_wechat,@a_curr,@a_arpur,@a_datetime,@a_time,@a_appname,@a_appid,@a_uerid,@a_equipment,@a_count,@a_success,@a_notpay,@a_request,@a_money,@a_qqwallet"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@a_successratio", SqlDbType.Decimal, 9), new SqlParameter("@a_alipay", SqlDbType.Decimal, 9), new SqlParameter("@a_wechat", SqlDbType.Decimal, 9), new SqlParameter("@a_curr", SqlDbType.Decimal, 9), new SqlParameter("@a_arpur", SqlDbType.Decimal, 9), new SqlParameter("@a_datetime", SqlDbType.DateTime), new SqlParameter("@a_time", SqlDbType.DateTime), new SqlParameter("@a_appname", SqlDbType.NVarChar, -1), new SqlParameter("@a_appid", SqlDbType.Int, 4), new SqlParameter("@a_uerid", SqlDbType.Int, 4), new SqlParameter("@a_equipment", SqlDbType.Decimal, 9), new SqlParameter("@a_count", SqlDbType.Decimal, 9), new SqlParameter("@a_success", SqlDbType.Decimal, 9), new SqlParameter("@a_notpay", SqlDbType.Decimal, 9), new SqlParameter("@a_request", SqlDbType.Decimal, 9), new SqlParameter("@a_money", SqlDbType.Decimal, 9), new SqlParameter("@a_qqwallet", SqlDbType.Decimal, 9) }; parameters[0].Value = model.a_successratio; parameters[1].Value = model.a_alipay; parameters[2].Value = model.a_wechat; parameters[3].Value = model.a_curr; parameters[4].Value = model.a_arpur; parameters[5].Value = model.a_datetime; parameters[6].Value = model.a_time; parameters[7].Value = model.a_appname; parameters[8].Value = model.a_appid; parameters[9].Value = model.a_uerid; parameters[10].Value = model.a_equipment; parameters[11].Value = model.a_count; parameters[12].Value = model.a_success; parameters[13].Value = model.a_notpay; parameters[14].Value = model.a_request; parameters[15].Value = model.a_money; parameters[16].Value = model.a_qqwallet; object obj = DbHelperSQLTotal.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 商务业绩 /// </summary> /// <param name="merchantId"> 商务ID</param> /// <returns></returns> public string TodayResults(int merchantId, string kstime, string endtime) { string sqlstr = string.Format(" select isnull(SUM(a_curr),0) a_curr from dbo.jmp_appcount as a left join " + JMP.DbName.PubDbName.dbbase + ".dbo.jmp_user as b on a.a_uerid=b.u_id where b.u_merchant_id='" + merchantId + "' and a.a_datetime>=@kstime and a.a_datetime<=@endtime "); SqlParameter[] par = { new SqlParameter("@kstime", kstime), new SqlParameter("@endtime", endtime) }; return(DbHelperSQLTotal.GetSingle(sqlstr.ToString(), par).ToString()); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.jmp_keep model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into jmp_keep("); strSql.Append("k_day6,k_day7,k_day14,k_day30,k_time,k_app_id,k_type,k_usercount,k_day1,k_day2,k_day3,k_day4,k_day5"); strSql.Append(") values ("); strSql.Append("@k_day6,@k_day7,@k_day14,@k_day30,@k_time,@k_app_id,@k_type,@k_usercount,@k_day1,@k_day2,@k_day3,@k_day4,@k_day5"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@k_day6", SqlDbType.Decimal, 5), new SqlParameter("@k_day7", SqlDbType.Decimal, 5), new SqlParameter("@k_day14", SqlDbType.Decimal, 5), new SqlParameter("@k_day30", SqlDbType.Decimal, 5), new SqlParameter("@k_time", SqlDbType.DateTime), new SqlParameter("@k_app_id", SqlDbType.Int, 4), new SqlParameter("@k_type", SqlDbType.Int, 4), new SqlParameter("@k_usercount", SqlDbType.Int, 4), new SqlParameter("@k_day1", SqlDbType.Decimal, 5), new SqlParameter("@k_day2", SqlDbType.Decimal, 5), new SqlParameter("@k_day3", SqlDbType.Decimal, 5), new SqlParameter("@k_day4", SqlDbType.Decimal, 5), new SqlParameter("@k_day5", SqlDbType.Decimal, 5) }; parameters[0].Value = model.k_day6; parameters[1].Value = model.k_day7; parameters[2].Value = model.k_day14; parameters[3].Value = model.k_day30; parameters[4].Value = model.k_time; parameters[5].Value = model.k_app_id; parameters[6].Value = model.k_type; parameters[7].Value = model.k_usercount; parameters[8].Value = model.k_day1; parameters[9].Value = model.k_day2; parameters[10].Value = model.k_day3; parameters[11].Value = model.k_day4; parameters[12].Value = model.k_day5; object obj = DbHelperSQLTotal.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 查询今日成功金额 /// </summary> /// <param name="appid"></param> /// <returns></returns> public object dayCj(int appid) { string sql = string.Format("SELECT SUM(a_alipay)+ SUM(a_wechat)+SUM(a_qqwallet) AS moeny FROM " + JMP.DbName.PubDbName.dbtotal + ".dbo.jmp_appcount WHERE a_appid=@appid AND a_datetime>'" + System.DateTime.Now.AddDays(-1).ToShortDateString() + "'"); SqlParameter[] parameters = { new SqlParameter("@appid", SqlDbType.Int, 4) }; parameters[0].Value = appid; object obj = DbHelperSQLTotal.GetSingle(sql.ToString(), parameters); return(obj); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.jmp_app_report model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into jmp_app_report("); strSql.Append("r_times,r_starttime,r_username,r_uid,r_app_key,r_app_name,r_equipment,r_succeed,r_notpay,r_alipay)"); strSql.Append(" values ("); strSql.Append("@r_times,@r_starttime,@r_username,@r_uid,@r_app_key,@r_app_name,@r_equipment,@r_succeed,@r_notpay,@r_alipay)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@r_times", SqlDbType.DateTime), new SqlParameter("@r_starttime", SqlDbType.DateTime), new SqlParameter("@r_username", SqlDbType.NVarChar, -1), new SqlParameter("@r_uid", SqlDbType.Int, 4), new SqlParameter("@r_app_key", SqlDbType.NVarChar, -1), new SqlParameter("@r_app_name", SqlDbType.NVarChar, -1), new SqlParameter("@r_equipment", SqlDbType.Int, 4), new SqlParameter("@r_succeed", SqlDbType.Int, 4), new SqlParameter("@r_notpay", SqlDbType.Int, 4), new SqlParameter("@r_alipay", SqlDbType.Money, 8) }; parameters[0].Value = model.r_times; parameters[1].Value = model.r_starttime; parameters[2].Value = model.r_username; parameters[3].Value = model.r_uid; parameters[4].Value = model.r_app_key; parameters[5].Value = model.r_app_name; parameters[6].Value = model.r_equipment; parameters[7].Value = model.r_succeed; parameters[8].Value = model.r_notpay; parameters[9].Value = model.r_alipay; object obj = DbHelperSQLTotal.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 获取记录总数 /// </summary> public int GetRecordCount(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select count(1) FROM jmp_app_report "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } object obj = DbHelperSQLTotal.GetSingle(strSql.ToString()); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 查询今天截止目前的交易金额合计 /// </summary> /// <returns></returns> public string SelectSumDay(string dept, int userid) { string kstime = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00"; string endtime = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59"; string depts = System.Configuration.ConfigurationManager.AppSettings["RoleID"]; string sqlstr = "select isnull(SUM(a_curr),0) a_curr from dbo.jmp_appcount a left join " + JMP.DbName.PubDbName.dbbase + ". [dbo].[jmp_user] b on a.a_uerid=b.u_id where a.a_datetime>=@kstime and a.a_datetime<=@endtime"; dept = dept.Replace(" ", "").ToString(); if (dept == depts) { sqlstr += " and b.u_merchant_id=" + userid; } SqlParameter[] par = { new SqlParameter("@kstime", kstime), new SqlParameter("@endtime", endtime) }; return(DbHelperSQLTotal.GetSingle(sqlstr.ToString(), par).ToString()); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.jmp_defect model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into jmp_defect("); strSql.Append("d_type,d_aapid,d_losscount,d_lossproportion,d_usercount,d_datatype,d_time"); strSql.Append(") values ("); strSql.Append("@d_type,@d_aapid,@d_losscount,@d_lossproportion,@d_usercount,@d_datatype,@d_time"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@d_type", SqlDbType.Int, 4), new SqlParameter("@d_aapid", SqlDbType.Int, 4), new SqlParameter("@d_losscount", SqlDbType.Int, 4), new SqlParameter("@d_lossproportion", SqlDbType.Decimal, 5), new SqlParameter("@d_usercount", SqlDbType.Int, 4), new SqlParameter("@d_datatype", SqlDbType.Int, 4), new SqlParameter("@d_time", SqlDbType.DateTime) }; parameters[0].Value = model.d_type; parameters[1].Value = model.d_aapid; parameters[2].Value = model.d_losscount; parameters[3].Value = model.d_lossproportion; parameters[4].Value = model.d_usercount; parameters[5].Value = model.d_datatype; parameters[6].Value = model.d_time; object obj = DbHelperSQLTotal.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.jmp_paychannel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into jmp_paychannel("); strSql.Append("payname,payid,money,datetimes,paytype,success,successratio,notpay"); strSql.Append(") values ("); strSql.Append("@payname,@payid,@money,@datetimes,@paytype"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@payname", SqlDbType.NVarChar, -1), new SqlParameter("@payid", SqlDbType.Int, 4), new SqlParameter("@money", SqlDbType.Decimal, 9), new SqlParameter("@datetimes", SqlDbType.DateTime), new SqlParameter("@paytype", SqlDbType.NVarChar, -1), new SqlParameter("@success", model.success), new SqlParameter("@successratio", model.successratio), new SqlParameter("@notpay", model.notpay) }; parameters[0].Value = model.payname; parameters[1].Value = model.payid; parameters[2].Value = model.money; parameters[3].Value = model.datetimes; parameters[4].Value = model.paytype; object obj = DbHelperSQLTotal.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }