} //debuged public void auto_save_new() { DateTime thisDay = DateTime.Now; List <string> Sessions = TranslationTools.GetSessionNames(); string name = "Auto Save " + thisDay.ToString(); for (int i = 0; i < Sessions.Count; i++) { if (Sessions[i].Equals(name, StringComparison.CurrentCultureIgnoreCase)) { return; } } int Id; for (int i = 0; i < tempList.Count; i++) { TranslationTools.InsertImagePath(tempList[i]); Id = TranslationTools.GetLastId(); //gets the inserted ID of InsertImagePath TranslationTools.InsertSessionWAuto(name, Id); //creates a session TranslationTools.InsertScript(tempList[i], Id); //associates the Id of the images table to the text } string a = GetAutoSaves(); if (a != "") { TranslationTools.DeleteSession(a); } //TranslationTools.FillDropDownSessions("SELECT DISTINCT NameSession from Session;", comboSession); }
private void btn_delete_session_Click(object sender, EventArgs e) { if (comboSession.SelectedItem == null) { MessageBox.Show("Select a session"); return; } TranslationTools.DeleteSession(comboSession.Text); TranslationTools.FillDropDownSessions("SELECT DISTINCT NameSession from Session;", comboSession); }
private void btn_save_session_Click(object sender, EventArgs e) { if (comboSession.SelectedItem == null) { MessageBox.Show("Select a session"); return; } string name = comboSession.Text; if (IsAutoSave(name)) { MessageBox.Show("You can't overwrite Auto Saves!"); return; } if (rich_Original.TextLength > 0 | rich_Translated.TextLength > 0) { SaveThis(); } CloneList(myList, tempList); //TranslationTools.DeleteDataFromTables(); //1º apagar todos os dados da sessão que se vai salvar TranslationTools.DeleteSession(name); //2º invocar a função new session, é provavelmente melhor copiar porque se o //primeiro passo foi bem sucessido, o nome não existe int Id; for (int i = 0; i < myList.Count; i++) { TranslationTools.InsertImagePath(myList[i]); Id = TranslationTools.GetLastId(); //gets the inserted ID of InsertImagePath TranslationTools.InsertSession(name, Id); //creates a session TranslationTools.InsertScript(myList[i], Id); //associates the Id of the images table to the text } //REFRESH THE SESSION LIST (comboSession) }