private void FormEhrAmendmentEdit_Closing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { return; } if (EhrAmendmentCur.IsNew) { EhrAmendments.Delete(EhrAmendmentCur.EhrAmendmentNum); ImageStore.CleanAmdAttach(EhrAmendmentCur.FileName); } }
private void butAdd_Click(object sender, EventArgs e) { EhrAmendment ehrAmd = new EhrAmendment(); ehrAmd.PatNum = PatCur.PatNum; ehrAmd.IsNew = true; EhrAmendments.Insert(ehrAmd); FormEhrAmendmentEdit FormEAE = new FormEhrAmendmentEdit(ehrAmd); FormEAE.ShowDialog(); FillGrid(); //Always have to refresh grid due to using the images module to update the db. }
private void FillGrid() { gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); GridColumn col = new GridColumn("Entry Date", 70); col.TextAlign = HorizontalAlignment.Center; gridMain.ListGridColumns.Add(col); col = new GridColumn("Status", 70); gridMain.ListGridColumns.Add(col); col = new GridColumn("Source", 80); gridMain.ListGridColumns.Add(col); col = new GridColumn("Description", 170); gridMain.ListGridColumns.Add(col); col = new GridColumn("Scanned", 25); col.TextAlign = HorizontalAlignment.Center; gridMain.ListGridColumns.Add(col); ListAmendments = EhrAmendments.Refresh(PatCur.PatNum); gridMain.ListGridRows.Clear(); GridRow row; for (int i = 0; i < ListAmendments.Count; i++) { row = new GridRow(); row.Cells.Add(ListAmendments[i].DateTRequest.ToShortDateString()); if (ListAmendments[i].IsAccepted == YN.Yes) { row.Cells.Add("Accepted"); } else if (ListAmendments[i].IsAccepted == YN.No) { row.Cells.Add("Denied"); } else { row.Cells.Add("Requested"); } row.Cells.Add(ListAmendments[i].Source.ToString()); row.Cells.Add(ListAmendments[i].Description); if (ListAmendments[i].FileName != "") { row.Cells.Add("X"); } else { row.Cells.Add(""); } gridMain.ListGridRows.Add(row); } gridMain.EndUpdate(); }
private void butDelete_Click(object sender, EventArgs e) { if (EhrAmendmentCur.IsNew) { //no need to ask them } else { if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete Amendment?")) { return; } } //in both cases, delete: ImageStore.CleanAmdAttach(EhrAmendmentCur.FileName); EhrAmendments.Delete(EhrAmendmentCur.EhrAmendmentNum); DialogResult = DialogResult.OK; //Causes grid to refresh in case this amendment is not new. }
private void butScan_Click(object sender, EventArgs e) { FormImages FormI = new FormImages(); EhrAmendment amendmentOld = EhrAmendmentCur; FormI.EhrAmendmentCur = EhrAmendmentCur; FormI.ShowDialog(); EhrAmendmentCur = EhrAmendments.GetOne(EhrAmendmentCur.EhrAmendmentNum); if (EhrAmendmentCur.FileName != "") { labelScan.Visible = true; butScan.Text = "View"; textDateApp.Text = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); } else { labelScan.Visible = false; butScan.Text = "Scan"; textDateApp.Text = ""; } }
private void butOK_Click(object sender, EventArgs e) { try { if (textDateReq.Text != "") { DateTime.Parse(textDateReq.Text); } if (textDateAcc.Text != "") { DateTime.Parse(textDateAcc.Text); } if (textDateApp.Text != "") { DateTime.Parse(textDateApp.Text); } } catch { MsgBox.Show(this, "The date entered does not match the required format."); return; } if (comboSource.SelectedIndex == -1) { MessageBox.Show("Please select an amendment source."); return; } if (textSourceName.Text == "") { MessageBox.Show("Please input a source name."); return; } if (textDescription.Text == "") { MessageBox.Show("Please input an amendment description."); return; } YN status; if (listAmdStatus.SelectedIndex == 1) { status = YN.Yes; } else if (listAmdStatus.SelectedIndex == 2) { status = YN.No; } else { status = YN.Unknown; } if (EhrAmendmentCur.IsNew && textDateReq.Text == "") { EhrAmendmentCur.DateTRequest = DateTime.Now; } if ((status == YN.Yes || status == YN.No) && //Accepted or Denied (not just U/requested) textDateAcc.Text == "") { if (EhrAmendmentCur.IsNew || EhrAmendmentCur.IsAccepted != status) //if status has changed { EhrAmendmentCur.DateTAcceptDeny = DateTime.Now; //automatically fill date } } if (textDateReq.Text == "") { EhrAmendmentCur.DateTRequest = DateTime.MinValue; } else { EhrAmendmentCur.DateTRequest = DateTime.Parse(textDateReq.Text); } if (textDateAcc.Text == "") { EhrAmendmentCur.DateTAcceptDeny = DateTime.MinValue; } else { EhrAmendmentCur.DateTAcceptDeny = DateTime.Parse(textDateAcc.Text); } if (textDateApp.Text == "") { EhrAmendmentCur.DateTAppend = DateTime.MinValue; } else { EhrAmendmentCur.DateTAppend = DateTime.Parse(textDateApp.Text); } EhrAmendmentCur.IsAccepted = status; EhrAmendmentCur.Source = (AmendmentSource)comboSource.SelectedIndex; EhrAmendmentCur.SourceName = textSourceName.Text; EhrAmendmentCur.Description = textDescription.Text; EhrAmendments.Update(EhrAmendmentCur); //always saved to db before entering this form DialogResult = DialogResult.OK; }