/// <summary> /// 查询云秒杀记录 /// </summary> /// <param name="package"></param> /// <returns></returns> public IList<DsYmsUserModel> GetYmsUserList(string package) { try { string sql; if (string.IsNullOrEmpty(package)) { sql = "select y.username,y.showname,y.lastresults,y.sort,y.package,u.capital,u.pos_ratio FROM selfstock.DS_YMS_USER y join selfstock.DS_QR_USERINFO u on y.username=u.user_name WHERE u.user_type='1'"; } else { sql = "select y.username,y.showname,y.lastresults,y.sort,y.package,u.capital,u.pos_ratio FROM selfstock.DS_YMS_USER y join selfstock.DS_QR_USERINFO u on y.username=u.user_name WHERE y.package='" + package.ToLower() + "' and u.user_type='1'"; } OracleDataReader reader = OracleDataAccess.ExecuteReader(OracleDataAccess.OracleConnectionUpdbString, CommandType.Text, sql); IList<DsYmsUserModel> list = new List<DsYmsUserModel>(); while (reader.Read()) { var model = new DsYmsUserModel(); model.UserName = reader["username"].ToString(); model.ShowName = reader["showname"].ToString(); model.LastResults = (decimal)reader["lastresults"]; model.Sort = int.Parse(reader["sort"].ToString()); model.Package = reader["package"].ToString(); model.Capital = (decimal)reader["capital"]; model.PosRatio = (decimal)reader["pos_ratio"]; list.Add(model); } reader.Close(); return list; } catch (OracleException ce) { Loger.Error(ce); return null; } }
/// <summary> /// This gives the information of the External Service. Here the code to fetch the connection should be written /// This is can be set when in the constructor of the class inheriting the abstract class /// </summary> protected bool GetServiceConfig(string serviceName) { string sConfigName, sErrorMsg, sExpirationTime; string [] aExpirationTime = null; Hashtable htConfigData = ( Hashtable )chConfig.Get("CSN_KM_CONFIG", "ServiceGatewayConfigData"); if (htConfigData == null) { try { htConfigData = new Hashtable(); string sSql = "SELECT CONFIGNAME, CONFIGVALUE FROM CSN.SERVICECONFIG WHERE SERVICENAME = '" + serviceName + "'"; //ODP.Net 10.7 Changes OracleDataAccess objConn = (OracleDataAccess)OracleDataAccess.GetObj("CSN"); //ODPDataAccess objConn = (ODPDataAccess)ODPDataAccess.GetObj("CSN"); IDataReader dataReader = objConn.ExecuteReader(CommandType.Text, sSql); while (dataReader.Read()) { sConfigName = dataReader["CONFIGNAME"].ToString(); switch (sConfigName) { case "TAXONOMYURL": taxonomyUrl = dataReader["CONFIGVALUE"].ToString(); htConfigData.Add("TAXONOMYURL", taxonomyUrl); break; case "SEARCHURL": searchUrl = dataReader["CONFIGVALUE"].ToString(); htConfigData.Add("SEARCHURL", searchUrl); break; case "PRESENTATIONURL": presentationUrl = dataReader["CONFIGVALUE"].ToString(); htConfigData.Add("PRESENTATIONURL", presentationUrl); break; case "USERID": userId = dataReader["CONFIGVALUE"].ToString(); htConfigData.Add("USERID", userId); break; case "PASSWORD": userPassword = HP.Sasp.Utility.Cryptography.Decrypt(dataReader["CONFIGVALUE"].ToString()); htConfigData.Add("PASSWORD", userPassword); break; case "PORTALID": portalId = dataReader["CONFIGVALUE"].ToString(); htConfigData.Add("PORTALID", portalId); break; case "TIMEOUT": timeOut = Convert.ToInt32(dataReader["CONFIGVALUE"]); htConfigData.Add("TIMEOUT", timeOut); break; case "MAX_RESULTS": max_results = Convert.ToInt32(dataReader["CONFIGVALUE"]); htConfigData.Add("MAX_RESULTS", max_results); break; case "RESULTS_PER_PAGE": results_per_page = Convert.ToInt32(dataReader["CONFIGVALUE"]); htConfigData.Add("RESULTS_PER_PAGE", results_per_page); break; case "PRODUCT_ROOT_OID": product_root_oid = Convert.ToInt32(dataReader["CONFIGVALUE"]); htConfigData.Add("PRODUCT_ROOT_OID", product_root_oid); break; case "COMPONENT_ROOT_OID": component_root_oid = Convert.ToInt32(dataReader["CONFIGVALUE"]); htConfigData.Add("COMPONENT_ROOT_OID", component_root_oid); break; case "OS_ROOT_OID": os_root_oid = Convert.ToInt32(dataReader["CONFIGVALUE"]); htConfigData.Add("OS_ROOT_OID", os_root_oid); break; case "TAXCACHE_RESET_TIME": sExpirationTime = dataReader["CONFIGVALUE"].ToString(); aExpirationTime = sExpirationTime.Split(":".ToCharArray()); expiration_hrs = Convert.ToInt32(aExpirationTime[0]); expiration_min = Convert.ToInt32(aExpirationTime[1]); expiration_sec = Convert.ToInt32(aExpirationTime[2]); htConfigData.Add("TAXCACHE_RESET_TIME", sExpirationTime); break; } } } catch (OracleException ex) { sErrorMsg = "Unable to fetch service configuration from Database:" + ex.Message; return(false); } chConfig.Insert("CSN_KM_CONFIG", "ServiceGatewayConfigData", htConfigData); } else { System.Collections.IDictionaryEnumerator configDataEnumerator = htConfigData.GetEnumerator(); while (configDataEnumerator.MoveNext()) { sConfigName = configDataEnumerator.Key.ToString(); switch (sConfigName) { case "TAXONOMYURL": taxonomyUrl = configDataEnumerator.Value.ToString(); break; case "SEARCHURL": searchUrl = configDataEnumerator.Value.ToString(); break; case "PRESENTATIONURL": presentationUrl = configDataEnumerator.Value.ToString(); break; case "USERID": userId = configDataEnumerator.Value.ToString(); break; case "PASSWORD": userPassword = configDataEnumerator.Value.ToString(); break; case "PORTALID": portalId = configDataEnumerator.Value.ToString(); break; case "TIMEOUT": timeOut = (int)configDataEnumerator.Value; break; case "MAX_RESULTS": max_results = (int)configDataEnumerator.Value; break; case "RESULTS_PER_PAGE": results_per_page = (int)configDataEnumerator.Value; break; case "PRODUCT_ROOT_OID": product_root_oid = (int)configDataEnumerator.Value; break; case "COMPONENT_ROOT_OID": component_root_oid = (int)configDataEnumerator.Value; break; case "OS_ROOT_OID": os_root_oid = (int)configDataEnumerator.Value; break; case "TAXCACHE_RESET_TIME": sExpirationTime = configDataEnumerator.Value.ToString(); aExpirationTime = sExpirationTime.Split(":".ToCharArray()); expiration_hrs = Convert.ToInt32(aExpirationTime[0]); expiration_min = Convert.ToInt32(aExpirationTime[1]); expiration_sec = Convert.ToInt32(aExpirationTime[2]); break; } } } return(true); }