private string ValidateAddDate() { if (AddDate.ToString("dd-MM-yyyy") == "01-01-0001") { return("Дата добавления не указана"); } return(null); }
public MainView() { InitializeComponent(); button1.Click += (sender, args) => AddDate?.Invoke(this, EventArgs.Empty); button2.Click += (sender, args) => ShowDetails?.Invoke(this, EventArgs.Empty); textBox1.TextChanged += (sender, args) => { textBox1.DataBindings[0].WriteValue(); NameChanged?.Invoke(this, EventArgs.Empty); }; }
public override string ToString() { string output = ""; if (IsPriority) { output += "[PRIORITY]"; } output += "\n" + Content + "\n(Added on: " + AddDate.ToLongDateString(); if (!DateTime.Equals(DateTime.MaxValue.Date, DueDate.Date)) { output += "; Due date: " + DueDate.ToLongDateString(); } output += ")"; return(output); }
private void SAveAdd_Click(object sender, EventArgs e) { string query = ""; int AnnonceKey = ((KeyValuePair <int, string>)AnnonceCombo.SelectedItem).Key; String AnnounceValue = ((KeyValuePair <int, string>)AnnonceCombo.SelectedItem).Value; if (AddStafID.Text.Trim() == "") { MessageBox.Show("Please Enter Staff ID"); AddStafID.Focus(); return; } if (AnnonceKey < 1) { MessageBox.Show("Please Enter Announce Type"); AnnonceCombo.Focus(); return; } if (AddDate.Text == "") { MessageBox.Show("Please Enter Announce Date"); AddDate.Focus(); return; } if (Addsubject.Text.Trim() == "") { MessageBox.Show("Please Enter Subject"); Addsubject.Focus(); return; } if (AddDescription.Text.Trim() == "") { MessageBox.Show("Please Add Description "); AddDescription.Focus(); return; } try { if (hidebox.Text == "") { query = "INSERT INTO Announcement_Info(StaffID,AnnounceType,Date,Subject,Description) VALUES(" + Convert.ToInt32(AddStafID.Text) + ", '" + AnnounceValue + "', '" + AddDate.Value.ToString("yyyy/MM/dd") + "', '" + Addsubject.Text + "', '" + AddDescription.Text + "' )"; } else { query = "UPDATE Announcement_Info SET AnnounceType = '" + AnnounceValue + "', Date = '" + AddDate.Text + "', Subject= '" + Addsubject.Text + "',Description = '" + Addsubject.Text + "' WHERE Id = " + Convert.ToInt32(hidebox.Text); } if (DbAccess.ExecuteToDB(query)) { if (hidebox.Text == "") { MessageBox.Show("Saved Successfully!!!"); } else { MessageBox.Show("Updated Successfully!!!"); } } else { MessageBox.Show("Failed To Save!!!"); } } catch (Exception ex) { MessageBox.Show("Connection Error!!!"); } finally { Reset(); } }
private bool CheckParameters() { bool isCorrect = true; if (ConnectionString.Contains('=')) { ; //we only very roufly checking correctnes of connection string. //We will make sure if it is correct during connection to database. } else { errorDesctiption += "connection string: \"" + ConnectionString + "\" is not proper" + Environment.NewLine; errorDesctiption += "Issue Code: E005" + Environment.NewLine; isCorrect = false; } if (Directory.Exists(OutDirectory) && hasWriteAccessToFolder(OutDirectory)) { } else { errorDesctiption += "output directory: " + OutDirectory + " is not proper, "; errorDesctiption += "patch does not exist or access is not allowed" + Environment.NewLine; errorDesctiption += "Issue Code: E006" + Environment.NewLine; isCorrect = false; } if (TimeOut >= 0 && TimeOut < 86400) { } else { errorDesctiption += "TimeOut value: " + TimeOut + " is not proper, "; errorDesctiption += "it should be value between 0 and 86400, 0 means that timeout is not changed" + Environment.NewLine; errorDesctiption += "(taken from connection string or database configuration)" + Environment.NewLine; errorDesctiption += "Issue Code: E007b" + Environment.NewLine; isCorrect = false; } if (DropboxDelay >= 0 && DropboxDelay < 3600) { } else { errorDesctiption += "timeout value: " + DropboxDelay + " is not proper, "; errorDesctiption += "it should be value between 0 and 3600, 0 means that there is no delay" + Environment.NewLine;; errorDesctiption += "Issue Code: E008b" + Environment.NewLine; isCorrect = false; } if (AddDate.ToUpper() == "YES" || AddDate.ToUpper() == "NO") { } else { errorDesctiption += "AddDate value: " + AddDate + " is not proper, "; errorDesctiption += "it should be YES or NO" + Environment.NewLine;; errorDesctiption += "Issue Code: E009" + Environment.NewLine; isCorrect = false; } if (hasWriteAccessToFile(BussinessLogFile) == true) { } else { errorDesctiption += "Business Log File: " + BussinessLogFile + " is not avaible to write, "; errorDesctiption += "you have to put file that is available to write for KKrReporter"; errorDesctiption += Environment.NewLine;; errorDesctiption += "Issue Code: E010a" + Environment.NewLine; isCorrect = false; } if (hasWriteAccessToFile(ExceptionLogFile) == true) { } else { errorDesctiption += "Exception Log File: " + ExceptionLogFile + " is not avaible to write, "; errorDesctiption += "you have to put file that is available to write for KKrReporter"; errorDesctiption += Environment.NewLine;; errorDesctiption += "Issue Code: E010b" + Environment.NewLine; isCorrect = false; } if (isCorrect) { return(true); } else { return(false); } }