Esempio n. 1
0
        private void SaveProgram()
        {
            SaveClinicCurProgramPropertiesToDict();
            _progCur.Enabled     = checkEnabled.Checked;
            _progCur.Path        = textPath.Text;
            _progCur.ButtonImage = POut.Bitmap((Bitmap)pictureBox.Image, System.Drawing.Imaging.ImageFormat.Png);
            ToolButItems.DeleteAllForProgram(_progCur.ProgramNum);
            //Then add one toolButItem for each highlighted row in listbox
            ToolButItem toolButItemCur;

            for (int i = 0; i < listToolBars.SelectedIndices.Count; i++)
            {
                toolButItemCur = new ToolButItem()
                {
                    ProgramNum = _progCur.ProgramNum,
                    ButtonText = textButtonText.Text,
                    ToolBar    = (ToolBarsAvail)listToolBars.SelectedIndices[i]
                };
                ToolButItems.Insert(toolButItemCur);
            }
            if (_pathOverrideOld != textOverride.Text)           //If there was no previous override _pathOverrideOld will be empty string.
            {
                _hasProgramPropertyChanged = true;
                ProgramProperties.InsertOrUpdateLocalOverridePath(_progCur.ProgramNum, textOverride.Text);
            }
            UpdateProgramProperty(_patNumOrChartNum, POut.Bool(radioChart.Checked));           //Will need to be enhanced if another radio button ever gets added.
            UpdateProgramProperty(_infoFilePath, textInfoFile.Text);
            UpsertProgramPropertiesForClinics();
            Programs.Update(_progCur);
        }
Esempio n. 2
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (checkEnabled.Checked && textPluginDllName.Text != "")
            {
                string dllPath = ODFileUtils.CombinePaths(Application.StartupPath, textPluginDllName.Text);
                if (dllPath.Contains("[VersionMajMin]"))
                {
                    Version vers = new Version(Application.ProductVersion);
                    dllPath = dllPath.Replace("[VersionMajMin]", "");                   //now stripped clean
                }
                if (!File.Exists(dllPath))
                {
                    MessageBox.Show(Lan.g(this, "Dll file not found:") + " " + dllPath);
                    return;
                }
            }
            if (textPluginDllName.Text != "" && textPath.Text != "")
            {
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "If both a path and a plug-in are specified, the path will be ignored.  Continue anyway?"))
                {
                    return;
                }
            }
            ProgramCur.ProgName = textProgName.Text;
            ProgramCur.ProgDesc = textProgDesc.Text;
            ProgramCur.Enabled  = checkEnabled.Checked;
            ProgramCur.Path     = textPath.Text;
            if (pathOverrideOld != textOverride.Text)
            {
                ProgramProperties.InsertOrUpdateLocalOverridePath(ProgramCur.ProgramNum, textOverride.Text);
                ProgramProperties.RefreshCache();
            }
            ProgramCur.CommandLine   = textCommandLine.Text;
            ProgramCur.PluginDllName = textPluginDllName.Text;
            ProgramCur.Note          = textNote.Text;
            ProgramCur.ButtonImage   = POut.Bitmap((Bitmap)pictureBox.Image, System.Drawing.Imaging.ImageFormat.Png);
            if (IsNew)
            {
                Programs.Insert(ProgramCur);
            }
            else
            {
                Programs.Update(ProgramCur);
            }
            ToolButItems.DeleteAllForProgram(ProgramCur.ProgramNum);
            //then add one toolButItem for each highlighted row in listbox
            ToolButItem ToolButItemCur;

            for (int i = 0; i < listToolBars.SelectedIndices.Count; i++)
            {
                ToolButItemCur            = new ToolButItem();
                ToolButItemCur.ProgramNum = ProgramCur.ProgramNum;
                ToolButItemCur.ButtonText = textButtonText.Text;
                ToolButItemCur.ToolBar    = (ToolBarsAvail)listToolBars.SelectedIndices[i];
                ToolButItems.Insert(ToolButItemCur);
            }
            DialogResult = DialogResult.OK;
        }
Esempio n. 3
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;
        }
