private void NewAgreedTermBarItem_Click(object sender, EventArgs e) { agreedTerm = new AgreedTerm(); DateTime date = DateCalendar.SelectionStart; if (date != null && PatientLE.EditValue != null && DoctorLE.EditValue != null) { agreedTerm.Date = date; agreedTerm.Doctor = int.Parse(DoctorLE.EditValue.ToString()); agreedTerm.Patient = int.Parse(PatientLE.EditValue.ToString()); agreedTerm.Time = FreeTermLE.EditValue.ToString(); if (!_DB.InsertAgreedTerm(agreedTerm)) { XtraMessageBox.Show("Element is not added!"); HideShowElement(false); } DoctorLE.EditValue = null; _agreedTerm = _DB.GetAgreedTerm(); AgreedTermGridControl.DataSource = _agreedTerm; } else { XtraMessageBox.Show("All fields should be filled!"); } }
public bool Execute(AgreedTerm agreedterm) { try { var request = WebRequest.Create("http://localhost:3000/DeleteZakazaniTermin"); request.Headers["id"] = agreedterm.ID.ToString(); request.GetResponse(); return(true); } catch (Exception ex) { return(false); throw ex; } }
public bool DeleteAgreedTerm(AgreedTerm agreedTerm) { try { DeleteAgreedTerm deleteAgreedTerm = new DeleteAgreedTerm(); deleteAgreedTerm.Execute(agreedTerm); return(true); } catch { return(false); } finally { } }
public bool UpdateAgreedTerm(AgreedTerm agreedTerm) { try { UpdateAgreedTerm updateAgreedTerm = new UpdateAgreedTerm(); updateAgreedTerm.Execute(agreedTerm); return(true); } catch { return(false); } finally { } }
public bool InsertAgreedTerm(AgreedTerm agreedTerm) { try { InsertAgreedTerm insertAgreedTerm = new InsertAgreedTerm(); insertAgreedTerm.Execute(agreedTerm); return(true); } catch { return(false); } finally { } }
private void AgreedTermGridView_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { agreedTerm = new AgreedTerm(); try { GridView view = sender as GridView; object row = view.GetRow(e.RowHandle); agreedTerm = (AgreedTerm)row; DateCalendar.SetDate(agreedTerm.Date); PatientLE.EditValue = agreedTerm.Patient; DoctorLE.EditValue = agreedTerm.Doctor; HideShowElement(true); } catch { } }
public bool Execute(AgreedTerm agreedTerm) { try { var request = WebRequest.Create("http://localhost:3000/InsertZakazaniTermin"); request.Headers["date_time"] = agreedTerm.Date.ToString("yyyy-MM-dd"); request.Headers["time"] = agreedTerm.Time; request.Headers["patient"] = agreedTerm.Patient.ToString(); request.Headers["doctor"] = agreedTerm.Doctor.ToString(); request.GetResponse(); return(true); } catch (Exception ex) { return(false); throw ex; } }
private void DeleteAgreedTermBarItem_Click(object sender, EventArgs e) { if (agreedTerm != null) { DialogResult dialogResult = XtraMessageBox.Show("You really want to delete the selected element?", "Sure", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { if (!_DB.DeleteAgreedTerm(agreedTerm)) { XtraMessageBox.Show("Element is not deleted!"); } _agreedTerm = _DB.GetAgreedTerm(); AgreedTermGridControl.DataSource = _agreedTerm; agreedTerm = null; HideShowElement(false); DoctorLE.EditValue = null; } } else { XtraMessageBox.Show("Element is not selected!"); } }
public AgreedTermForm(DBCommunication.DBCommunicationAdmin _db) { InitializeComponent(); HideShowElement(false); _termAM = new List <Term>(); _termAM.Add(new Term { Time = "08:00:00" }); _termAM.Add(new Term { Time = "08:15:00" }); _termAM.Add(new Term { Time = "08:30:00" }); _termAM.Add(new Term { Time = "08:45:00" }); _termAM.Add(new Term { Time = "09:00:00" }); _termAM.Add(new Term { Time = "09:15:00" }); _termAM.Add(new Term { Time = "09:30:00" }); _termAM.Add(new Term { Time = "09:45:00" }); _termAM.Add(new Term { Time = "10:00:00" }); _termAM.Add(new Term { Time = "10:15:00" }); _termAM.Add(new Term { Time = "10:30:00" }); _termAM.Add(new Term { Time = "10:45:00" }); _termAM.Add(new Term { Time = "11:00:00" }); _termAM.Add(new Term { Time = "11:15:00" }); _termAM.Add(new Term { Time = "11:30:00" }); _termAM.Add(new Term { Time = "11:45:00" }); _termAM.Add(new Term { Time = "12:00:00" }); _termAM.Add(new Term { Time = "12:15:00" }); _termAM.Add(new Term { Time = "12:30:00" }); _termAM.Add(new Term { Time = "12:45:00" }); _termAM.Add(new Term { Time = "13:00:00" }); _termAM.Add(new Term { Time = "13:15:00" }); _termAM.Add(new Term { Time = "13:30:00" }); _termAM.Add(new Term { Time = "13:45:00" }); _termPM = new List <Term>(); _termPM.Add(new Term { Time = "14:00:00" }); _termPM.Add(new Term { Time = "14:15:00" }); _termPM.Add(new Term { Time = "14:30:00" }); _termPM.Add(new Term { Time = "14:45:00" }); _termPM.Add(new Term { Time = "15:00:00" }); _termPM.Add(new Term { Time = "15:15:00" }); _termPM.Add(new Term { Time = "15:30:00" }); _termPM.Add(new Term { Time = "15:45:00" }); _termPM.Add(new Term { Time = "16:00:00" }); _termPM.Add(new Term { Time = "16:15:00" }); _termPM.Add(new Term { Time = "16:30:00" }); _termPM.Add(new Term { Time = "16:45:00" }); _termPM.Add(new Term { Time = "17:00:00" }); _termPM.Add(new Term { Time = "17:15:00" }); _termPM.Add(new Term { Time = "17:30:00" }); _termPM.Add(new Term { Time = "17:45:00" }); _termPM.Add(new Term { Time = "18:00:00" }); _termPM.Add(new Term { Time = "18:15:00" }); _termPM.Add(new Term { Time = "18:30:00" }); _termPM.Add(new Term { Time = "18:45:00" }); _termPM.Add(new Term { Time = "19:00:00" }); _termPM.Add(new Term { Time = "19:15:00" }); _termPM.Add(new Term { Time = "19:30:00" }); _termPM.Add(new Term { Time = "19:45:00" }); agreedTerm = new AgreedTerm(); _DB = _db; _agreedTerm = _DB.GetAgreedTerm(); AgreedTermGridControl.DataSource = _agreedTerm; _patient = _DB.GetPatient(); PatientLE.Properties.DataSource = _patient; PatientLE.Properties.DisplayMember = "Name"; PatientLE.Properties.ValueMember = "ID"; _doctor = _DB.GetDoctor(); DoctorLE.Properties.DataSource = _doctor; DoctorLE.Properties.DisplayMember = "Name"; DoctorLE.Properties.ValueMember = "ID"; }