Esempio n. 1
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     if (!MsgBox.Show(this, true, "Delete entry?"))
     {
         return;
     }
     PayorTypes.Delete(PayorTypeCur.PayorTypeNum);
     DialogResult = DialogResult.OK;          //Causes grid to refresh in case this amendment is not new.
 }
Esempio n. 2
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textDate.errorProvider1.GetError(textDate) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            if (textDate.Text == "")
            {
                MsgBox.Show(this, "Please enter a date.");
                return;
            }
            if (comboSopCode.SelectedIndex == -1)
            {
                MsgBox.Show(this, "Please select an Sop Code.");
                return;
            }
            //Make sure there is not already a payor type entered with the selected date.
            //If there is, they should edit the existing one for that date.  There should not be two payor types that start on the same date.
            List <PayorType> listPayorTypes = PayorTypes.Refresh(PayorTypeCur.PatNum);

            for (int i = 0; i < listPayorTypes.Count; i++)
            {
                //if updating an existing payor type, move past the current one
                if (listPayorTypes[i].PayorTypeNum == PayorTypeCur.PayorTypeNum)
                {
                    continue;
                }
                if (listPayorTypes[i].DateStart == PIn.Date(textDate.Text))
                {
                    MsgBox.Show(this, "There is already a payor type with the selected start date.  Either change the date of this payor type or edit the existing payor type with this date.");
                    return;
                }
            }
            PayorTypeCur.SopCode   = Sops.Listt[comboSopCode.SelectedIndex].SopCode;
            PayorTypeCur.Note      = textNote.Text;
            PayorTypeCur.DateStart = PIn.Date(textDate.Text);
            if (IsNew)
            {
                PayorTypes.Insert(PayorTypeCur);
            }
            else
            {
                PayorTypes.Update(PayorTypeCur);
            }
            DialogResult = DialogResult.OK;
        }
Esempio n. 3
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            GridColumn col = new GridColumn("Date Start", 70);

            col.TextAlign = HorizontalAlignment.Center;
            gridMain.ListGridColumns.Add(col);
            col           = new GridColumn("Date End", 70);
            col.TextAlign = HorizontalAlignment.Center;
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("SOP Code", 70);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Description", 250);
            gridMain.ListGridColumns.Add(col);
            col = new GridColumn("Note", 100);
            gridMain.ListGridColumns.Add(col);
            ListPayorTypes = PayorTypes.Refresh(PatCur.PatNum);
            gridMain.ListGridRows.Clear();
            GridRow row;

            for (int i = 0; i < ListPayorTypes.Count; i++)
            {
                row = new GridRow();
                row.Cells.Add(ListPayorTypes[i].DateStart.ToShortDateString());
                if (i == ListPayorTypes.Count - 1)
                {
                    row.Cells.Add("Current");
                }
                else
                {
                    row.Cells.Add(ListPayorTypes[i + 1].DateStart.ToShortDateString());
                }
                row.Cells.Add(ListPayorTypes[i].SopCode);
                row.Cells.Add(Sops.GetDescriptionFromCode(ListPayorTypes[i].SopCode));
                row.Cells.Add(ListPayorTypes[i].Note);
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }