//Создание двумерного массива для ДатыГрид public static string[,] EventsToMatrix(DateTime date, int importance, out string[] names) { date = date.AddHours(-date.Hour); date = date.AddSeconds(-date.Second); date = date.AddMinutes(-date.Minute); date = date.AddMilliseconds(-date.Millisecond); var matrix = new string[24, 1]; names = new string[1]; names[0] = "Время"; for (var i = 0; i < 24; i++) { matrix[i, 0] = i + ":" + "00"; } for (var repeat = 0; repeat < 4; repeat++) { Dictionaries Dictionaries = WorkWithFiles_Control.ReturnMeanings(repeat); switch (repeat) { case 0: NeverRepeat(date, importance, ref names, Dictionaries, ref matrix); break; case 1: OneDayRepeat(date, importance, ref names, Dictionaries, ref matrix); break; case 2: WeekRepeat(date, importance, ref names, Dictionaries, ref matrix); break; case 3: YearRepeat(date, importance, ref names, Dictionaries, ref matrix); break; } } return(matrix); }
//При закрытие формы private void СозданиеСобытия_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.Cancel) { e.Cancel = false; } else { if (CheckRigthInput()) { WorkWithFiles_Control.AddToClass(ДатаОт.Value, ДатаДо.Value, Напоминание.SelectedIndex, Важность.SelectedIndex, Название.Text, Заметки.Text, Повторы.SelectedIndex); e.Cancel = false; } else { e.Cancel = true; } } }
//Закрытие формы private void СозданиеЗадания_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.Cancel) { e.Cancel = false; } else { if (CheckRightInput()) { WorkWithFiles_Control.AddTask(Название.Text, УсловиеВыполнения.Text); Send.GetTasks = new Tasks(); Send.GetTasks.AddTask(Название.Text, УсловиеВыполнения.Text); e.Cancel = false; } else { e.Cancel = true; } } }
public static void FixDeleteEvent_End( string[] tmp, ref string str, ref DateTime to, out TimeSpan timeSpan, out int i, out DateTime from, out string description, int importance, out bool AllDay) { str = ""; for (var j = 2; j < tmp.Length; j++) { str = string.Concat(str, tmp[j]); if (j + 1 != tmp.Length) { str = string.Concat(str, " "); } } var tmp_i = 0; var dictionaries = new Dictionaries(); from = new DateTime(); for (i = 0; i < 4; i++) { dictionaries = WorkWithFiles_Control.ReturnMeanings(i); try { if (i == 0) { from = GetKeyByValue(dictionaries.ReturnDictionary_Events_To[importance][new OverrideDateTime(to)], WorkWithFiles_Control.ReturnMeanings(i). ReturnDictionary_Events_From[importance]).GetDateTime; if (from.Year != 1) { break; } tmp_i = i; } else { if (from == new DateTime(1, 1, 1) || to == new DateTime(1, 1, 1)) { from = WorkWithFiles_Control.FindElementFrom(str, i, importance).GetDateTime; to = WorkWithFiles_Control.FindElementTo(str, i, importance).GetDateTime; tmp_i = i; } } } catch { } } i = tmp_i; dictionaries = WorkWithFiles_Control.ReturnMeanings(i); var nameArr = dictionaries.ReturnDictionary_Events_To[importance][new OverrideDateTime(to)]; description = null; for (var j = 0; j < nameArr.Return_size; j++) { if (nameArr[j].EventName.CompareTo(str) == 0) { description = nameArr[j].EventDescription; } } timeSpan = to - from; AllDay = false; if (timeSpan.Days == 0 && timeSpan.Hours == 23 && timeSpan.Minutes == 59) { AllDay = true; } var alarmDate = new DateTime(); Dictionary <OverrideDateTime, NameArr>[] alarm = WorkWithFiles_Control.Alarm; foreach (var key in alarm[i].Keys) { if (nameArr.Equals(alarm[i][key])) { alarmDate = key.GetDateTime; break; } } timeSpan = from - alarmDate; WorkWithFiles_Control.DeleteFromClass(i - 1, importance, new Name(str, description), from, to); }