public DataTable AddUser() { base.Kv.Cxt.CurrentUserID = 1; // New users are added by Admin = 1 User item = new User(); item.Cxt = base.Kv.Cxt; if (CountryID != 0) { item.CountryID = CountryID; } item.NearestCityID = NearestCityID; item.GenderID = GenderID; item.FideTitleID = FideTitleID; item.IccfTitleID = IccfTitleID; item.UserName = UserName; item.Email = Email; item.FirstName = FirstName; item.LastName = LastName; item.EngineID = 1; item.PasswordHint = PasswordHint; item.PersonalNotes = PersonalNotes; item.Url = Url; if (DateLastLogin != string.Empty) { item.DateLastLogin = Convert.ToDateTime(DateLastLogin); } if (DateOfBirth != string.Empty) { item.DateOfBirth = Convert.ToDateTime(DateOfBirth); } item.Password = Password; item.HumanRankIDE = RankE.Pawn; item.EngineRankIDE = RankE.Pawn; item.CentaurRankIDE = RankE.Pawn; item.CorrespondenceRankIDE = RankE.Pawn; item.StatusIDE = StatusE.Active; item.RoomID = 3; item.SocialID = 1; item.UserStatusIDE = UserStatusE.Blank; item.IsIdle = false; item.IsPause = false; item.Cxt.CurrentUserID = base.Kv.Cxt.CurrentUserID; item.Save(); if (!string.IsNullOrEmpty(UserImage)) { SaveUserImage(Ap.WebFolderUserImages + item.UserID); } DataTable roles = User.GetRolesTable(item.UserID); Kv kv1 = new Kv(); kv1.Set("MsgId", -1); kv1.Set("UserData", UData.ToString(item.DataRow.Table)); kv1.Set("RolesData", UData.ToString(roles.Copy())); return(kv1.DataTable); }
public string GetGameXml(GameData gameData) { if (gameData == null) { return(""); } return(UData.ToString(gameData.Kv.DataTable)); }
public static void DeclineChallenges(DataTable dt) { Kv kv = new Kv(); kv.Set("MethodName", (int)MethodNameE.DeclineChallenges); kv.Set(StdKv.CurrentUserID, Ap.CurrentUserID); kv.Set("ChallengesData", UData.ToString(dt)); SocketClient.Instance.InvokeAsync(kv.DataTable.Copy()); }
public static string RemoveAudience(int userID) { Kv kv = new Kv(); kv.Set("MethodName", (int)MethodNameE.RemoveAudience); kv.Set("UserID", userID); string data = UData.ToString(kv.DataTable); return(data); }
public static string AddAudienceAsync(string uData) { Kv kv = new Kv(); kv.Set("MethodName", (int)MethodNameE.AddAudienceAsync); kv.Set("AudienceData", uData); string data = UData.ToString(kv.DataTable); return(data); }
private string GetUserImage(string filePath) { string imagetype = ""; if (UFile.Exists(filePath + ".bmp")) { imagetype = ".bmp"; } else if (UFile.Exists(filePath + ".jpeg")) { imagetype = ".jpeg"; } else if (UFile.Exists(filePath + ".jpg")) { imagetype = ".jpg"; } else if (UFile.Exists(filePath + ".gif")) { imagetype = ".gif"; } else { return(string.Empty); } byte[] UserImageBytes = UImage.GetImageBytes(filePath + imagetype); //UserImageType = System.IO.Path.GetExtension(filePath); DataTable userImageTable = new DataTable("UserImageTable"); DataColumn nameColumn; nameColumn = new DataColumn(); nameColumn.DataType = System.Type.GetType("System.String"); nameColumn.ColumnName = "ImageName"; userImageTable.Columns.Add(nameColumn); DataColumn imageColumn; imageColumn = new DataColumn(); imageColumn.DataType = System.Type.GetType("System.Byte[]"); imageColumn.ColumnName = "ImageBytes"; userImageTable.Columns.Add(imageColumn); DataColumn typeColumn; typeColumn = new DataColumn(); typeColumn.DataType = System.Type.GetType("System.String"); typeColumn.ColumnName = "ImageType"; userImageTable.Columns.Add(typeColumn); DataRow dr = userImageTable.NewRow(); dr["ImageName"] = "UserImage"; dr["ImageBytes"] = UserImageBytes; dr["ImageType"] = imagetype; userImageTable.Rows.Add(dr); return(UData.ToString(userImageTable)); }
public string GetLastMoveXml() { DataRow dr = Moves.Last.DataRow; if (dr != null) { return(UData.ToString(dr)); } else { return(""); } }
public string GetOnlineGameXml() { DataRow dr = Notations.GetLastRow(); if (dr != null) { return(UData.ToString(dr)); } else { return(""); } }
public void SendAsync(DataTable dt) { try { if (userSession.AsynSocket != null) { byte[] data = System.Text.ASCIIEncoding.ASCII.GetBytes(UData.ToString(dt) + "\0"); userSession.AsynSocket.Send(data); } } catch (Exception ex) { OnServerDownError(ex); } }
public string GetGameXml() { if (GameData == null) { return(""); } if (string.IsNullOrEmpty(GameData.Guid)) { GameData.Guid = System.Guid.NewGuid().ToString(); } GameData.InitialBoardFen = InitialBoardFen; GameData.Moves = UData.ToString(Notations.Game.Moves.DataTable); switch (GameType) { case GameType.Bullet: case GameType.Blitz: case GameType.Rapid: case GameType.NoClock: GameData.OptionsBlitzClock = Ap.OptionsBlitzClock.Kv.ToDataTableString; break; case GameType.Long: GameData.OptionsLongClock = Ap.OptionsLongClock.Kv.ToDataTableString; break; } if (GameMode == GameMode.Kibitzer) { GameData.GameMode = GameMode.HumanVsHuman; } else { GameData.GameMode = GameMode; } GameData.GameType = GameType; ///////////////// GameData.Flags = this.Flags.Flags; GameData.GameResult = this.GameResult; ///////////////// return(UData.ToString(GameData.Kv.DataTable)); }
private void AddGame(Kv kvGame, Kv kvMoves) { GameData gameData = GetGameData(kvGame); Moves moves = GetMoves(kvMoves); if (isPgnToIcbConversion) { GameItem item = new GameItem(gameData, moves); book.ImportGame(item); } else { gameData.Guid = System.Guid.NewGuid().ToString(); gameData.Moves = UData.ToString(moves.DataTable); string gameXml = this.Game.GetGameXml(gameData); Ap.Database.AppendGame(gameXml); } }
private bool SendSync(DataTable dt) { try { if (userSession.SynSocket != null) { byte[] data = System.Text.ASCIIEncoding.ASCII.GetBytes(UData.ToString(dt) + "\0"); userSession.SynSocket.Send(data); } } catch (Exception ex) { OnServerDownError(ex); return(false); } return(true); }
public DataTable UpdateUser() { User item = new User(base.Kv.Cxt, base.Kv.Cxt.CurrentUserID); item.CountryID = CountryID; item.NearestCityID = NearestCityID; item.GenderID = GenderID; item.FideTitleID = FideTitleID; item.IccfTitleID = IccfTitleID; item.Email = Email; item.FirstName = FirstName; item.LastName = LastName; item.PersonalNotes = PersonalNotes; item.Url = Url; if (DateOfBirth != string.Empty) { item.DateOfBirth = Convert.ToDateTime(DateOfBirth);//DateOfBirth; } item.Cxt.CurrentUserID = base.Kv.Cxt.CurrentUserID; item.Save(); if (!string.IsNullOrEmpty(UserImage)) { SaveUserImage(Ap.WebFolderUserImages + item.UserID); } DataTable roles = User.GetRolesTable(item.UserID); Kv kv1 = new Kv(); kv1.Set("MsgId", -1); kv1.Set("UserData", UData.ToString(item.DataRow.Table)); kv1.Set("RolesData", UData.ToString(roles.Copy())); return(kv1.DataTable); }
public string GetGameXml() { if (GameData == null) { return(""); } if (string.IsNullOrEmpty(GameData.Guid)) { GameData.Guid = System.Guid.NewGuid().ToString(); } GameData.InitialBoardFen = InitialBoardFen; GameData.Moves = UData.ToString(Notations.Game.Moves.DataTable); switch (GameType) { case GameType.BulletGame: case GameType.BlitzGame: case GameType.RapidGame: case GameType.NoClock: GameData.OptionsBlitzClock = Ap.OptionsBlitzClock.Kv.ToDataTableString; break; case GameType.LongGame: GameData.OptionsLongClock = Ap.OptionsLongClock.Kv.ToDataTableString; break; } GameData.GameMode = GameMode; GameData.GameType = GameType; return(UData.ToString(GameData.Kv.DataTable)); }
public static string ZipDataSet(DataSet ds) { return(UZip.Zip(UData.ToString(ds))); }
public static string ZipDataTable(DataTable dt) { return(UZip.Zip(UData.ToString(dt))); }
public override string ToString() { return(UData.ToString(this.DataTable)); }
public string ToStringDataTable() { return(UData.ToString(this.DataTable)); }