private void AddNewAutoGenerate_Click(object sender, RoutedEventArgs e) { AutoGenerateDetailsWindow dlg = new AutoGenerateDetailsWindow(); dlg.Owner = this; dlg.WindowStartupLocation = WindowStartupLocation.CenterOwner; dlg.theAutoGenerate.Id = 0; dlg.theAutoGenerate.Order = SQLiteClass.ExecuteSelectMaxAutoGenerate(SQLiteClass.dbpath) + 1; dlg.theAutoGenerate.Type = (Int64)ListAutoGenerate.TypeName.A_Day_Of_Every_Month; dlg.theAutoGenerate.Name = "Auto Generated Task"; dlg.theAutoGenerate.Priority = "\u272e\u272e\u272e\u272e\u272e"; dlg.theAutoGenerate.Template = 0; dlg.theAutoGenerate.Number0 = 1; dlg.theAutoGenerate.Number1 = 0; dlg.theAutoGenerate.Due_hour = 17; dlg.theAutoGenerate.Due_minute = 0; if (dlg.ShowDialog() == true) { dlg.theAutoGenerate.Checked_date = (DateTime.UtcNow - new TimeSpan(1, 0, 0, 0)).ToString("yyyy-MM-dd HH:mm:ss"); saveOrderOfAutoGelerate(SQLiteClass.dbpath, AutoGenerateListViewModel.aglv); SQLiteClass.ExecuteInsertTableAutoGenerate(SQLiteClass.dbpath, dlg.theAutoGenerate); AutoGenerateListViewModel.aglv.Entries.Clear(); SQLiteClass.ExecuteSelectTableAutoGenerate(SQLiteClass.dbpath, AutoGenerateListViewModel.aglv); } }
private void EditTheAutoGenerate_Click(object sender, RoutedEventArgs e) { int ind = AutoGenerateList.SelectedIndex; if (ind >= 0) { AutoGenerateDetailsWindow dlg = new AutoGenerateDetailsWindow(); dlg.Owner = this; dlg.WindowStartupLocation = WindowStartupLocation.CenterOwner; dlg.theAutoGenerate.Id = AutoGenerateListViewModel.aglv.Entries[ind].Id; dlg.theAutoGenerate.Order = AutoGenerateListViewModel.aglv.Entries[ind].Order; dlg.theAutoGenerate.Type = AutoGenerateListViewModel.aglv.Entries[ind].Type; dlg.theAutoGenerate.Name = AutoGenerateListViewModel.aglv.Entries[ind].Name; dlg.theAutoGenerate.Priority = AutoGenerateListViewModel.aglv.Entries[ind].Priority; dlg.theAutoGenerate.Template = AutoGenerateListViewModel.aglv.Entries[ind].Template; dlg.theAutoGenerate.Number0 = AutoGenerateListViewModel.aglv.Entries[ind].Number0; dlg.theAutoGenerate.Number1 = AutoGenerateListViewModel.aglv.Entries[ind].Number1; dlg.theAutoGenerate.Due_hour = AutoGenerateListViewModel.aglv.Entries[ind].Due_hour; dlg.theAutoGenerate.Due_minute = AutoGenerateListViewModel.aglv.Entries[ind].Due_minute; if (dlg.ShowDialog() == true) { AutoGenerateListViewModel.aglv.Entries[ind].Id = dlg.theAutoGenerate.Id; AutoGenerateListViewModel.aglv.Entries[ind].Order = dlg.theAutoGenerate.Order; AutoGenerateListViewModel.aglv.Entries[ind].Type = dlg.theAutoGenerate.Type; AutoGenerateListViewModel.aglv.Entries[ind].Name = dlg.theAutoGenerate.Name; AutoGenerateListViewModel.aglv.Entries[ind].Priority = dlg.theAutoGenerate.Priority; AutoGenerateListViewModel.aglv.Entries[ind].Template = dlg.theAutoGenerate.Template; AutoGenerateListViewModel.aglv.Entries[ind].Number0 = dlg.theAutoGenerate.Number0; AutoGenerateListViewModel.aglv.Entries[ind].Number1 = dlg.theAutoGenerate.Number1; AutoGenerateListViewModel.aglv.Entries[ind].Due_hour = dlg.theAutoGenerate.Due_hour; AutoGenerateListViewModel.aglv.Entries[ind].Due_minute = dlg.theAutoGenerate.Due_minute; // update is also executed saveOrderOfAutoGelerate(SQLiteClass.dbpath, AutoGenerateListViewModel.aglv); AutoGenerateListViewModel.aglv.Entries.Clear(); SQLiteClass.ExecuteSelectTableAutoGenerate(SQLiteClass.dbpath, AutoGenerateListViewModel.aglv); } } }