Esempio n. 4
0
 private void LoadImagesToSheetDef(SheetDef sheetDefCur)
 {
     for (int j = 0; j < sheetDefCur.SheetFieldDefs.Count; j++)
     {
         try {
             if (sheetDefCur.SheetFieldDefs[j].FieldType == SheetFieldType.Image)
             {
                 string filePathAndName = ODFileUtils.CombinePaths(SheetUtil.GetImagePath(), sheetDefCur.SheetFieldDefs[j].FieldName);
                 Image  img             = null;
                 if (sheetDefCur.SheetFieldDefs[j].FieldName == "Patient Info.gif")
                 {
                     img = Properties.Resources.Patient_Info;
                 }
                 else if (File.Exists(filePathAndName))
                 {
                     img = Image.FromFile(filePathAndName);
                 }
                 //sheetDefCur.SheetFieldDefs[j].ImageData=POut.Bitmap(new Bitmap(img),ImageFormat.Png);//Because that's what we did before. Review this later.
                 long fileByteSize = 0;
                 using (MemoryStream ms = new MemoryStream()) {
                     img.Save(ms, img.RawFormat);                            // done solely to compute the file size of the image
                     fileByteSize = ms.Length;
                 }
                 if (fileByteSize > 2000000)
                 {
                     //for large images greater that ~2MB use jpeg format for compression. Large images in the 4MB + range have difficulty being displayed. It could be an issue with MYSQL or ASP.NET
                     sheetDefCur.SheetFieldDefs[j].ImageData = POut.Bitmap(new Bitmap(img), ImageFormat.Jpeg);
                 }
                 else
                 {
                     sheetDefCur.SheetFieldDefs[j].ImageData = POut.Bitmap(new Bitmap(img), img.RawFormat);
                 }
             }
             else
             {
                 sheetDefCur.SheetFieldDefs[j].ImageData = "";                      // because null is not allowed
             }
         }
         catch (Exception ex) {
             sheetDefCur.SheetFieldDefs[j].ImageData = "";
             MessageBox.Show(ex.Message);
         }
     }
 }
Esempio n. 5
0
 public static void LoadImagesToSheetDef(SheetDef sheetDefCur)
 {
     for (int j = 0; j < sheetDefCur.SheetFieldDefs.Count; j++)
     {
         try {
             if (sheetDefCur.SheetFieldDefs[j].FieldType == SheetFieldType.Image)
             {
                 string      filePathAndName = ODFileUtils.CombinePaths(SheetUtil.GetImagePath(), sheetDefCur.SheetFieldDefs[j].FieldName);
                 Image       img             = null;
                 ImageFormat imgFormat       = null;
                 if (sheetDefCur.SheetFieldDefs[j].ImageField != null)                       //The image has already been downloaded.
                 {
                     img       = new Bitmap(sheetDefCur.SheetFieldDefs[j].ImageField);
                     imgFormat = ImageFormat.Bmp;
                 }
                 else if (sheetDefCur.SheetFieldDefs[j].FieldName == "Patient Info.gif")
                 {
                     img       = OpenDentBusiness.Properties.Resources.Patient_Info;
                     imgFormat = img.RawFormat;
                 }
                 else if (PrefC.AtoZfolderUsed == DataStorageType.LocalAtoZ && File.Exists(filePathAndName))
                 {
                     img       = Image.FromFile(filePathAndName);
                     imgFormat = img.RawFormat;
                 }
                 else if (CloudStorage.IsCloudStorage)
                 {
                     OpenDentalCloud.Core.TaskStateDownload state = CloudStorage.Download(SheetUtil.GetImagePath(), sheetDefCur.SheetFieldDefs[j].FieldName);
                     if (state == null || state.FileContent == null)
                     {
                         throw new Exception(Lan.g(CloudStorage.LanThis, "Unable to download image."));
                     }
                     else
                     {
                         using (MemoryStream stream = new MemoryStream(state.FileContent)) {
                             img = new Bitmap(Image.FromStream(stream));
                         }
                         imgFormat = ImageFormat.Bmp;
                     }
                 }
                 //sheetDefCur.SheetFieldDefs[j].ImageData=POut.Bitmap(new Bitmap(img),ImageFormat.Png);//Because that's what we did before. Review this later.
                 long fileByteSize = 0;
                 using (MemoryStream ms = new MemoryStream()) {
                     img.Save(ms, imgFormat);                            // done solely to compute the file size of the image
                     fileByteSize = ms.Length;
                 }
                 if (fileByteSize > 2000000)
                 {
                     //for large images greater that ~2MB use jpeg format for compression. Large images in the 4MB + range have difficulty being displayed. It could be an issue with MYSQL or ASP.NET
                     sheetDefCur.SheetFieldDefs[j].ImageData = POut.Bitmap(new Bitmap(img), ImageFormat.Jpeg);
                 }
                 else
                 {
                     sheetDefCur.SheetFieldDefs[j].ImageData = POut.Bitmap(new Bitmap(img), imgFormat);
                 }
             }
             else
             {
                 sheetDefCur.SheetFieldDefs[j].ImageData = "";                      // because null is not allowed
             }
         }
         catch (Exception ex) {
             sheetDefCur.SheetFieldDefs[j].ImageData = "";
             MessageBox.Show(ex.Message);
         }
     }
 }
Esempio n. 6
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;
            }
            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;
        }