예제 #1
0
파일: FormPath.cs 프로젝트: nampn/ODental
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormPath));
     this.butOK           = new OpenDental.UI.Button();
     this.butCancel       = new OpenDental.UI.Button();
     this.textDocPath     = new System.Windows.Forms.TextBox();
     this.textExportPath  = new System.Windows.Forms.TextBox();
     this.butBrowseExport = new OpenDental.UI.Button();
     this.butBrowseDoc    = new OpenDental.UI.Button();
     this.fb     = new System.Windows.Forms.FolderBrowserDialog();
     this.label1 = new System.Windows.Forms.Label();
     this.labelPathSameForAll = new System.Windows.Forms.Label();
     this.label3                     = new System.Windows.Forms.Label();
     this.butBrowseLetter            = new OpenDental.UI.Button();
     this.textLetterMergePath        = new System.Windows.Forms.TextBox();
     this.checkMultiplePaths         = new System.Windows.Forms.CheckBox();
     this.groupbox1                  = new System.Windows.Forms.GroupBox();
     this.butBrowseLocal             = new OpenDental.UI.Button();
     this.butBrowseServer            = new OpenDental.UI.Button();
     this.labelServerPath            = new System.Windows.Forms.Label();
     this.textServerPath             = new System.Windows.Forms.TextBox();
     this.labelLocalPath             = new System.Windows.Forms.Label();
     this.textLocalPath              = new System.Windows.Forms.TextBox();
     this.radioAtoZfolderNotRequired = new System.Windows.Forms.RadioButton();
     this.radioUseFolder             = new System.Windows.Forms.RadioButton();
     this.groupbox1.SuspendLayout();
     this.SuspendLayout();
     //
     // butOK
     //
     this.butOK.AdjustImageLocation = new System.Drawing.Point(0, 0);
     this.butOK.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.butOK.Autosize     = true;
     this.butOK.BtnShape     = OpenDental.UI.enumType.BtnShape.Rectangle;
     this.butOK.BtnStyle     = OpenDental.UI.enumType.XPStyle.Silver;
     this.butOK.CornerRadius = 4F;
     this.butOK.Location     = new System.Drawing.Point(440, 502);
     this.butOK.Name         = "butOK";
     this.butOK.Size         = new System.Drawing.Size(75, 26);
     this.butOK.TabIndex     = 2;
     this.butOK.Text         = "&OK";
     this.butOK.Click       += new System.EventHandler(this.butOK_Click);
     //
     // butCancel
     //
     this.butCancel.AdjustImageLocation = new System.Drawing.Point(0, 0);
     this.butCancel.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.butCancel.Autosize     = true;
     this.butCancel.BtnShape     = OpenDental.UI.enumType.BtnShape.Rectangle;
     this.butCancel.BtnStyle     = OpenDental.UI.enumType.XPStyle.Silver;
     this.butCancel.CornerRadius = 4F;
     this.butCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.butCancel.Location     = new System.Drawing.Point(539, 502);
     this.butCancel.Name         = "butCancel";
     this.butCancel.Size         = new System.Drawing.Size(75, 26);
     this.butCancel.TabIndex     = 3;
     this.butCancel.Text         = "&Cancel";
     this.butCancel.Click       += new System.EventHandler(this.butCancel_Click);
     //
     // textDocPath
     //
     this.textDocPath.Location = new System.Drawing.Point(26, 82);
     this.textDocPath.Name     = "textDocPath";
     this.textDocPath.Size     = new System.Drawing.Size(497, 20);
     this.textDocPath.TabIndex = 1;
     //
     // textExportPath
     //
     this.textExportPath.Location = new System.Drawing.Point(19, 358);
     this.textExportPath.Name     = "textExportPath";
     this.textExportPath.Size     = new System.Drawing.Size(515, 20);
     this.textExportPath.TabIndex = 1;
     //
     // butBrowseExport
     //
     this.butBrowseExport.AdjustImageLocation = new System.Drawing.Point(0, 0);
     this.butBrowseExport.Autosize            = true;
     this.butBrowseExport.BtnShape            = OpenDental.UI.enumType.BtnShape.Rectangle;
     this.butBrowseExport.BtnStyle            = OpenDental.UI.enumType.XPStyle.Silver;
     this.butBrowseExport.CornerRadius        = 4F;
     this.butBrowseExport.Location            = new System.Drawing.Point(538, 355);
     this.butBrowseExport.Name     = "butBrowseExport";
     this.butBrowseExport.Size     = new System.Drawing.Size(76, 25);
     this.butBrowseExport.TabIndex = 91;
     this.butBrowseExport.Text     = "Browse";
     this.butBrowseExport.Click   += new System.EventHandler(this.butBrowseExport_Click);
     //
     // butBrowseDoc
     //
     this.butBrowseDoc.AdjustImageLocation = new System.Drawing.Point(0, 0);
     this.butBrowseDoc.Autosize            = true;
     this.butBrowseDoc.BtnShape            = OpenDental.UI.enumType.BtnShape.Rectangle;
     this.butBrowseDoc.BtnStyle            = OpenDental.UI.enumType.XPStyle.Silver;
     this.butBrowseDoc.CornerRadius        = 4F;
     this.butBrowseDoc.Location            = new System.Drawing.Point(529, 78);
     this.butBrowseDoc.Name     = "butBrowseDoc";
     this.butBrowseDoc.Size     = new System.Drawing.Size(76, 25);
     this.butBrowseDoc.TabIndex = 2;
     this.butBrowseDoc.Text     = "&Browse";
     this.butBrowseDoc.Click   += new System.EventHandler(this.butBrowseDoc_Click);
     //
     // fb
     //
     this.fb.SelectedPath = "C:\\";
     //
     // label1
     //
     this.label1.Location  = new System.Drawing.Point(20, 294);
     this.label1.Name      = "label1";
     this.label1.Size      = new System.Drawing.Size(596, 59);
     this.label1.TabIndex  = 92;
     this.label1.Text      = resources.GetString("label1.Text");
     this.label1.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
     //
     // labelPathSameForAll
     //
     this.labelPathSameForAll.Location  = new System.Drawing.Point(26, 37);
     this.labelPathSameForAll.Name      = "labelPathSameForAll";
     this.labelPathSameForAll.Size      = new System.Drawing.Size(579, 41);
     this.labelPathSameForAll.TabIndex  = 93;
     this.labelPathSameForAll.Text      = resources.GetString("labelPathSameForAll.Text");
     this.labelPathSameForAll.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
     //
     // label3
     //
     this.label3.Location  = new System.Drawing.Point(20, 384);
     this.label3.Name      = "label3";
     this.label3.Size      = new System.Drawing.Size(596, 57);
     this.label3.TabIndex  = 96;
     this.label3.Text      = resources.GetString("label3.Text");
     this.label3.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
     //
     // butBrowseLetter
     //
     this.butBrowseLetter.AdjustImageLocation = new System.Drawing.Point(0, 0);
     this.butBrowseLetter.Autosize            = true;
     this.butBrowseLetter.BtnShape            = OpenDental.UI.enumType.BtnShape.Rectangle;
     this.butBrowseLetter.BtnStyle            = OpenDental.UI.enumType.XPStyle.Silver;
     this.butBrowseLetter.CornerRadius        = 4F;
     this.butBrowseLetter.Location            = new System.Drawing.Point(538, 444);
     this.butBrowseLetter.Name     = "butBrowseLetter";
     this.butBrowseLetter.Size     = new System.Drawing.Size(76, 25);
     this.butBrowseLetter.TabIndex = 95;
     this.butBrowseLetter.Text     = "Browse";
     this.butBrowseLetter.Click   += new System.EventHandler(this.butBrowseLetter_Click);
     //
     // textLetterMergePath
     //
     this.textLetterMergePath.Location = new System.Drawing.Point(19, 447);
     this.textLetterMergePath.Name     = "textLetterMergePath";
     this.textLetterMergePath.Size     = new System.Drawing.Size(515, 20);
     this.textLetterMergePath.TabIndex = 94;
     //
     // checkMultiplePaths
     //
     this.checkMultiplePaths.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
     this.checkMultiplePaths.Location   = new System.Drawing.Point(26, 108);
     this.checkMultiplePaths.Name       = "checkMultiplePaths";
     this.checkMultiplePaths.Size       = new System.Drawing.Size(580, 44);
     this.checkMultiplePaths.TabIndex   = 98;
     this.checkMultiplePaths.Text       = resources.GetString("checkMultiplePaths.Text");
     this.checkMultiplePaths.TextAlign  = System.Drawing.ContentAlignment.TopLeft;
     this.checkMultiplePaths.UseVisualStyleBackColor = true;
     //
     // groupbox1
     //
     this.groupbox1.Controls.Add(this.butBrowseLocal);
     this.groupbox1.Controls.Add(this.butBrowseServer);
     this.groupbox1.Controls.Add(this.labelServerPath);
     this.groupbox1.Controls.Add(this.textServerPath);
     this.groupbox1.Controls.Add(this.labelLocalPath);
     this.groupbox1.Controls.Add(this.textLocalPath);
     this.groupbox1.Controls.Add(this.radioAtoZfolderNotRequired);
     this.groupbox1.Controls.Add(this.radioUseFolder);
     this.groupbox1.Controls.Add(this.checkMultiplePaths);
     this.groupbox1.Controls.Add(this.labelPathSameForAll);
     this.groupbox1.Controls.Add(this.textDocPath);
     this.groupbox1.Controls.Add(this.butBrowseDoc);
     this.groupbox1.Location = new System.Drawing.Point(10, 12);
     this.groupbox1.Name     = "groupbox1";
     this.groupbox1.Size     = new System.Drawing.Size(654, 291);
     this.groupbox1.TabIndex = 0;
     this.groupbox1.TabStop  = false;
     this.groupbox1.Text     = "A to Z Images Folder for storing images and documents";
     //
     // butBrowseLocal
     //
     this.butBrowseLocal.AdjustImageLocation = new System.Drawing.Point(0, 0);
     this.butBrowseLocal.Autosize            = true;
     this.butBrowseLocal.BtnShape            = OpenDental.UI.enumType.BtnShape.Rectangle;
     this.butBrowseLocal.BtnStyle            = OpenDental.UI.enumType.XPStyle.Silver;
     this.butBrowseLocal.CornerRadius        = 4F;
     this.butBrowseLocal.Location            = new System.Drawing.Point(529, 224);
     this.butBrowseLocal.Name     = "butBrowseLocal";
     this.butBrowseLocal.Size     = new System.Drawing.Size(76, 25);
     this.butBrowseLocal.TabIndex = 103;
     this.butBrowseLocal.Text     = "Browse";
     this.butBrowseLocal.Click   += new System.EventHandler(this.butBrowseLocal_Click);
     //
     // butBrowseServer
     //
     this.butBrowseServer.AdjustImageLocation = new System.Drawing.Point(0, 0);
     this.butBrowseServer.Autosize            = true;
     this.butBrowseServer.BtnShape            = OpenDental.UI.enumType.BtnShape.Rectangle;
     this.butBrowseServer.BtnStyle            = OpenDental.UI.enumType.XPStyle.Silver;
     this.butBrowseServer.CornerRadius        = 4F;
     this.butBrowseServer.Location            = new System.Drawing.Point(529, 178);
     this.butBrowseServer.Name     = "butBrowseServer";
     this.butBrowseServer.Size     = new System.Drawing.Size(76, 25);
     this.butBrowseServer.TabIndex = 106;
     this.butBrowseServer.Text     = "Browse";
     this.butBrowseServer.Click   += new System.EventHandler(this.butBrowseServer_Click);
     //
     // labelServerPath
     //
     this.labelServerPath.Location  = new System.Drawing.Point(26, 162);
     this.labelServerPath.Name      = "labelServerPath";
     this.labelServerPath.Size      = new System.Drawing.Size(488, 17);
     this.labelServerPath.TabIndex  = 107;
     this.labelServerPath.Text      = "Path override for this server.  Usually leave blank.";
     this.labelServerPath.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
     //
     // textServerPath
     //
     this.textServerPath.Location = new System.Drawing.Point(26, 182);
     this.textServerPath.Name     = "textServerPath";
     this.textServerPath.Size     = new System.Drawing.Size(497, 20);
     this.textServerPath.TabIndex = 105;
     //
     // labelLocalPath
     //
     this.labelLocalPath.Location  = new System.Drawing.Point(26, 208);
     this.labelLocalPath.Name      = "labelLocalPath";
     this.labelLocalPath.Size      = new System.Drawing.Size(498, 17);
     this.labelLocalPath.TabIndex  = 104;
     this.labelLocalPath.Text      = "Path override for this computer.  Usually leave blank.";
     this.labelLocalPath.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
     //
     // textLocalPath
     //
     this.textLocalPath.Location = new System.Drawing.Point(26, 228);
     this.textLocalPath.Name     = "textLocalPath";
     this.textLocalPath.Size     = new System.Drawing.Size(497, 20);
     this.textLocalPath.TabIndex = 102;
     //
     // radioAtoZfolderNotRequired
     //
     this.radioAtoZfolderNotRequired.Location = new System.Drawing.Point(10, 262);
     this.radioAtoZfolderNotRequired.Name     = "radioAtoZfolderNotRequired";
     this.radioAtoZfolderNotRequired.Size     = new System.Drawing.Size(537, 17);
     this.radioAtoZfolderNotRequired.TabIndex = 101;
     this.radioAtoZfolderNotRequired.TabStop  = true;
     this.radioAtoZfolderNotRequired.Text     = "Store images directly in database.  No AtoZ folder. (Some features will be unavai" +
                                                "lable)";
     this.radioAtoZfolderNotRequired.UseVisualStyleBackColor = true;
     this.radioAtoZfolderNotRequired.Click += new System.EventHandler(this.radioAtoZfolderNotRequired_Click);
     //
     // radioUseFolder
     //
     this.radioUseFolder.Location = new System.Drawing.Point(9, 19);
     this.radioUseFolder.Name     = "radioUseFolder";
     this.radioUseFolder.Size     = new System.Drawing.Size(333, 17);
     this.radioUseFolder.TabIndex = 0;
     this.radioUseFolder.TabStop  = true;
     this.radioUseFolder.Text     = "Store images and documents on a local or network folder.";
     this.radioUseFolder.UseVisualStyleBackColor = true;
     this.radioUseFolder.CheckedChanged         += new System.EventHandler(this.radioUseFolder_CheckedChanged);
     //
     // FormPath
     //
     this.AcceptButton      = this.butOK;
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.CancelButton      = this.butCancel;
     this.ClientSize        = new System.Drawing.Size(683, 540);
     this.Controls.Add(this.groupbox1);
     this.Controls.Add(this.butBrowseLetter);
     this.Controls.Add(this.butBrowseExport);
     this.Controls.Add(this.label3);
     this.Controls.Add(this.textLetterMergePath);
     this.Controls.Add(this.label1);
     this.Controls.Add(this.textExportPath);
     this.Controls.Add(this.butCancel);
     this.Controls.Add(this.butOK);
     this.Icon          = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.MaximizeBox   = false;
     this.MinimizeBox   = false;
     this.Name          = "FormPath";
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text          = "Edit Paths";
     this.Closing      += new System.ComponentModel.CancelEventHandler(this.FormPath_Closing);
     this.Load         += new System.EventHandler(this.FormPath_Load);
     this.groupbox1.ResumeLayout(false);
     this.groupbox1.PerformLayout();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
