示例#1
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDescript.Text == "")
            {
                MessageBox.Show(Lan.g(this, "You must type in a description."));
                return;
            }
            if (listADA.Items.Count == 0 && listAutoCodes.SelectedIndices.Count == 0)
            {
                MessageBox.Show(Lan.g(this, "You must pick at least one Auto Code or Procedure Code."));
                return;
            }
            ProcButtonCur.Description = textDescript.Text;
            if (ProcButtonCur.Category != _listProcButtonCatDefs[comboCategory.SelectedIndex].DefNum)
            {
                //This will put it at the end of the order in the new category
                ProcButtonCur.ItemOrder
                    = ProcButtons.GetForCat(_listProcButtonCatDefs[comboCategory.SelectedIndex].DefNum).Length;
            }
            ProcButtonCur.Category    = _listProcButtonCatDefs[comboCategory.SelectedIndex].DefNum;
            ProcButtonCur.ButtonImage = POut.Bitmap((Bitmap)pictureBox.Image, System.Drawing.Imaging.ImageFormat.Png);
            if (IsNew)
            {
                ProcButtonCur.ItemOrder = ProcButtons.GetCount();
                ProcButtons.Insert(ProcButtonCur);
            }
            else
            {
                ProcButtons.Update(ProcButtonCur);
            }
            ProcButtonItems.DeleteAllForButton(ProcButtonCur.ProcButtonNum);
            ProcButtonItem item;

            for (int i = 0; i < listADA.Items.Count; i++)
            {
                item = new ProcButtonItem();
                item.ProcButtonNum = ProcButtonCur.ProcButtonNum;
                item.CodeNum       = ProcedureCodes.GetCodeNum(listADA.Items[i].ToString());
                item.ItemOrder     = i + 1;        //not i++, that would mess up the itteration.
                ProcButtonItems.Insert(item);
            }
            for (int i = 0; i < listAutoCodes.SelectedIndices.Count; i++)
            {
                item = new ProcButtonItem();
                item.ProcButtonNum = ProcButtonCur.ProcButtonNum;
                item.AutoCodeNum   = _listShortDeep[listAutoCodes.SelectedIndices[i]].AutoCodeNum;
                item.ItemOrder     = i + 1;        //not i++, that would mess up the itteration.
                ProcButtonItems.Insert(item);
            }
            DialogResult = DialogResult.OK;
        }
示例#2
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDescript.Text == "")
            {
                MessageBox.Show(Lan.g(this, "You must type in a description."));
                return;
            }
            if (listADA.Items.Count == 0 && listAutoCodes.SelectedIndices.Count == 0)
            {
                MessageBox.Show(Lan.g(this, "You must pick at least one Auto Code or ADA Code."));
                return;
            }
            ProcButtonCur.Description = textDescript.Text;
            if (ProcButtonCur.Category != DefB.Short[(int)DefCat.ProcButtonCats][comboCategory.SelectedIndex].DefNum)
            {
                //This will put it at the end of the order in the new category
                ProcButtonCur.ItemOrder
                    = ProcButtons.GetForCat(DefB.Short[(int)DefCat.ProcButtonCats][comboCategory.SelectedIndex].DefNum).Length;
            }
            ProcButtonCur.Category    = DefB.Short[(int)DefCat.ProcButtonCats][comboCategory.SelectedIndex].DefNum;
            ProcButtonCur.ButtonImage = (Bitmap)pictureBox.Image;
            if (IsNew)
            {
                ProcButtonCur.ItemOrder = ProcButtons.List.Length;
                ProcButtons.Insert(ProcButtonCur);
            }
            else
            {
                ProcButtons.Update(ProcButtonCur);
            }
            ProcButtonItems.DeleteAllForButton(ProcButtonCur.ProcButtonNum);
            ProcButtonItem item;

            for (int i = 0; i < listADA.Items.Count; i++)
            {
                item = new ProcButtonItem();
                item.ProcButtonNum = ProcButtonCur.ProcButtonNum;
                item.ADACode       = listADA.Items[i].ToString();
                ProcButtonItems.Insert(item);
            }
            for (int i = 0; i < listAutoCodes.SelectedIndices.Count; i++)
            {
                item = new ProcButtonItem();
                item.ProcButtonNum = ProcButtonCur.ProcButtonNum;
                item.AutoCodeNum   = AutoCodes.ListShort[listAutoCodes.SelectedIndices[i]].AutoCodeNum;
                ProcButtonItems.Insert(item);
            }
            DialogResult = DialogResult.OK;
        }
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDescript.Text == "")
            {
                MessageBox.Show(Lan.g(this, "You must type in a description."));
                return;
            }
            if (listADA.Items.Count == 0 && listAutoCodes.SelectedIndices.Count == 0)
            {
                MessageBox.Show(Lan.g(this, "You must pick at least one Auto Code or Procedure Code."));
                return;
            }
            foreach (int index in listAutoCodes.SelectedIndices)
            {
                AutoCode autoCode = _listShortDeep[index];
                if (AutoCodeItems.GetListForCode(autoCode.AutoCodeNum).Count == 0)
                {
                    //This AutoCode was saved with no AutoCodeItems attached, which is invalid.
                    MessageBox.Show(this, Lan.g(this, "The following AutoCode has no associated Procedure Codes: ") + "\r\n" + autoCode.Description + "\r\n"
                                    + Lan.g(this, "AutoCode must be setup correctly before it can be used with a Quick Proc Button."));
                    return;
                }
            }
            //Point of no return.
            ProcButtonCur.Description = textDescript.Text;
            if (ProcButtonCur.Category != _listProcButtonCatDefs[comboCategory.SelectedIndex].DefNum)
            {
                //This will put it at the end of the order in the new category
                ProcButtonCur.ItemOrder
                    = ProcButtons.GetForCat(_listProcButtonCatDefs[comboCategory.SelectedIndex].DefNum).Length;
            }
            ProcButtonCur.Category     = _listProcButtonCatDefs[comboCategory.SelectedIndex].DefNum;
            ProcButtonCur.ButtonImage  = POut.Bitmap((Bitmap)pictureBox.Image, System.Drawing.Imaging.ImageFormat.Png);
            ProcButtonCur.IsMultiVisit = checkMultiVisit.Checked;
            if (IsNew)
            {
                ProcButtonCur.ItemOrder = ProcButtons.GetCount();
                ProcButtons.Insert(ProcButtonCur);
            }
            else
            {
                ProcButtons.Update(ProcButtonCur);
            }
            ProcButtonItems.DeleteAllForButton(ProcButtonCur.ProcButtonNum);
            ProcButtonItem item;

            for (int i = 0; i < listADA.Items.Count; i++)
            {
                item = new ProcButtonItem();
                item.ProcButtonNum = ProcButtonCur.ProcButtonNum;
                item.CodeNum       = ProcedureCodes.GetCodeNum(listADA.Items[i].ToString());
                item.ItemOrder     = i + 1;        //not i++, that would mess up the itteration.
                ProcButtonItems.Insert(item);
            }
            for (int i = 0; i < listAutoCodes.SelectedIndices.Count; i++)
            {
                item = new ProcButtonItem();
                item.ProcButtonNum = ProcButtonCur.ProcButtonNum;
                item.AutoCodeNum   = _listShortDeep[listAutoCodes.SelectedIndices[i]].AutoCodeNum;
                item.ItemOrder     = i + 1;        //not i++, that would mess up the itteration.
                ProcButtonItems.Insert(item);
            }
            DialogResult = DialogResult.OK;
        }