Esempio n. 1
0
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            Operatory opCur = new Operatory();

            if (gridMain.SelectedIndices.Length > 0)          //a row is selected
            {
                opCur.ItemOrder = gridMain.SelectedIndices[0];
            }
            else
            {
                opCur.ItemOrder = OperatoryC.Listt.Count;              //goes at end of list
            }
            FormOperatoryEdit FormE = new FormOperatoryEdit(opCur);

            FormE.IsNew = true;
            FormE.ShowDialog();
            if (FormE.DialogResult == DialogResult.Cancel)
            {
                return;
            }
            if (gridMain.SelectedIndices.Length > 0)
            {
                //fix the itemOrder of every Operatory following this one
                for (int i = gridMain.SelectedIndices[0]; i < OperatoryC.Listt.Count; i++)
                {
                    OperatoryC.Listt[i].ItemOrder++;
                    Operatories.Update(OperatoryC.Listt[i]);
                }
            }
            FillGrid();
            changed = true;
        }
Esempio n. 2
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textOpName.Text == "")
     {
         MessageBox.Show(Lan.g(this, "Op Name cannot be blank."));
         return;
     }
     OpCur.OpName   = textOpName.Text;
     OpCur.Abbrev   = textAbbrev.Text;
     OpCur.IsHidden = checkIsHidden.Checked;
     if (comboClinic.SelectedIndex == 0)         //none
     {
         OpCur.ClinicNum = 0;
     }
     else
     {
         OpCur.ClinicNum = Clinics.List[comboClinic.SelectedIndex - 1].ClinicNum;
     }
     if (comboProvDentist.SelectedIndex == 0)         //none
     {
         OpCur.ProvDentist = 0;
     }
     else
     {
         OpCur.ProvDentist = ProviderC.ListShort[comboProvDentist.SelectedIndex - 1].ProvNum;
     }
     if (comboProvHygienist.SelectedIndex == 0)         //none
     {
         OpCur.ProvHygienist = 0;
     }
     else
     {
         OpCur.ProvHygienist = ProviderC.ListShort[comboProvHygienist.SelectedIndex - 1].ProvNum;
     }
     OpCur.IsHygiene      = checkIsHygiene.Checked;
     OpCur.SetProspective = checkSetProspective.Checked;
     try{
         if (IsNew)
         {
             Operatories.Insert(OpCur);
         }
         else
         {
             Operatories.Update(OpCur);
         }
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }
Esempio n. 3
0
        private void butDown_Click(object sender, System.EventArgs e)
        {
            if (gridMain.SelectedIndices.Length == 0)
            {
                MsgBox.Show(this, "You must first select a row.");
                return;
            }
            int selected = gridMain.SelectedIndices[0];

            if (selected == OperatoryC.Listt.Count - 1)
            {
                return;                //already at the bottom
            }
            //move selected item down
            OperatoryC.Listt[selected].ItemOrder++;
            Operatories.Update(OperatoryC.Listt[selected]);
            //move the one below it up
            OperatoryC.Listt[selected + 1].ItemOrder--;
            Operatories.Update(OperatoryC.Listt[selected + 1]);
            FillGrid();
            gridMain.SetSelected(selected + 1, true);
            changed = true;
        }
Esempio n. 4
0
        private void FillGrid()
        {
            Cache.Refresh(InvalidType.Operatories);
            bool neededFixing = false;

            for (int i = 0; i < OperatoryC.Listt.Count; i++)
            {
                if (OperatoryC.Listt[i].ItemOrder != i)
                {
                    OperatoryC.Listt[i].ItemOrder = i;
                    Operatories.Update(OperatoryC.Listt[i]);
                    neededFixing = true;
                }
            }
            if (neededFixing)
            {
                DataValid.SetInvalid(InvalidType.Operatories);
            }
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableOperatories", "Op Name"), 150);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "Abbrev"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "IsHidden"), 64, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "Clinic"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "Dentist"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "Hygienist"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableOperatories", "IsHygiene"), 72, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            UI.ODGridRow row;
            for (int i = 0; i < OperatoryC.Listt.Count; i++)
            {
                row = new OpenDental.UI.ODGridRow();
                row.Cells.Add(OperatoryC.Listt[i].OpName);
                row.Cells.Add(OperatoryC.Listt[i].Abbrev);
                if (OperatoryC.Listt[i].IsHidden)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(Clinics.GetDesc(OperatoryC.Listt[i].ClinicNum));
                row.Cells.Add(Providers.GetAbbr(OperatoryC.Listt[i].ProvDentist));
                row.Cells.Add(Providers.GetAbbr(OperatoryC.Listt[i].ProvHygienist));
                if (OperatoryC.Listt[i].IsHygiene)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }