static void Main() { //Program entrypoint IUPnPConfigFactory sinkfact = new SinkFactory(); IUPnPConfigFactory sourceFact = new SourceFactory(); UPnP sink = new UPnP(sinkfact.CreatePackage()); UPnP source = new UPnP(sourceFact.CreatePackage()); IPlayqueueHandler pqhandl = new PlayqueueHandler(); PlaybackControl PlayCtrl = new PlaybackControl(sink, pqhandl); DBHandle dbHandle = new DBHandle(source, pqhandl); AbstractFileSenderServer Fserver = new FileSenderServer.FileSenderServer(); Console.WriteLine ("=============================================================="); Console.WriteLine ("Welcome to the HiPi Server solution"); Console.WriteLine ("All UPnP devices SHOULD work, but that's probably not the case"); Console.WriteLine ("Feel free to get our Windows application to get all features"); Console.WriteLine ("Enjoy! ;)"); Console.WriteLine ("=============================================================="); Console.Read(); }
public CurrencyHandle() { if (_handle == null) { _handle = new DBHandle(); } }
public CatesHandle() { if (_handle == null) { _handle = new DBHandle(); } }
/// <summary> /// 构造函数 /// </summary> public AboutHandle() { if (_handle == null) { _handle = new DBHandle(); } }
public TourismHandle() { if (_handle == null) { _handle = new DBHandle(); } }
public NationsHandle() { if (_handle == null) { _handle = new DBHandle(); } }
public OthersHandle() { if (_handle == null) { _handle = new DBHandle(); } }
internal void CreateTables() { switch (ConfigurationManager.AppSettings["Storage.DBHandle.Provider"].ToLower()) { case "npgsql": case "postgres": OrmLiteConfig.DialectProvider = PostgreSqlDialect.Provider; break; default: throw new ArgumentException("could not select database driver/provider from configuration value '" + ConfigurationManager.AppSettings["Storage.DBHandle.Provider"] + "'"); } //OrmLiteConfig.DialectProvider = new OrmLite//PostgreSqlDialect.Provider; //OrmLiteConnectionFactory dbFactory = // new OrmLiteConnectionFactory("Server=127.0.0.1;Port=5432;User Id=ubiquity;Password=ubiquity;Database=ubiquity;pooling=true;MinPoolSize=5"); DBHandle dbh = new DBHandle(); using (IDbConnection db = dbh.GetConnection()){ db.CreateTables(false, typeof(BackupSet), typeof(P2PBackup.Common.Node), typeof(Hypervisor), typeof(StorageGroup), typeof(ScheduleTime), typeof(Task), typeof(P2PBackup.Common.User), typeof(NodeGroup), typeof(UserRole) ); } }
/// <summary> /// 构造函数 /// </summary> public MapHandle() { if (_handle == null) { _handle = new DBHandle(); } }
/// <summary> /// 获取各菜系列表 /// </summary> /// <returns></returns> public DataTable GetListCate() { if (_handle == null) { _handle = new DBHandle(); } string sql = @"SELECT a.Id id,a.Name name,a.AliasName aliasname FROM S_Food a"; DataTable dt = _handle.ExecuteQuery(sql); return(dt); }
/// <summary> /// 根据数据类型获取指定的景点,默认1=1 /// </summary> /// <param name="instate">所属洲编号</param> /// <returns></returns> public DataTable GetSource(int instate) { if (_handle == null) { _handle = new DBHandle(); } string sql = @"SELECT a.Id id,a.Name name,a.PathName pathname,b.AliasName aliasname FROM S_ScenicSpot a join S_State b on a.InState=b.Id where " + (instate == -1 ? "1=1" : ("b.Id=" + instate)); DataTable dt = _handle.ExecuteQuery(sql); return(dt); }
public static void BindDropDLTRoles(ComboBox cb) { DBHandle db = new DBHandle(); DataSet ds = db.GetRoles(); DataRow dr = ds.Tables[0].NewRow(); dr["F_RoleID"] = "0"; dr["F_RoleName"] = "请选择..."; ds.Tables[0].Rows.InsertAt(dr, 0); BindDropDLT(cb, ds, "F_RoleName", "F_RoleID"); }
/// <summary> /// 根据类型获取城市列表 /// </summary> /// <param name="t">类型</param> /// <returns></returns> public DataTable GetCitysByType(string t) { DataTable dt = new DataTable(); if (_handle == null) { _handle = new DBHandle(); } string sql = @"SELECT c.Id id, c.City city,c.CityCode code, c.Lat lat,c.Lon lon FROM S_Citys c where c.CityCode like '%" + t + "%'"; dt = _handle.ExecuteQuery(sql); return(dt); }
/// <summary> /// 获取关于模块信息 /// </summary> /// <returns></returns> public DataTable GetAboutInfo(int userId) { DataTable dt = new DataTable(); if (_handle == null) { _handle = new DBHandle(); } string sql = @"SELECT u.Id id,a.Name name,a.AliasName aliasname,a.DisplayValue display FROM S_Users u JOIN S_About a ON u.Id=a.UserId WHERE u.Id=" + userId + " ORDER BY a.OrderId"; dt = _handle.ExecuteQuery(sql); return(dt); }
/// <summary> /// 根据用户标识获取用户相关信息 /// </summary> /// <param name="userId"></param> /// <returns></returns> public DataTable GetUserInfo(string userId) { DataTable dt = new DataTable(); if (_handle == null) { _handle = new DBHandle(); } string sql = @"SELECT u.Id id,u.Name name,u.AliasName aliasname,u.Description description FROM S_Users u WHERE u.Id=" + userId; dt = _handle.ExecuteQuery(sql); return(dt); }
/// <summary> /// 获取关于其他相关信息 /// </summary> /// <param name="userId">用户标识</param> /// <returns></returns> public DataTable GetAboutOther(int userId) { DataTable dt = new DataTable(); if (_handle == null) { _handle = new DBHandle(); } string sql = @"SELECT u.Id id,b.Id bid,b.Name name,b.Type type,b.Description description FROM S_Blogs b JOIN S_Users u ON u.Id=b.UserId WHERE u.Id=" + userId + " ORDER BY b.OrderId"; dt = _handle.ExecuteQuery(sql); return(dt); }
public JsonResult GetData() { DBHandle objdbhndle = new DBHandle(); ModelState.Clear(); var model = new StudentModel() { JsonData = objdbhndle.GetStudent() }; return(Json(model)); //((dynamic)Newtonsoft.Json.JsonConvert.DeserializeObject(model)); //@model MVCWidoutEF.Models.StudentModel //return View(model); }
/// <summary> /// 构造函数 /// </summary> /// <param name="TcpSvr">通讯实例</param> public ServerHandle(TcpSvr TcpSvr) { _tcpsvr = TcpSvr; string sqlstr = "SELECT * FROM GSSCONFIG WHERE ID=1"; DataSet ds = DbHelperSQLite.Query(sqlstr); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows != null) { string dbip = ds.Tables[0].Rows[0]["GSSDBIP"].ToString(); string dbname = ds.Tables[0].Rows[0]["GSSDBNAME"].ToString(); string dbuid = ds.Tables[0].Rows[0]["GSSDBUID"].ToString(); string dbpsw = ds.Tables[0].Rows[0]["GSSDBPSW"].ToString(); gssdbconn = @"Data Source=" + dbip + ";Initial Catalog=" + dbname + ";Persist Security Info=True;User ID=" + dbuid + ";Password="******""; } dbhandle = new DBHandle(); }
/// <summary> /// 根据模块标识和子选项标识获取描述信息 /// </summary> /// <param name="module">模块标识</param> /// <param name="id">选项标识</param> /// <returns></returns> public DataTable GetDescriptionById(int moduleId, int childId) { if (_handle == null) { _handle = new DBHandle(); } DataTable dt = null; if (moduleId > 0 && childId > 0) { string dtName = moduleId == 1 ? "S_ScenicSpot" : (moduleId == 2 ? "S_Family" : (moduleId == 3 ? "S_Food" : (moduleId == 4 ? "S_Map" : (moduleId == 5 ? "S_About" : null)))); string sql = @"SELECT a.Id id,b.Name name,a.Title title,a.Description description FROM S_Description a join " + dtName + " b on a.Relation=b.Id where a.Type=" + moduleId + " and a.Relation=" + childId; if (dtName != null) { dt = _handle.ExecuteQuery(sql); } } else { string sql = @"SELECT a.Id id,a.Title title,a.Description description FROM S_Description a where a.Type=" + moduleId + " and a.Relation=" + childId; dt = _handle.ExecuteQuery(sql); } return(dt); }
/// <summary> /// Initialize the corresponding file processing object. /// </summary> /// <typeparam name="TEntity">file entity</typeparam> /// <param name="handleEnum">handle enum</param> /// <returns>handle</returns> private IHandle <TEntity> InitHandle <TEntity>(HandleEnum handleEnum) where TEntity : class { IHandle <TEntity> handle = null; switch (handleEnum) { case HandleEnum.DB: handle = new DBHandle <TEntity>(); break; case HandleEnum.INI: handle = new IniHandle <TEntity>(); break; case HandleEnum.JSON: handle = new JsonHandle <TEntity>(); break; case HandleEnum.XML: handle = new XmlHandle <TEntity>(); break; } return(handle); }
public static string AddActiveFallConfig(GSSModel.Request.ActiveFallGoodsData fall) {//LKSV_7_gspara_db_0_1 //首先将数据写入到GSSDB中 List <string> scenes = new List <string>(); foreach (int item in fall.SceneIds) { scenes.Add(item.ToString()); } GSSModel.Request.ActiveFallGoodLogicData goods = fall.MapObject <GSSModel.Request.ActiveFallGoodsData, GSSModel.Request.ActiveFallGoodLogicData>(true); string json = goods.ConvertJson(); GSSModel.SampleWorkOrder sample = new GSSModel.SampleWorkOrder() { Title = goods.ActiveName, Note = goods.ActiveName, BigZoneName = fall.BigZoneName, ZoneName = fall.ZoneName, TypeId = fall.TaskTypeID, AppId = fall.AppId, CreateBy = fall.CreateBy, LogicData = json }; DBHandle gss = new DBHandle(); int taskId = gss.AddSampleTaskWithLogicData(sample); if (!fall.SyncConfig) {//是否同时将配置写入到MySQL? return(string.Empty); } string linkName = string.Format("LKSV_GSS_7_gspara_db_{0}_{1}", fall.BigZoneID, fall.ZoneID); string conn, error = string.Empty; conn = QueryMysqlLinkConnString(linkName, ref error); if (!string.IsNullOrEmpty(error)) { return(error); } //此处需要确认MySQL中新增了列【最低等级,最高等级,掉落类型】 string cmd = @"insert into hugeaward_cfg(szName,NGSID,tBeginDate,tEndDate,tBeginTime,tEndTime,nDropItemID,nDropMax,nDropProbability,szDropScene,minLevel,maxLevel,fallType,TaskId ) values('{0}',-1,'{1}','{2}','{3}','{4}',{5},{6},{7},'{8}',{9},{10},{11},{12})"; //nDropProbability 存储的是概率分母 cmd = string.Format(cmd, fall.ActiveName, fall.StartTime.ToString(AppConfig.DateFormat), fall.EndTime.ToString(AppConfig.DateFormat), fall.StartTime.ToString(AppConfig.TimeFormat), fall.EndTime.ToString(AppConfig.TimeFormat), fall.EquipNo, fall.FallGoodNum, fall.GoodsFallPRDenominator, string.Join(",", scenes.ToArray()), fall.MinRoleLevel, fall.MaxRoleLevel, fall.FallType, taskId); string filter = FilterDBConnString(conn); //查询目前数据库中最大的ID DbHelperMySQL.connectionString = filter; try { int result = DbHelperMySQL.ExecuteSql(cmd); if (result > 0) { gss.FinshSyncLogicData(taskId); } } catch (Exception ex) { string msg = ex.ToString(); msg.Logger(); return(msg); } return(string.Empty); }