예제 #2
0
        private void butExport_Click(object sender, EventArgs e)
        {
            string strCcdValidationErrors = EhrCCD.ValidateSettings();

            if (strCcdValidationErrors != "")            //Do not even try to export if global settings are invalid.
            {
                MessageBox.Show(strCcdValidationErrors); //We do not want to use translations here, because the text is dynamic. The errors are generated in the business layer, and Lan.g() is not available there.
                return;
            }
            FolderBrowserDialog dlg    = new FolderBrowserDialog();
            DialogResult        result = dlg.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }
            DateTime dateNow    = DateTime.Now;
            string   folderPath = ODFileUtils.CombinePaths(dlg.SelectedPath, (dateNow.Year + "_" + dateNow.Month + "_" + dateNow.Day));

            if (Directory.Exists(folderPath))
            {
                int loopCount = 1;
                while (Directory.Exists(folderPath + "_" + loopCount))
                {
                    loopCount++;
                }
                folderPath = folderPath + "_" + loopCount;
            }
            try {
                Directory.CreateDirectory(folderPath);
            }
            catch {
                MessageBox.Show("Error, Could not create folder");
                return;
            }
            this.Cursor = Cursors.WaitCursor;
            Patient patCur;
            string  fileName;
            int     numSkipped      = 0;   //Number of patients skipped. Set to -1 if only one patient was selected and had CcdValidationErrors.
            string  patientsSkipped = "";  //Names of the patients that were skipped, so we can tell the user which ones didn't export correctly.

            for (int i = 0; i < gridMain.SelectedIndices.Length; i++)
            {
                patCur = Patients.GetPat((long)gridMain.ListGridRows[gridMain.SelectedIndices[i]].Tag);              //Cannot use GetLim because more information is needed in the CCD message generation below.
                strCcdValidationErrors = EhrCCD.ValidatePatient(patCur);
                if (strCcdValidationErrors != "")
                {
                    if (gridMain.SelectedIndices.Length == 1)
                    {
                        numSkipped = -1;                       //Set to -1 so we know below to not show the "exported" message.
                        MessageBox.Show(Lan.g(this, "Patient not exported due to the following errors") + ":\r\n" + strCcdValidationErrors);
                        continue;
                    }
                    //If one patient is missing the required information for export, then simply skip the patient. We do not want to popup a message,
                    //because it would be hard to get through the export if many patients were missing required information.
                    numSkipped++;
                    patientsSkipped += "\r\n" + patCur.LName + ", " + patCur.FName;
                    continue;
                }
                fileName = "";
                string lName = patCur.LName;
                for (int j = 0; j < lName.Length; j++)             //Strip all non-letters from FName
                {
                    if (Char.IsLetter(lName, j))
                    {
                        fileName += lName.Substring(j, 1);
                    }
                }
                fileName += "_";
                string fName = patCur.FName;
                for (int k = 0; k < fName.Length; k++)             //Strip all non-letters from LName
                {
                    if (Char.IsLetter(fName, k))
                    {
                        fileName += fName.Substring(k, 1);
                    }
                }
                fileName += "_" + patCur.PatNum;              //LName_FName_PatNum
                string ccd = EhrCCD.GeneratePatientExport(patCur);
                try {
                    File.WriteAllText(ODFileUtils.CombinePaths(folderPath, fileName + ".xml"), ccd);
                }
                catch {
                    MessageBox.Show("Error, Could not create xml file");
                    this.Cursor = Cursors.Default;
                    return;
                }
            }
            if (numSkipped == -1)               //Will be -1 if only one patient was selected, and it did not export correctly.
            {
                this.Cursor = Cursors.Default;
                return;                //Don't display "Exported" to the user because the CCD was not exported.
            }
            try {
                File.WriteAllText(ODFileUtils.CombinePaths(folderPath, "CCD.xsl"), FormEHR.GetEhrResource("CCD"));
            }
            catch {
                MessageBox.Show("Error, Could not create stylesheet file");
            }
            string strMsg = Lan.g(this, "Exported");

            if (numSkipped > 0)
            {
                strMsg += ". " + Lan.g(this, "Patients skipped due to missing information") + ": " + numSkipped + patientsSkipped;
                MsgBoxCopyPaste msgCP = new MsgBoxCopyPaste(strMsg);
                msgCP.Show();
            }
            else
            {
                MessageBox.Show(strMsg);
            }
            this.Cursor = Cursors.Default;
        }