// POST: api/SendDataCel public DataSaved Post([FromBody] WeatherDataCel Wdata) { DataSaved ds; try { int TempInCel = Wdata.TempCel; int TempInFra = (TempInCel * 9 / 5) + 32; string query = "insert into [data] values (" + TempInFra + ", " + TempInCel + ", " + Wdata.Humidity + ", " + Wdata.BroPres + ", GETDATE());"; if (new Connections().ExeCmd(query)) { ds = new DataSaved() { Saved = true }; } else { ds = new DataSaved() { Saved = false }; } return(ds); } catch (Exception ex) { ds = new DataSaved() { Saved = false }; return(ds); } }
/// <summary> /// Сохранение файла в базу. /// </summary> public void DocumentSaveToSql(IDocument doc) { using (dB.Connection = new SqlConnection(dB.stringConnection)) { try { dB.Connection.Open(); SqlCommand command = new SqlCommand("InsertDocument", dB.Connection) { // вызываем хп CommandType = CommandType.StoredProcedure }; command.Parameters.Add(new SqlParameter("@docname", doc.DocumentName)); command.Parameters.Add(new SqlParameter("@date", doc.CreateDate)); command.Parameters.Add(new SqlParameter("@type", doc.DocType)); command.Parameters.Add(new SqlParameter("@UserID", doc.UserID)); //файл command.Parameters.Add(new SqlParameter("@FileID", doc.BinaryFile.FileGuid)); command.Parameters.Add(new SqlParameter("@Binary", doc.BinaryFile.Data)); command.Parameters.Add(new SqlParameter("@DocID", doc.BinaryFile.DocumentId)); command.Parameters.Add(new SqlParameter("@FileExtension", doc.BinaryFile.FileExtension)); var result = command.ExecuteNonQuery(); // кидаем событие об успешной записи в базу. DataSaved?.Invoke(this, EventArgs.Empty); } catch (SqlException ex) { Console.Error.WriteLine(ex.Message); } finally { dB.Connection.Close(); } // Подключаемся к базе } }
public static void Load() { Debug.Log("start"); if (SaveSystem.LoadData() != null) { DataSaved data = SaveSystem.LoadData(); bool[] checkers = data.GetBooleans(); float[] stats = data.GetStats(); move = checkers[0]; newGame = checkers[1]; trainingLvl = checkers[2]; lvl1 = checkers[3]; lvl2 = checkers[4]; lvl3 = checkers[5]; teleport = checkers[6]; playerHealth = stats[0]; tpTime = stats[1]; playerDamage = stats[2]; alienBossHealth = stats[3]; skeletonBossHealth = stats[4]; } else { Debug.Log("not not"); } }
void OnDisable() { DataSaved ds = new DataSaved(); ds.textureSaveDataList = textureSaveDateList; dataPrefsFile.SaveData(ds, "Data.dat"); }
// Start is called before the first frame update void Start() { finaltime = DataSaved.getTime(); string minutes = ((int)finaltime / 60).ToString(); string seconds = (finaltime % 60).ToString("f2"); FinalTime.text = minutes + ":" + seconds; }
// Start is called before the first frame update void Start() { playerCam = Camera.main; rb = GetComponent <Rigidbody>(); distToFloor = GetComponent <Collider>().bounds.extents.y; playerSounds = GetComponent <AudioSource>(); DataSaved.setLastSceneName(SceneManager.GetActiveScene()); }
public void Save() { Logger.Log("Saving " + Username + " to the database", LogType.Debug); List <string> commands = new List <string>(); commands.Add("UPDATE _players SET money=" + Money + ", lastlogin='******', firstlogin='******' WHERE UID=" + UID); commands.Add("UPDATE _players SET color='" + Color.SqlEscape() + "' WHERE UID=" + UID); DataSaved.Call(this, new DataSavedEventArgs(UID)); Database.executeQuery(commands.ToArray()); }
public static void SaveData() { Debug.Log("SSS"); Debug.Log(Application.persistentDataPath); BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(Application.persistentDataPath + "/Data.sav", FileMode.Create); DataSaved dataSaved = new DataSaved(); formatter.Serialize(stream, dataSaved); stream.Position = 0;// stream.Close(); }
// Update is called once per frame void Update() { lvlTime -= Time.deltaTime; string minutes = ((int)lvlTime / 60).ToString(); string seconds = (lvlTime % 60).ToString("f2"); Clock.text = minutes + ":" + seconds; if (lvlTime < 0) { timeOut(); } DataSaved.setTime(lvlTime); }
public static DataSaved LoadData() { string path = Application.persistentDataPath + "/Data.sav"; if (File.Exists(path)) { Debug.Log("EE"); BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Open); stream.Position = 0; // formatter.Deserialize(stream); DataSaved data = formatter.Deserialize(stream) as DataSaved; stream.Position = 0; stream.Close(); return(data); } else { Debug.LogError("Save file not found in " + path); return(null); } }
protected virtual void OnDataSaved() { DataSaved?.Invoke(this, EventArgs.Empty); }
public void Save() { DataSaved?.Invoke(this, new EventArgs()); SettingsNotSaved = false; }
private bool SaveData() { try { BeforeDataSave?.Invoke(this, new EventArgs()); this.PostEditor(); if (dxValidationProvider != null) { if (!dxValidationProvider.Validate()) { return(false); } } if (this.DataContext != null) { this.ShowProgressPanel(); this.DataContext.SubmitChanges(ConflictMode.ContinueOnConflict); this.SetMode(Mode.Default); } DataSaved?.Invoke(this, new EventArgs()); return(true); } catch (ChangeConflictException e) { this.CloseProgressPanel(); ucConflicts ucConflicts = new ucConflicts(); if (this.DataContext.ChangeConflicts.Count > 0) { foreach (System.Data.Linq.ObjectChangeConflict objectChangeConflict in this.DataContext.ChangeConflicts) { if (objectChangeConflict.IsDeleted) { Conflict conflict = new Conflict(); conflict.Message = "Der Datensatz existiert nicht mehr"; conflict.RefreshMode = RefreshMode.KeepChanges; ucConflicts.Conflicts.Add(conflict); //Database.tsysClient client = this.DataContext.ChangeConflicts[0].Object as Database.tsysClient; //XtraMessageBox.Show(System.String.Format("Der Datensatz <b>\"{0}\"</b> existiert in der Datenbank nicht mehr.", client.Name), "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, DevExpress.Utils.DefaultBoolean.True); } else if (objectChangeConflict.MemberConflicts.Count > 0 && objectChangeConflict.MemberConflicts[0].IsModified) { Conflict conflict = new Conflict(); conflict.Message = "Der Datensatz wurde in der Datenbank geändert"; conflict.RefreshMode = RefreshMode.KeepChanges; ucConflicts.Conflicts.Add(conflict); //Database.tsysClient client = this.DataContext.ChangeConflicts[0].Object as Database.tsysClient; //XtraMessageBox.Show( // System.String.Format( // "Der Datensatz <b>\"{0}\"</b> wurde in der Datenbank geändert. Datenbankwert: {2}, Neuer Wert: {1}", // this.DataContext.ChangeConflicts[0].MemberConflicts[0].Member.Name, // this.DataContext.ChangeConflicts[0].MemberConflicts[0].CurrentValue, // this.DataContext.ChangeConflicts[0].MemberConflicts[0].DatabaseValue), // "Fehler", // MessageBoxButtons.OK, // MessageBoxIcon.Exclamation, // DevExpress.Utils.DefaultBoolean.True); } } //this.DataContext.ChangeConflicts.ResolveAll(RefreshMode.KeepChanges); frmConflict frm = new frmConflict(ucConflicts); frm.ShowDialog(); } return(false); } catch (SqlException exception) { this.CloseProgressPanel(); if (exception.Number == 547) // Constraint error { XtraMessageBox.Show("Datensatz wird noch von anderer Stelle referenziert und kann daher nicht gelöscht werden.", "Hinweis", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { XtraMessageBox.Show(exception.ToString(), "Hinweis", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } return(false); } catch (Exception err) { this.CloseProgressPanel(); XtraMessageBox.Show(err.ToString(), "Hinweis", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } finally { this.CloseProgressPanel(); } }
public void replayLastLevel() { lastBeat = DataSaved.getLastSceneName(); load(lastBeat); }
protected virtual void OnDataSaved(ActionEventArgs e) { DataSaved?.Invoke(this, e); }