private void SaveBtn_Click(object sender, RoutedEventArgs e) { if (TitleTxt.Text == "") { l1.Foreground = new SolidColorBrush(Colors.Red); } else { l1.Foreground = new SolidColorBrush(Colors.Black); } if (TenderNumberTxt.Text == "") { l2.Foreground = new SolidColorBrush(Colors.Red); } else { l2.Foreground = new SolidColorBrush(Colors.Black); } if (datePicker1.SelectedDate == null) { l3.Foreground = new SolidColorBrush(Colors.Red); } else { l3.Foreground = new SolidColorBrush(Colors.Black); } if (HourTxt.Text == "" || MinuteTxt.Text == "" || (int.Parse)(HourTxt.Text) > 23 || (int.Parse)(HourTxt.Text) < 0 || (int.Parse)(MinuteTxt.Text) > 59 || (int.Parse)(MinuteTxt.Text) < 0) { l4.Foreground = new SolidColorBrush(Colors.Red); } else { l4.Foreground = new SolidColorBrush(Colors.Black); } if (Grid2.Items.Count == 0) { l5.Foreground = new SolidColorBrush(Colors.Red); } else { l5.Foreground = new SolidColorBrush(Colors.Black); } if (TitleTxt.Text == "" || TenderNumberTxt.Text == "" || datePicker1.SelectedDate == null || HourTxt.Text == "" || MinuteTxt.Text == "" || Grid2.Items.Count == 0) { ErrorHandler.NotifyUser("برخی اطلاعات ضروری وارد نشده اند"); return; } if ((int.Parse)(HourTxt.Text) > 23 || (int.Parse)(HourTxt.Text) < 0 || (int.Parse)(MinuteTxt.Text) > 59 || (int.Parse)(MinuteTxt.Text) < 0) { ErrorHandler.NotifyUser("ساعت نادرست وارد شده است"); return; } var d = (DateTime)datePicker1.SelectedDate; DateTime date = new DateTime(d.Year, d.Month, d.Day, Int32.Parse(HourTxt.Text), Int32.Parse(MinuteTxt.Text), 0); CurrentEvaluation.MeetingDate = date; if (CurrentEvaluation.EvaluationId == 0) { try { DataManagement.CreateEvaluation(CurrentEvaluation, Grid2.Items.Cast <User>().ToList()); ErrorHandler.NotifyUser("ثبت موفقیت آمیز بود"); } catch { ErrorHandler.NotifyUser("ثبت با شکست مواجه شد"); } } else { try { DataManagement.UpdateEvaluation(CurrentEvaluation, Grid2.Items.Cast <User>().ToList()); ErrorHandler.NotifyUser("ثبت موفقیت آمیز بود"); } catch { ErrorHandler.NotifyUser("ثبت با شکست مواجه شد"); } } }