private void FillGrid() { labCaseList = LabCases.GetForPat(PatNum, IsPlanned); gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableLabCaseSelect", "Date Created"), 80); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCaseSelect", "Lab"), 100); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCaseSelect", "Phone"), 100); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCaseSelect", "Instructions"), 200); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; DateTime dateCreated; Laboratory lab; for (int i = 0; i < labCaseList.Count; i++) { row = new ODGridRow(); dateCreated = labCaseList[i].DateTimeCreated; row.Cells.Add(dateCreated.ToString("ddd") + " " + dateCreated.ToShortDateString() + " " + dateCreated.ToShortTimeString()); lab = Laboratories.GetOne(labCaseList[i].LaboratoryNum); row.Cells.Add(lab.Description); row.Cells.Add(lab.Phone); row.Cells.Add(labCaseList[i].Instructions); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { DataRow row = (DataRow)gridMain.ListGridRows[e.Row].Tag; long selectedLabCase = PIn.Long(row["LabCaseNum"].ToString()); FormLabCaseEdit FormL = new FormLabCaseEdit(); FormL.CaseCur = LabCases.GetOne(selectedLabCase); FormL.ShowDialog(); switch (FormL.DialogResult) { default: case DialogResult.Cancel: //==Jordan don't refresh unless we have to. It messes up the user's ordering. return; case DialogResult.Abort: //User was forced out of window due to a null object, refresh grid to remove missing row. FillGrid(); return; case DialogResult.OK: //Intentionally blank break; } FillGrid(); for (int i = 0; i < table.Rows.Count; i++) { if (table.Rows[i]["LabCaseNum"].ToString() == selectedLabCase.ToString()) { gridMain.SetSelected(i, true); break; } } }
private void FillGrid() { if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" || textDateFrom.errorProvider1.GetError(textDateFrom) != "") { //MsgBox.Show(this,"Please fix errors first."); return; } DateTime dateMax = new DateTime(2100, 1, 1); if (textDateTo.Text != "") { dateMax = PIn.Date(textDateTo.Text); } table = LabCases.Refresh(PIn.Date(textDateFrom.Text), dateMax, checkShowAll.Checked, checkShowUnattached.Checked); gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col; col = new ODGridColumn(Lan.g("TableLabCases", "Appt Date Time"), 120); col.SortingStrategy = GridSortingStrategy.DateParse; gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Procedures"), 200); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Patient"), 120); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Status"), 100); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Lab"), 75); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Lab Phone"), 100); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Instructions"), 100); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < table.Rows.Count; i++) { row = new ODGridRow(); row.Cells.Add(table.Rows[i]["aptDateTime"].ToString()); row.Cells.Add(table.Rows[i]["ProcDescript"].ToString()); row.Cells.Add(table.Rows[i]["patient"].ToString()); row.Cells.Add(table.Rows[i]["status"].ToString()); row.Cells.Add(table.Rows[i]["lab"].ToString()); row.Cells.Add(table.Rows[i]["phone"].ToString()); row.Cells.Add(table.Rows[i]["Instructions"].ToString()); row.Tag = table.Rows[i]; gridMain.Rows.Add(row); } gridMain.AllowSortingByColumn = true; gridMain.EndUpdate(); }
private void FormLabCaseEdit_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { return; } if (IsNew) { if (sheet != null) { Sheets.DeleteObject(sheet.SheetNum); } LabCases.Delete(CaseCur.LabCaseNum); } }
private void butDelete_Click(object sender, System.EventArgs e) { //whether new or not if (!MsgBox.Show(this, true, "Delete Lab Case?")) { return; } try{ LabCases.Delete(CaseCur.LabCaseNum); DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { int selectedLabCase = PIn.PInt(table.Rows[e.Row]["LabCaseNum"].ToString()); FormLabCaseEdit FormL = new FormLabCaseEdit(); FormL.CaseCur = LabCases.GetOne(selectedLabCase); FormL.ShowDialog(); FillGrid(); for (int i = 0; i < table.Rows.Count; i++) { if (table.Rows[i]["LabCaseNum"].ToString() == selectedLabCase.ToString()) { gridMain.SetSelected(i, true); break; } } }
private void FormLabCaseEdit_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { return; } if (IsNew) { if (sheet == null) { LabCases.Delete(CaseCur.LabCaseNum); } else //user created and possibly printed a lab slip. We can't let them delete this lab case //lab cases are always created ahead of time, so no need to save here { } } }
private void FillGrid() { labCaseList = LabCases.GetForPat(PatNum, IsPlanned); gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); GridColumn col = new GridColumn(Lan.g("TableLabCaseSelect", "Date Created"), 80); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableLabCaseSelect", "Lab"), 100); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableLabCaseSelect", "Phone"), 100); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableLabCaseSelect", "Instructions"), 200); gridMain.ListGridColumns.Add(col); gridMain.ListGridRows.Clear(); GridRow row; DateTime dateCreated; Laboratory lab; foreach (LabCase labCase in labCaseList) { row = new GridRow(); dateCreated = labCase.DateTimeCreated; row.Cells.Add(dateCreated.ToString("ddd") + " " + dateCreated.ToShortDateString() + " " + dateCreated.ToShortTimeString()); lab = Laboratories.GetOne(labCase.LaboratoryNum); if (lab == null) //Lab wasn't found in the db, but we only require the LabCaseNum later. { row.Cells.Add(Lan.g(this, "Lab Not Found")); row.Cells.Add(""); } else { row.Cells.Add(lab.Description); row.Cells.Add(lab.Phone); } row.Cells.Add(labCase.Instructions); row.Tag = labCase; gridMain.ListGridRows.Add(row); } gridMain.EndUpdate(); }
private void FillGrid() { if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" || textDateFrom.errorProvider1.GetError(textDateFrom) != "") { //MsgBox.Show(this,"Please fix errors first."); return; } table = LabCases.Refresh(PIn.PDate(textDateFrom.Text), PIn.PDate(textDateTo.Text)); gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableLabCases", "Appt Date Time"), 120); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Procedures"), 200); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Patient"), 120); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Status"), 100); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Lab"), 100); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Phone"), 100); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < table.Rows.Count; i++) { row = new ODGridRow(); row.Cells.Add(table.Rows[i]["aptDateTime"].ToString()); row.Cells.Add(table.Rows[i]["ProcDescript"].ToString()); row.Cells.Add(table.Rows[i]["patient"].ToString()); row.Cells.Add(table.Rows[i]["status"].ToString()); row.Cells.Add(table.Rows[i]["lab"].ToString()); row.Cells.Add(table.Rows[i]["phone"].ToString()); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { DataRow row = (DataRow)gridMain.Rows[e.Row].Tag; long selectedLabCase = PIn.Long(row["LabCaseNum"].ToString()); FormLabCaseEdit FormL = new FormLabCaseEdit(); FormL.CaseCur = LabCases.GetOne(selectedLabCase); FormL.ShowDialog(); if (FormL.DialogResult != DialogResult.OK) { return; //don't refresh unless we have to. It messes up the user's ordering. } FillGrid(); for (int i = 0; i < table.Rows.Count; i++) { if (table.Rows[i]["LabCaseNum"].ToString() == selectedLabCase.ToString()) { gridMain.SetSelected(i, true); break; } } }
private void butAdd_Click(object sender, EventArgs e) { LabCase lab = new LabCase(); lab.PatNum = PatNum; Patient pat = Patients.GetPat(PatNum); lab.ProvNum = Patients.GetProvNum(pat); lab.DateTimeCreated = MiscData.GetNowDateTime(); LabCases.Insert(lab); FormLabCaseEdit FormL = new FormLabCaseEdit(); FormL.CaseCur = lab; FormL.IsNew = true; FormL.ShowDialog(); if (FormL.DialogResult != DialogResult.OK) { return; } SelectedLabCaseNum = FormL.CaseCur.LabCaseNum; DialogResult = DialogResult.OK; }
private void FillGrid() { if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" || textDateFrom.errorProvider1.GetError(textDateFrom) != "") { //MsgBox.Show(this,"Please fix errors first."); return; } DateTime dateMax = new DateTime(2100, 1, 1); if (textDateTo.Text != "") { dateMax = PIn.Date(textDateTo.Text); } table = LabCases.Refresh(PIn.Date(textDateFrom.Text), dateMax, checkShowAll.Checked, checkShowUnattached.Checked); gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); GridColumn col; col = new GridColumn(Lan.g("TableLabCases", "Appt Date Time"), 120); col.SortingStrategy = GridSortingStrategy.DateParse; gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableLabCases", "Procedures"), 200); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableLabCases", "Patient"), 120); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableLabCases", "Status"), 100); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableLabCases", "Lab"), 75); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableLabCases", "Lab Phone"), 100); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableLabCases", "Instructions"), 100); gridMain.ListGridColumns.Add(col); gridMain.ListGridRows.Clear(); GridRow row; List <long> operatoryNums = new List <long>(); if (PrefC.HasClinicsEnabled) { if (comboClinic.SelectedIndex == 0 && !Security.CurUser.ClinicIsRestricted) //"All" { operatoryNums = null; } else if (comboClinic.SelectedIndex == 0) //"All" that the user has access to. { foreach (Clinic clinic in _listClinics) { operatoryNums.AddRange(Operatories.GetOpsForClinic(clinic.ClinicNum).Select(x => x.OperatoryNum)); } } else { operatoryNums.AddRange(Operatories.GetOpsForClinic(_listClinics[comboClinic.SelectedIndex - 1].ClinicNum).Select(x => x.OperatoryNum)); } } for (int i = 0; i < table.Rows.Count; i++) { if (PrefC.HasClinicsEnabled && //no filtering for non clinics. operatoryNums != null && //we don't have "All" selected for an unrestricted user. table.Rows[i]["AptNum"].ToString() != "0" && //show unattached for any clinic !operatoryNums.Contains(PIn.Long(table.Rows[i]["OpNum"].ToString()))) //Attached appointment is scheduled in an Op for the clinic { continue; //appointment scheduled in an operatory for another clinic. } row = new GridRow(); row.Cells.Add(table.Rows[i]["aptDateTime"].ToString()); row.Cells.Add(table.Rows[i]["ProcDescript"].ToString()); row.Cells.Add(table.Rows[i]["patient"].ToString()); row.Cells.Add(table.Rows[i]["status"].ToString()); row.Cells.Add(table.Rows[i]["lab"].ToString()); row.Cells.Add(table.Rows[i]["phone"].ToString()); row.Cells.Add(table.Rows[i]["Instructions"].ToString()); row.Tag = table.Rows[i]; gridMain.ListGridRows.Add(row); } gridMain.AllowSortingByColumn = true; gridMain.EndUpdate(); }
private void butOK_Click(object sender, System.EventArgs e) { if (listLab.SelectedIndex == -1) { MsgBox.Show(this, "Please select a lab first."); return; } if (comboProv.SelectedIndex == -1) { MsgBox.Show(this, "Please select a provider first."); return; } if (textDateCreated.Text != "") { try{ DateTime.Parse(textDateCreated.Text); } catch { MsgBox.Show(this, "Date Time Created is invalid."); return; } } if (textDateSent.Text != "") { try { DateTime.Parse(textDateSent.Text); } catch { MsgBox.Show(this, "Date Time Sent is invalid."); return; } } if (textDateRecd.Text != "") { try { DateTime.Parse(textDateRecd.Text); } catch { MsgBox.Show(this, "Date Time Received is invalid."); return; } } if (textDateChecked.Text != "") { try { DateTime.Parse(textDateChecked.Text); } catch { MsgBox.Show(this, "Date Time Checked is invalid."); return; } } if (textDateDue.Text != "") { try { DateTime.Parse(textDateDue.Text); } catch { MsgBox.Show(this, "Date Time Due is invalid."); return; } } CaseCur.LaboratoryNum = ListLabs[listLab.SelectedIndex].LaboratoryNum; //AptNum //PlannedAptNum CaseCur.ProvNum = Providers.List[comboProv.SelectedIndex].ProvNum; if (textDateCreated.Text == "") { CaseCur.DateTimeCreated = DateTime.MinValue; } else { CaseCur.DateTimeCreated = DateTime.Parse(textDateCreated.Text); } if (textDateSent.Text == "") { CaseCur.DateTimeSent = DateTime.MinValue; } else { CaseCur.DateTimeSent = DateTime.Parse(textDateSent.Text); } if (textDateRecd.Text == "") { CaseCur.DateTimeRecd = DateTime.MinValue; } else { CaseCur.DateTimeRecd = DateTime.Parse(textDateRecd.Text); } if (textDateChecked.Text == "") { CaseCur.DateTimeChecked = DateTime.MinValue; } else { CaseCur.DateTimeChecked = DateTime.Parse(textDateChecked.Text); } if (textDateDue.Text == "") { CaseCur.DateTimeDue = DateTime.MinValue; } else { CaseCur.DateTimeDue = DateTime.Parse(textDateDue.Text); } CaseCur.Instructions = textInstructions.Text; try{ if (IsNew) { LabCases.Insert(CaseCur); } else { LabCases.Update(CaseCur); } } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } DialogResult = DialogResult.OK; }
/// <summary>Returns false if not able to save.</summary> private bool SaveToDb() { if (listLab.SelectedIndex == -1) { MsgBox.Show(this, "Please select a lab first."); return(false); } if (comboProv.SelectedIndex == -1) { MsgBox.Show(this, "Please select a provider first."); return(false); } if (textDateCreated.Text != "") { try{ DateTime.Parse(textDateCreated.Text); } catch { MsgBox.Show(this, "Date Time Created is invalid."); return(false); } } if (textDateSent.Text != "") { try { DateTime.Parse(textDateSent.Text); } catch { MsgBox.Show(this, "Date Time Sent is invalid."); return(false); } } if (textDateRecd.Text != "") { try { DateTime.Parse(textDateRecd.Text); } catch { MsgBox.Show(this, "Date Time Received is invalid."); return(false); } } if (textDateChecked.Text != "") { try { DateTime.Parse(textDateChecked.Text); } catch { MsgBox.Show(this, "Date Time Checked is invalid."); return(false); } } if (textDateDue.Text != "") { try { DateTime.Parse(textDateDue.Text); } catch { MsgBox.Show(this, "Date Time Due is invalid."); return(false); } } CaseCur.LaboratoryNum = ListLabs[listLab.SelectedIndex].LaboratoryNum; //AptNum //PlannedAptNum CaseCur.ProvNum = ProviderC.ListShort[comboProv.SelectedIndex].ProvNum; if (textDateCreated.Text == "") { CaseCur.DateTimeCreated = DateTime.MinValue; } else { CaseCur.DateTimeCreated = DateTime.Parse(textDateCreated.Text); } if (textDateSent.Text == "") { CaseCur.DateTimeSent = DateTime.MinValue; } else { CaseCur.DateTimeSent = DateTime.Parse(textDateSent.Text); } if (textDateRecd.Text == "") { CaseCur.DateTimeRecd = DateTime.MinValue; } else { CaseCur.DateTimeRecd = DateTime.Parse(textDateRecd.Text); } if (textDateChecked.Text == "") { CaseCur.DateTimeChecked = DateTime.MinValue; } else { CaseCur.DateTimeChecked = DateTime.Parse(textDateChecked.Text); } if (textDateDue.Text == "") { CaseCur.DateTimeDue = DateTime.MinValue; } else { CaseCur.DateTimeDue = DateTime.Parse(textDateDue.Text); } CaseCur.Instructions = textInstructions.Text; try{ //if(IsNew){//No. Always created ahead of time LabCases.Update(CaseCur); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return(false); } return(true); }
/// <summary>Returns false if not able to save.</summary> private bool SaveToDb() { if (listLab.SelectedIndex == -1) { MsgBox.Show(this, "Please select a lab first."); return(false); } if (comboProv.SelectedIndex == -1) { MsgBox.Show(this, "Please select a provider first."); return(false); } if (textDateCreated.Text != "") { try{ DateTime.Parse(textDateCreated.Text); } catch { MsgBox.Show(this, "Date Time Created is invalid."); return(false); } } if (textDateSent.Text != "") { try { DateTime.Parse(textDateSent.Text); } catch { MsgBox.Show(this, "Date Time Sent is invalid."); return(false); } } if (textDateRecd.Text != "") { try { DateTime.Parse(textDateRecd.Text); } catch { MsgBox.Show(this, "Date Time Received is invalid."); return(false); } } if (textDateChecked.Text != "") { try { DateTime.Parse(textDateChecked.Text); } catch { MsgBox.Show(this, "Date Time Checked is invalid."); return(false); } } if (textDateDue.Text != "") { try { DateTime.Parse(textDateDue.Text); } catch { MsgBox.Show(this, "Date Time Due is invalid."); return(false); } } if (textLabFee.errorProvider1.GetError(textLabFee) != "") { MsgBox.Show(this, "Lab fee amount is invalid."); return(false); } CaseCur.LaboratoryNum = ListLabs[listLab.SelectedIndex].LaboratoryNum; //AptNum //PlannedAptNum CaseCur.ProvNum = _listProviders[comboProv.SelectedIndex].ProvNum; if (textDateCreated.Text == "") { CaseCur.DateTimeCreated = DateTime.MinValue; } else { CaseCur.DateTimeCreated = DateTime.Parse(textDateCreated.Text); } if (textDateSent.Text == "") { CaseCur.DateTimeSent = DateTime.MinValue; } else { CaseCur.DateTimeSent = DateTime.Parse(textDateSent.Text); } if (textDateRecd.Text == "") { CaseCur.DateTimeRecd = DateTime.MinValue; } else { CaseCur.DateTimeRecd = DateTime.Parse(textDateRecd.Text); } if (textDateChecked.Text == "") { CaseCur.DateTimeChecked = DateTime.MinValue; } else { CaseCur.DateTimeChecked = DateTime.Parse(textDateChecked.Text); } if (textDateDue.Text == "") { CaseCur.DateTimeDue = DateTime.MinValue; } else { CaseCur.DateTimeDue = DateTime.Parse(textDateDue.Text); } CaseCur.Instructions = textInstructions.Text; CaseCur.LabFee = PIn.Double(textLabFee.Text); object[] parameters = { true }; Plugins.HookAddCode(this, "FormLabCaseEdit.SaveToDb_update", parameters); if (!(bool)parameters[0]) { return(false); } try{ //if(IsNew){//No. Always created ahead of time LabCases.Update(CaseCur); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return(false); } return(true); }