public List <Models.DbModels.tb_token> GetByPage(XXF.Db.DbConn PubConn, int pno, int pagesize, string keywords, DbModels.TokenType tokentype, out int totalcount) { List <DbModels.tb_token> tokenlist = new List <DbModels.tb_token>(); string basesql = "select {0} from " + tokentype.ToString() + " "; string whercon = ""; XXF.Db.SimpleProcedureParameter para = new SimpleProcedureParameter(); string querysql = string.Format(basesql, "ROW_NUMBER() over (order by createtime desc) as rownum, token,userid,id,username,appid,createtime,expires"); if (!string.IsNullOrEmpty(keywords)) { para.Add("@keywords", keywords); whercon = " where token=@keywords or userid like '%' + @keywords + '%' or username like '%' + @keywords + '%' or appid like '%' + @keywords + '%' "; } querysql = string.Concat("select A.* from (", querysql, whercon, ") A ", " where A.rownum between ", (pno - 1) * pagesize + 1, " and ", pagesize * pno); DataSet ds = new DataSet(); PubConn.SqlToDataSet(ds, querysql, para.ToParameters()); foreach (DataRow dr in ds.Tables[0].Rows) { tokenlist.Add(CreateModel(dr)); } totalcount = (int)PubConn.ExecuteScalar(string.Format(basesql, " count(*) ") + whercon, para.ToParameters()); return(tokenlist); }
public List <DbModels.certcenterlog> GetPage(XXF.Db.DbConn PubConn, int pno, int pagesize, string keywords, out int totalcount) { string basesql = "select {0} from certcenterlog "; string querysql = string.Format(basesql, " ROW_NUMBER() over (order by reqtime desc ) as rownum,id,url,reqdata,userid,username,reqtime,ip,opecontent"); XXF.Db.SimpleProcedureParameter para = new SimpleProcedureParameter(); string wherecon = ""; if (!string.IsNullOrEmpty(keywords)) { wherecon = " where userid like '%' +@keywords+'%' or username like '%' +@keywords+'%' or url like '%' +@keywords+'%' or ip like '%' +@keywords+'%' "; para.Add("@keywords", keywords); } DataSet ds = new DataSet(); querysql = string.Concat("select A.* from (", querysql, wherecon, ") A", " where A.rownum between ", (pno - 1) * pagesize + 1, " and ", pagesize * pno); PubConn.SqlToDataSet(ds, querysql, para.ToParameters()); List <DbModels.certcenterlog> listlog = new List <DbModels.certcenterlog>(); foreach (DataRow a in ds.Tables[0].Rows) { listlog.Add(CreateModel(a)); } totalcount = (int)PubConn.ExecuteScalar(string.Format(basesql, " count(*) ") + wherecon, para.ToParameters()); return(listlog); }
public Models.DbModels.api Get(DbConn PubConn, string apiname, int apptype) { XXF.Db.SimpleProcedureParameter para = new SimpleProcedureParameter(); para.Add("area", apiname ?? ""); para.Add("@apptype", apptype); StringBuilder stringSql = new StringBuilder(); stringSql.Append(@"select s.* from api s where s.appname=@appname and s.apptype=@apptype"); DataSet ds = new DataSet(); PubConn.SqlToDataSet(ds, stringSql.ToString(), para.ToParameters()); if (ds != null && ds.Tables.Count > 0) { return(CreateModel(ds.Tables[0].Rows[0])); } return(null); }
public static string GetConnStr(CertCenter.Models.DbModels.TokenType tokentype, string userid = "") { string constr = ""; switch (tokentype) { case CertCenter.Models.DbModels.TokenType.usertoken: constr = XXF.Db.DbConfig.GetConfig("dydDbConn"); break; case CertCenter.Models.DbModels.TokenType.shoptoken: using (XXF.Db.DbConn PubConn = XXF.Db.DbConfig.CreateConn(XXF.Db.DbType.SQLSERVER, XXF.Db.DbConfig.GetConfig("dydDbConn"))) { PubConn.Open(); string sql = "select f_shzh,f_shdqbm,f_shsj from tb_shop_area where f_shzh=@userid or f_shsj=@userid"; XXF.Db.SimpleProcedureParameter para = new SimpleProcedureParameter(); para.Add("@userid", userid); DataSet ds = new DataSet(); PubConn.SqlToDataSet(ds, sql, para.ToParameters()); if (ds.Tables[0].Rows.Count == 0) { return(""); } string dqbm = ds.Tables[0].Rows[0]["f_shdqbm"].ToString(); string t = XXF.Db.DbConfig.GetConfig("ShopAreaConnectString"); throw new Exception("no show"); // constr = XXF.Db.DbAreaRule.ShopAreaPartitionRule(t, Convert.ToInt32(dqbm)); } break; case CertCenter.Models.DbModels.TokenType.managetoken: constr = XXF.Db.DbConfig.GetConfig("CrmDbConn"); break; default: break; } if (constr == "") { throw new Exception("车有问题。"); } return(constr); }
public Models.DbModels.api Get(DbConn PubConn, string area, string controller, string action, int apptype) { XXF.Db.SimpleProcedureParameter para = new SimpleProcedureParameter(); para.Add("area", area ?? ""); para.Add("controller", controller ?? ""); para.Add("action", action ?? ""); para.Add("@apptype", apptype); StringBuilder stringSql = new StringBuilder(); stringSql.Append(@"select s.* from api s where s.area=@area and s.controller=@controller and s.action=@action and s.apptype=@apptype"); DataSet ds = new DataSet(); PubConn.SqlToDataSet(ds, stringSql.ToString(), para.ToParameters()); if (ds != null && ds.Tables.Count > 0) { return(CreateModel(ds.Tables[0].Rows[0])); } return(null); }
public static string GetConnStr(CertCenter.Models.DbModels.TokenType tokentype, string userid = "") { string constr = ""; switch (tokentype) { case CertCenter.Models.DbModels.TokenType.usertoken: constr = XXF.Db.DbConfig.GetConfig("dydDbConn"); break; case CertCenter.Models.DbModels.TokenType.shoptoken: using (XXF.Db.DbConn PubConn = XXF.Db.DbConfig.CreateConn(XXF.Db.DbType.SQLSERVER, XXF.Db.DbConfig.GetConfig("dydDbConn"))) { PubConn.Open(); string sql = "select f_shzh,f_shdqbm,f_shsj from tb_shop_area where f_shzh=@userid or f_shsj=@userid"; XXF.Db.SimpleProcedureParameter para = new SimpleProcedureParameter(); para.Add("@userid", userid); DataSet ds = new DataSet(); PubConn.SqlToDataSet(ds, sql, para.ToParameters()); if (ds.Tables[0].Rows.Count == 0) { return ""; } string dqbm = ds.Tables[0].Rows[0]["f_shdqbm"].ToString(); string t = XXF.Db.DbConfig.GetConfig("ShopAreaConnectString"); throw new Exception("no show"); // constr = XXF.Db.DbAreaRule.ShopAreaPartitionRule(t, Convert.ToInt32(dqbm)); } break; case CertCenter.Models.DbModels.TokenType.managetoken: constr = XXF.Db.DbConfig.GetConfig("CrmDbConn"); break; default: break; } if (constr == "") { throw new Exception("车有问题。"); } return constr; }
public Models.DbModels.api Get(DbConn PubConn, string apiname, int apptype) { XXF.Db.SimpleProcedureParameter para = new SimpleProcedureParameter(); para.Add("area", apiname ?? ""); para.Add("@apptype", apptype); StringBuilder stringSql = new StringBuilder(); stringSql.Append(@"select s.* from api s where s.appname=@appname and s.apptype=@apptype"); DataSet ds = new DataSet(); PubConn.SqlToDataSet(ds, stringSql.ToString(), para.ToParameters()); if (ds != null && ds.Tables.Count > 0) { return CreateModel(ds.Tables[0].Rows[0]); } return null; }
public Models.DbModels.api Get(DbConn PubConn, string area, string controller, string action,int apptype) { XXF.Db.SimpleProcedureParameter para = new SimpleProcedureParameter(); para.Add("area", area ?? ""); para.Add("controller", controller ?? ""); para.Add("action", action ?? ""); para.Add("@apptype", apptype); StringBuilder stringSql = new StringBuilder(); stringSql.Append(@"select s.* from api s where s.area=@area and s.controller=@controller and s.action=@action and s.apptype=@apptype"); DataSet ds = new DataSet(); PubConn.SqlToDataSet(ds, stringSql.ToString(), para.ToParameters()); if (ds != null && ds.Tables.Count > 0) { return CreateModel(ds.Tables[0].Rows[0]); } return null; }
public List<Models.DbModels.tb_token> GetByPage(XXF.Db.DbConn PubConn, int pno, int pagesize, string keywords, DbModels.TokenType tokentype, out int totalcount) { List<DbModels.tb_token> tokenlist = new List<DbModels.tb_token>(); string basesql = "select {0} from " + tokentype.ToString() + " "; string whercon = ""; XXF.Db.SimpleProcedureParameter para = new SimpleProcedureParameter(); string querysql = string.Format(basesql, "ROW_NUMBER() over (order by createtime desc) as rownum, token,userid,id,username,appid,createtime,expires"); if (!string.IsNullOrEmpty(keywords)) { para.Add("@keywords", keywords); whercon = " where token=@keywords or userid like '%' + @keywords + '%' or username like '%' + @keywords + '%' or appid like '%' + @keywords + '%' "; } querysql = string.Concat("select A.* from (", querysql, whercon, ") A ", " where A.rownum between ", (pno - 1) * pagesize + 1, " and ", pagesize * pno); DataSet ds = new DataSet(); PubConn.SqlToDataSet(ds, querysql, para.ToParameters()); foreach (DataRow dr in ds.Tables[0].Rows) { tokenlist.Add(CreateModel(dr)); } totalcount = (int)PubConn.ExecuteScalar(string.Format(basesql, " count(*) ") + whercon, para.ToParameters()); return tokenlist; }
public List<DbModels.certcenterlog> GetPage(XXF.Db.DbConn PubConn, int pno, int pagesize, string keywords, out int totalcount) { string basesql = "select {0} from certcenterlog "; string querysql = string.Format(basesql, " ROW_NUMBER() over (order by reqtime desc ) as rownum,id,url,reqdata,userid,username,reqtime,ip,opecontent"); XXF.Db.SimpleProcedureParameter para = new SimpleProcedureParameter(); string wherecon = ""; if (!string.IsNullOrEmpty(keywords)) { wherecon = " where userid like '%' +@keywords+'%' or username like '%' +@keywords+'%' or url like '%' +@keywords+'%' or ip like '%' +@keywords+'%' "; para.Add("@keywords", keywords); } DataSet ds = new DataSet(); querysql = string.Concat("select A.* from (", querysql, wherecon, ") A", " where A.rownum between ", (pno - 1) * pagesize + 1, " and ", pagesize * pno); PubConn.SqlToDataSet(ds, querysql, para.ToParameters()); List<DbModels.certcenterlog> listlog = new List<DbModels.certcenterlog>(); foreach (DataRow a in ds.Tables[0].Rows) { listlog.Add(CreateModel(a)); } totalcount = (int)PubConn.ExecuteScalar(string.Format(basesql, " count(*) ") + wherecon, para.ToParameters()); return listlog; }