public FormMemberSelect() { InitializeComponent(); try { using (var context = new LorikeetAppEntities()) { var listItemMemberNames = (from m in context.Members select m).ToList(); if (listItemMemberNames != null) { foreach (var names in listItemMemberNames) { comboBoxEditMemberNames.Properties.Items.Add(names.FirstName + " " + names.Surname); } } } } catch { DialogResult = DialogResult.Cancel; this.Close(); } }
private void simpleButtonMedicationDelete_Click(object sender, EventArgs e) { if (listBoxMedications.SelectedItems.Count > 0) { try { using (var context = new LorikeetAppEntities()) { var itemSelected = listBoxMedications.GetItemText(listBoxMedications.SelectedItem); var medsToDelete = (from m in context.MedicationNames where m.MedicationName1 == itemSelected select m).DefaultIfEmpty().First(); if (medsToDelete != null) { context.MedicationNames.Remove(medsToDelete); context.SaveChanges(); } Logging.AddLogEntry(staffID, Logging.ErrorCodes.Broadcast, Logging.RefreshCodes.Medication, "Medication Name - " + textBoxMedication.Text + " was deleted", false); } RefreshListBoxes(); } catch (Exception ex) { Logging.AddLogEntry(staffID, Logging.ErrorCodes.Error, Logging.RefreshCodes.None, "Medication Name - " + textBoxMedication.Text + " was not deleted - Error - " + ex.Message, false); MessageBox.Show(ex.Message); } } }
private void simpleButtonDiagnosisEdit_Click(object sender, EventArgs e) { if (textBoxDiagnosis.Text.Count() > 0 && listBoxDiagnosis.SelectedItems.Count > 0) { try { using (var context = new LorikeetAppEntities()) { var itemSelected = listBoxDiagnosis.GetItemText(listBoxDiagnosis.SelectedItem); var diagnosisToEdit = (from m in context.DiagnosisNames where m.DiagnosisName1 == itemSelected select m).DefaultIfEmpty().First(); if (diagnosisToEdit != null) { diagnosisToEdit.DiagnosisName1 = textBoxDiagnosis.Text; context.SaveChanges(); } } Logging.AddLogEntry(staffID, Logging.ErrorCodes.Broadcast, Logging.RefreshCodes.Diagnosis, "Diagnosis Name - " + textBoxDiagnosis.Text + " was edited", false); textBoxDiagnosis.Text = ""; RefreshListBoxes(); } catch (Exception ex) { Logging.AddLogEntry(staffID, Logging.ErrorCodes.Error, Logging.RefreshCodes.None, "Diagnosis Name - " + textBoxDiagnosis.Text + " was not edited - " + ex.Message, false); MessageBox.Show(ex.Message); } } }
private void bbiDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (idSelected != -1) { using (var context = new LorikeetAppEntities()) { var contactToDelete = (from c in context.Contacts where c.ContactID == idSelected select c).DefaultIfEmpty().First(); context.Contacts.Remove(contactToDelete); context.SaveChanges(); } Logging.AddLogEntry(staffID, Logging.ErrorCodes.Broadcast, Logging.RefreshCodes.Contact, "Contact - " + textBoxName.Text + " was deleted", false); RefreshContactTable(); ClearTextBoxes(); } } catch (Exception ex) { Logging.AddLogEntry(staffID, Logging.ErrorCodes.Error, Logging.RefreshCodes.None, "Error in deleting a contact - " + ex.Message, false); MessageBox.Show(ex.Message); } }
private void bbiAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (textBoxType.Text != "" && textBoxName.Text != "" && textBoxAddress.Text != "" && textBoxPhone.Text != "") { try { using (var context = new LorikeetAppEntities()) { Contact contactToAdd = new Contact(); contactToAdd.ContactAddress = textBoxAddress.Text; contactToAdd.ContactName = textBoxName.Text; contactToAdd.ContactPhone = textBoxPhone.Text; contactToAdd.ContactType = textBoxType.Text; contactToAdd.MemberID = memberID; context.Contacts.Add(contactToAdd); context.SaveChanges(); } Logging.AddLogEntry(staffID, Logging.ErrorCodes.Broadcast, Logging.RefreshCodes.Contact, "Contact - " + textBoxName.Text + " was added", false); } catch (Exception ex) { Logging.AddLogEntry(staffID, Logging.ErrorCodes.Error, Logging.RefreshCodes.None, "Error in adding a contact - " + ex.Message, false); MessageBox.Show(ex.Message); } ClearTextBoxes(); RefreshContactTable(); } }
private void RefreshUserListBox() { try { using (var context = new LorikeetAppEntities()) { listBoxUsers.Items.Clear(); var usernames = (from log in context.Logins join staff in context.Staffs on log.LoginID equals staff.LoginID select new { staff, log }).ToList(); string staffName = MiscStuff.GetStaffName(staffID); foreach (var name in usernames) { if (access == 10) { listBoxUsers.Items.Add(name.staff.StaffName); } else if ((access == 8 && staffName.Equals(name.staff.StaffName)) || name.log.Access <= 6) { listBoxUsers.Items.Add(name.staff.StaffName); } else if (access == 6 && staffName.Equals(name.staff.StaffName)) { listBoxUsers.Items.Add(name.staff.StaffName); } } } } catch { } }
private void bbiEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (textBoxType.Text != "" && textBoxName.Text != "" && textBoxAddress.Text != "" && textBoxPhone.Text != "" && idSelected != -1) { try { using (var context = new LorikeetAppEntities()) { Contact contactToAdd = new Contact(); contactToAdd = (from c in context.Contacts where c.ContactID == idSelected select c).DefaultIfEmpty().First(); if (contactToAdd != null) { contactToAdd.ContactAddress = textBoxAddress.Text; contactToAdd.ContactName = textBoxName.Text; contactToAdd.ContactPhone = textBoxPhone.Text; contactToAdd.ContactType = textBoxType.Text; context.SaveChanges(); } Logging.AddLogEntry(staffID, Logging.ErrorCodes.Broadcast, Logging.RefreshCodes.Contact, "Contact - " + textBoxName.Text + " was edited", false); } } catch (Exception ex) { Logging.AddLogEntry(staffID, Logging.ErrorCodes.Error, Logging.RefreshCodes.None, "Error in editing a contact - " + ex.Message, false); MessageBox.Show(ex.Message); } ClearTextBoxes(); RefreshContactTable(); } }
public static string GetMemberName(int memberID) { try { using (var context = new LorikeetAppEntities()) { var memberName = (from m in context.Members where m.MemberID == memberID select m).DefaultIfEmpty().First(); if (memberName != null) { return(memberName.FirstName + " " + memberName.Surname); } else { return(null); } } } catch (Exception ex) { MessageBox.Show(GetAllMessages(ex)); return(null); } }
private void bbiAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (textBoxAddNote.Text != "") { try { using (var context = new LorikeetAppEntities()) { var noteToAdd = new Note(); noteToAdd.Date = dateEditNote.DateTime; noteToAdd.Editable = true; noteToAdd.MemberID = memberID; noteToAdd.Notes = textBoxAddNote.Text; noteToAdd.StaffID = this.staffID; context.Notes.Add(noteToAdd); context.SaveChanges(); } Logging.AddLogEntry(staffID, Logging.ErrorCodes.Broadcast, Logging.RefreshCodes.Notes, "Notes on " + MiscStuff.GetMemberName(memberID) + " has been added", false); } catch (Exception ex) { Logging.AddLogEntry(staffID, Logging.ErrorCodes.Error, Logging.RefreshCodes.None, "Notes on " + MiscStuff.GetMemberName(memberID) + " has not been added - Error - " + ex.Message, false); MessageBox.Show(ex.Message); } RefreshNotesGrid(); textBoxAddNote.Text = ""; bbiAdd.Enabled = false; bbiEdit.Enabled = false; bbiDelete.Enabled = false; } }
public static string GetStaffName(int staffID) { try { using (var context = new LorikeetAppEntities()) { var staffName = (from s in context.Staffs where s.StaffID == staffID select s).DefaultIfEmpty().First(); if (staffName != null) { return(staffName.StaffName); } else { return(null); } } } catch (Exception ex) { MessageBox.Show(GetAllMessages(ex)); return(null); } }
public static int GetAccessLevel(int staffID) { try { using (var context = new LorikeetAppEntities()) { var accessLevel = (from l in context.Logins join s in context.Staffs on l.LoginID equals s.LoginID where s.StaffID == staffID select l.Access).FirstOrDefault(); if (accessLevel != null) { return(accessLevel.Value); } else { return(-1); } } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); } return(0); }
public static int GetMemberID(string name) { try { using (var context = new LorikeetAppEntities()) { string[] wholeName = name.Split(' '); string firstName = wholeName[0]; string surname = wholeName[1]; var memberName = (from m in context.Members where m.FirstName == firstName && m.Surname.Contains(surname) select m).DefaultIfEmpty().First(); if (memberName != null) { return(memberName.MemberID); } else { return(-1); } } } catch (Exception ex) { MessageBox.Show(GetAllMessages(ex)); return(-1); } }
private void buttonAdd_Click(object sender, EventArgs e) { try { using (var context = new LorikeetAppEntities()) { if (listBoxMedication.SelectedIndex != -1) { var medicationToRemove = listBoxMedication.SelectedItem.ToString(); MedicationName medicationTemp = (from d in context.MedicationNames where d.MedicationName1 == medicationToRemove select d).DefaultIfEmpty().First(); if (medicationTemp != null) { medicationToAdd.Add(medicationTemp); medication.RemoveAt(listBoxMedication.SelectedIndex); RefreshMedication(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button2_Click(object sender, EventArgs e) { try { using (var context = new LorikeetAppEntities()) { var memberChosen = comboBoxEditMemberNames.SelectedItem.ToString().Split(' '); var firstName = memberChosen[0]; var surname = memberChosen[1]; var memberIDSelected = (from m in context.Members where m.FirstName == firstName && m.Surname == surname select m).DefaultIfEmpty().First(); if (memberIDSelected != null) { this.memberID = memberIDSelected.MemberID; DialogResult = DialogResult.OK; this.Close(); } } } catch { DialogResult = DialogResult.Cancel; this.Close(); } }
private void GetAttendanceNumber() { try { DateTime todaysDate; if (DateTime.TryParse(dateEditEditAttendance.Text, out todaysDate)) { using (var context = new LorikeetAppEntities()) { var attendanceNumber = (from a in context.AttendanceNumbers where DbFunctions.TruncateTime(a.Date) == todaysDate.Date select a).DefaultIfEmpty().First(); if (attendanceNumber != null) { textBoxNumber.Text = attendanceNumber.Number.ToString(); } else { textBoxNumber.Text = "0"; } } } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); } }
private void buttonAdd_Click(object sender, EventArgs e) { try { using (var context = new LorikeetAppEntities()) { if (listBoxDiagnosis.SelectedIndex != -1) { var diagnosisToRemove = listBoxDiagnosis.SelectedItem.ToString(); DiagnosisName diagnosisTemp = (from d in context.DiagnosisNames where d.DiagnosisName1 == diagnosisToRemove select d).DefaultIfEmpty().First(); if (diagnosisTemp != null) { diagnosisToAdd.Add(diagnosisTemp); diagnosis.RemoveAt(listBoxDiagnosis.SelectedIndex); RefreshDiagnosis(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void listBoxUsers_SelectedIndexChanged(object sender, EventArgs e) { try { string curItem = listBoxUsers.SelectedItem.ToString(); using (var context = new LorikeetAppEntities()) { var userSelected = (from log in context.Logins join staff in context.Staffs on log.LoginID equals staff.LoginID where staff.StaffName == curItem select new { log, staff }).FirstOrDefault(); if (userSelected != null) { textBoxEnterPass.Text = userSelected.log.LoginPass; textBoxReEnterPass.Text = userSelected.log.LoginPass; textBoxLoginName.Text = userSelected.log.LoginName; textBoxUserName.Text = userSelected.staff.StaffName; textBoxPIN.Text = userSelected.log.Pin.ToString(); comboBoxAccess.Text = userSelected.log.Access.ToString(); bbiEditUser.Enabled = true; } } } catch { } }
private void simpleButtonMedicationAdd_Click(object sender, EventArgs e) { if (textBoxMedication.Text.Count() > 0) { try { using (var context = new LorikeetAppEntities()) { if (textBoxMedication.Text != "") { var medsToAdd = new MedicationName(); medsToAdd.MedicationName1 = textBoxMedication.Text; context.MedicationNames.Add(medsToAdd); context.SaveChanges(); Logging.AddLogEntry(staffID, Logging.ErrorCodes.Broadcast, Logging.RefreshCodes.Medication, "Medication Name - " + textBoxMedication.Text + " was added", false); RefreshListBoxes(); } } } catch (Exception ex) { Logging.AddLogEntry(staffID, Logging.ErrorCodes.Error, Logging.RefreshCodes.None, "Medication Name - " + textBoxMedication.Text + " was not added - Error - " + ex.Message, false); MessageBox.Show(ex.Message); } } }
private void UpdateLabelsList() { try { using (var context = new LorikeetAppEntities()) { var labelsToAddToList = (from l in context.Labels select l).ToList(); if (labelsToAddToList.Any()) { foreach (var labels in labelsToAddToList) { comboBoxEditLabels.Properties.Items.Add(labels.DisplayName); } } } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); } comboBoxEditLabels.SelectedIndex = 0; }
private void GetActivityNumbers() { try { DateTime todaysDate; if (DateTime.TryParse(dateEditEditActivity.Text, out todaysDate)) { using (var context = new LorikeetAppEntities()) { var activityNumber = (from a in context.AppointmentsNumbers join l in context.Labels on a.LabelID equals l.LabelID where DbFunctions.TruncateTime(a.Date) == todaysDate.Date && l.DisplayName == comboBoxEditLabels.Text select a).DefaultIfEmpty().First(); if (activityNumber != null) { textBoxNumber.Text = activityNumber.Number.ToString(); } else { textBoxNumber.Text = "0"; } } } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); } }
private void RefreshMembers() { listBoxControlMembers.Items.Clear(); listBoxControlMembersToAdd.Items.Clear(); using (var context = new LorikeetAppEntities()) { try { if (members != null) { foreach (var m in members) { if ((m.FirstName + " " + m.Surname).ToLower().StartsWith(textBoxMemberFilter.Text.ToLower())) { listBoxControlMembers.Items.Add((m.FirstName + " " + m.Surname)); } } } if (membersToAdd != null) { foreach (var m in membersToAdd) { listBoxControlMembersToAdd.Items.Add((m.FirstName + " " + m.Surname)); } } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(MiscStuff.GetAllMessages(ex)); } } }
private bool checkIfAppointmentExists(string appointmentName, DateTime date) { try { using (var context = new LorikeetAppEntities()) { var checkIfAppointmentExists = (from app in context.Appointments where app.Subject == appointmentName && DbFunctions.TruncateTime(app.StartDate) == DbFunctions.TruncateTime(date) select app).FirstOrDefault(); if (checkIfAppointmentExists == null) { return(false); } else { return(true); } } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); } return(false); }
private void buttonLogin_Click(object sender, EventArgs e) { try { using (var context = new LorikeetAppEntities()) { var validLogin = (from s in context.Staffs join l in context.Logins on s.LoginID equals l.LoginID where l.LoginName == textBoxUsername.Text && l.LoginPass == textBoxPassword.Text select s).DefaultIfEmpty().First(); if (validLogin != null) { DialogResult = DialogResult.OK; this.staffID = validLogin.StaffID; this.Close(); } else { MessageBox.Show("Not a Valid Login and Password"); DialogResult = DialogResult.Cancel; this.Close(); } } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); } }
private void RefreshMemberListBox() { listBoxAllMemberNames.Items.Clear(); try { using (var context = new LorikeetAppEntities()) { var getAllMemberName = (from m in context.Members select m).ToList(); foreach (var m in getAllMemberName) { if ((m.FirstName + " " + m.Surname).ToLower().StartsWith(textBoxMNameToChangeTo.Text.ToLower())) { listBoxAllMemberNames.Items.Add(m.FirstName + " " + m.Surname); } } } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); } }
private void FixMistake() { DialogResult dr = new DialogResult(); if (debitIDSelected != -1) { FormInput form = null; if (debitSel) { form = new FormInput("Enter Debit Amount to Change", "OK", true); dr = form.ShowDialog(); } else { form = new FormInput("Enter Credit Amount to Change", "OK", true); dr = form.ShowDialog(); } if (dr == DialogResult.OK) { try { using (var context = new LorikeetAppEntities()) { var debitcreditToUpdate = (from d in context.DebitSystems where d.DebitID == debitIDSelected select d).FirstOrDefault(); if (debitcreditToUpdate != null) { decimal debitCredit; if (decimal.TryParse(form.inputText, out debitCredit)) { if (debitSel) { debitcreditToUpdate.Debit = debitCredit; debitcreditToUpdate.Credit = 0; } else { debitcreditToUpdate.Credit = debitCredit; debitcreditToUpdate.Debit = 0; } context.SaveChanges(); UpdateRunningTotal(); } } } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); } this.debitSystemTableAdapter.FillByMemberID(this.lorikeetAppDataSet.DebitSystem, memberID); } } }
private void AddActivity(DevExpress.Spreadsheet.Cell cellTempActivity) { try { if (!cellTempActivity.Value.IsEmpty) { DateTime date; String[] splitCellActivity = cellTempActivity.Value.ToString().Split(new char[] { '-', '=' }); string strActivity = ""; string strActivityShortcut = ""; if (!DateTime.TryParseExact(cellTempActivity.Value.ToString(), "MMMM", new CultureInfo("en-US"), DateTimeStyles.None, out date)) { if (splitCellActivity.Count() == 1) { splitCellActivity = cellTempActivity.Value.ToString().Split(' '); strActivityShortcut = splitCellActivity.Last().Trim(); strActivity = cellTempActivity.Value.ToString().Replace(cellTempActivity.Value.ToString(), "").Trim(); } else { strActivityShortcut = splitCellActivity[1].Trim(); strActivity = splitCellActivity[0].Trim(); } if (strActivity.Equals("") || strActivityShortcut.Equals("")) { } else { using (var context = new LorikeetAppEntities()) { var checkIfActivityExists = (from l in context.Labels where l.Shortcut == strActivityShortcut select l).DefaultIfEmpty().First(); if (checkIfActivityExists == null) { var activityLabel = new Lorikeet.Data.Label(); activityLabel.DisplayName = strActivity; activityLabel.MenuCaption = strActivity; activityLabel.Shortcut = strActivityShortcut; Random r = new Random(DateTime.Now.Millisecond); Color randomColor = Color.FromArgb(r.Next(0, 255), r.Next(0, 255), r.Next(0, 255)); activityLabel.Color = randomColor.ToArgb(); context.Labels.Add(activityLabel); context.SaveChanges(); } } } } } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); return; } }
private void wizardControl1_FinishClick(object sender, CancelEventArgs e) { try { int memberID; if (int.TryParse(textBoxMemberID.Text, out memberID)) { using (var context = new LorikeetAppEntities()) { var memberToAdd = new Member(); memberToAdd.MemberID = memberID; memberToAdd.FirstName = textBoxFirstName.Text; memberToAdd.Surname = textBoxSurname.Text; memberToAdd.DateOfBirth = dateEditDOB.DateTime; memberToAdd.Aboriginal = checkBoxAboriginal.Checked; memberToAdd.Agency = checkBoxAgency.Checked; if (comboBoxSex.Text.Equals("Male")) { memberToAdd.Sex = true; } else { memberToAdd.Sex = false; } memberToAdd.CountryOfOrigin = textBoxCOO.Text; memberToAdd.ReceiveNewsletter = checkBoxNewsletter.Checked; memberToAdd.ReceiveByMail = checkBoxByMail.Checked; memberToAdd.BirthdayCard = checkBoxBirthdayCard.Checked; memberToAdd.Working = checkBoxWorking.Checked; memberToAdd.Volunteering = checkBoxVolunteering.Checked; memberToAdd.Studying = checkBoxStudying.Checked; memberToAdd.StreetAddress = textBoxStreet.Text; memberToAdd.PostCode = textBoxPostcode.Text; memberToAdd.Suburb = textBoxSuburb.Text; memberToAdd.State = comboBoxEditState.Text; memberToAdd.Country = textBoxCountry.Text; memberToAdd.TelephoneNumber = textBoxTelephone.Text; memberToAdd.MobileNumber = textBoxMobile.Text; memberToAdd.EmailAddress = textBoxEmail.Text; memberToAdd.Archived = false; memberToAdd.DateJoined = DateTime.Today; memberToAdd.DateAltered = DateTime.Today; context.Members.Add(memberToAdd); context.SaveChanges(); } } Logging.AddLogEntry(staffID, Logging.ErrorCodes.Broadcast, Logging.RefreshCodes.Member, "Member " + textBoxFirstName.Text + " " + textBoxSurname.Text + " has been added to the Database", false); } catch (Exception ex) { Logging.AddLogEntry(staffID, Logging.ErrorCodes.Error, Logging.RefreshCodes.Member, "Member " + textBoxFirstName.Text + " " + textBoxSurname.Text + " has tried to be added but failed", false); MessageBox.Show(ex.Message); } }
private string addActivity(string activityShortcut, ref Cell cellToEdit) { try { var formGetInput = new FormAddActivity(activityShortcut); DialogResult dr = new DialogResult(); dr = formGetInput.ShowDialog(); if (dr == DialogResult.OK) { using (var context = new LorikeetAppEntities()) { var activityLabel = new Lorikeet.Data.Label { DisplayName = formGetInput.activity, MenuCaption = formGetInput.activity, Shortcut = activityShortcut }; Random r = new Random(DateTime.Now.Millisecond); Color randomColor = Color.FromArgb(r.Next(0, 255), r.Next(0, 255), r.Next(0, 255)); activityLabel.Color = randomColor.ToArgb(); context.Labels.Add(activityLabel); context.SaveChanges(); } return(formGetInput.activity); } else { string cellString = cellToEdit.Value.ToString(); cellString.Replace(activityShortcut, formGetInput.shortcut); cellToEdit.SetValueFromText(formGetInput.shortcut); using (var context = new LorikeetAppEntities()) { var getActivityLabel = (from l in context.Labels where l.Shortcut == activityShortcut select l).FirstOrDefault(); if (getActivityLabel != null) { return(getActivityLabel.DisplayName); } else { return(null); } } } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); DialogResult = DialogResult.Abort; return(null); } }
private void gridView1_DoubleClick(object sender, EventArgs e) { var view = (GridView)sender; GridHitInfo hitInfo = view.CalcHitInfo(view.GridControl.PointToClient(MousePosition)); if (hitInfo.HitTest == GridHitTest.RowCell) { debitIDSelected = int.Parse(view.GetRowCellDisplayText(hitInfo.RowHandle, colDebitID).ToString()); rowSelected = view.GetSelectedRows()[0]; } var columnName = view.FocusedColumn; if (columnName.GetCaption().Equals("Details")) { DialogResult dr = new DialogResult(); var form = new FormInput("Enter in the Details", "OK"); dr = form.ShowDialog(); try { using (var context = new LorikeetAppEntities()) { if (dr == DialogResult.OK) { var debitCreditChangeText = (from d in context.DebitSystems where d.DebitID == debitIDSelected select d).FirstOrDefault(); if (debitCreditChangeText != null) { debitCreditChangeText.Details = form.inputText; context.SaveChanges(); } this.debitSystemTableAdapter.FillByMemberID(this.lorikeetAppDataSet.DebitSystem, memberID); } } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); } fixable = false; bbiFixMistake.Enabled = false; debitSel = false; } else if (columnName.GetCaption().Equals("Debit") || columnName.GetCaption().Equals("Credit")) { FixMistake(); } }
public static void AddLogEntry(int staffID, ErrorCodes errorCode, RefreshCodes refreshCode, string message, bool displayNotifyIcon) { try { if (displayNotifyIcon) { NotifyIcon notifyIcon1 = new NotifyIcon(); if (errorCode == ErrorCodes.None) { notifyIcon1.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.None; } else if (errorCode == ErrorCodes.OK) { notifyIcon1.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info; } else if (errorCode == ErrorCodes.Warning) { notifyIcon1.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Warning; } else if (errorCode == ErrorCodes.Error) { notifyIcon1.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Error; } notifyIcon1.BalloonTipText = message; notifyIcon1.BalloonTipTitle = "Logging"; notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(3000); } using (var context = new LorikeetAppEntities()) { var logToAdd = new Log(); logToAdd.DateTime = DateTime.Now; logToAdd.ErrorCode = (int)errorCode; logToAdd.Message = message; logToAdd.StaffID = staffID; logToAdd.RefreshCode = (int)refreshCode; context.Logs.Add(logToAdd); context.SaveChanges(); } } catch (Exception ex) { MessageBox.Show(MiscStuff.GetAllMessages(ex)); } }