コード例 #1
0
        public static Bug AddBugAndJob(ODForm form, List <BugSubmission> listSelectedSubs, Patient pat)
        {
            if (!JobPermissions.IsAuthorized(JobPerm.Concept, true) &&
                !JobPermissions.IsAuthorized(JobPerm.NotifyCustomer, true) &&
                !JobPermissions.IsAuthorized(JobPerm.FeatureManager, true) &&
                !JobPermissions.IsAuthorized(JobPerm.Documentation, true))
            {
                return(null);
            }
            if (listSelectedSubs.Count == 0)
            {
                MsgBox.Show(form, "You must select a bug submission to create a job for.");
                return(null);
            }
            Job jobNew = new Job();

            jobNew.Category = JobCategory.Bug;
            InputBox titleBox = new InputBox("Provide a brief title for the job.");

            if (titleBox.ShowDialog() != DialogResult.OK)
            {
                return(null);
            }
            if (String.IsNullOrEmpty(titleBox.textResult.Text))
            {
                MsgBox.Show(form, "You must type a title to create a job.");
                return(null);
            }
            List <Def> listJobPriorities = Defs.GetDefsForCategory(DefCat.JobPriorities, true);

            if (listJobPriorities.Count == 0)
            {
                MsgBox.Show(form, "You have no priorities setup in definitions.");
                return(null);
            }
            jobNew.Title = titleBox.textResult.Text;
            long priorityNum = 0;

            priorityNum           = listJobPriorities.FirstOrDefault(x => x.ItemValue.Contains("BugDefault")).DefNum;
            jobNew.Priority       = priorityNum == 0?listJobPriorities.First().DefNum:priorityNum;
            jobNew.PhaseCur       = JobPhase.Concept;
            jobNew.UserNumConcept = Security.CurUser.UserNum;
            Bug bugNew = new Bug();

            bugNew = Bugs.GetNewBugForUser();
            InputBox bugDescription = new InputBox("Provide a brief description for the bug. This will appear in the bug tracker.", jobNew.Title);

            if (bugDescription.ShowDialog() != DialogResult.OK)
            {
                return(null);
            }
            if (String.IsNullOrEmpty(bugDescription.textResult.Text))
            {
                MsgBox.Show(form, "You must type a description to create a bug.");
                return(null);
            }
            FormVersionPrompt FormVP = new FormVersionPrompt("Enter versions found");

            FormVP.ShowDialog();
            if (FormVP.DialogResult != DialogResult.OK || string.IsNullOrEmpty(FormVP.VersionText))
            {
                MsgBox.Show(form, "You must enter a version to create a bug.");
                return(null);
            }
            bugNew.Status_       = BugStatus.Accepted;
            bugNew.VersionsFound = FormVP.VersionText;
            bugNew.Description   = bugDescription.textResult.Text;
            BugSubmission sub = listSelectedSubs.First();

            jobNew.Requirements = BugSubmissions.GetSubmissionDescription(pat, sub);
            Jobs.Insert(jobNew);
            JobLink jobLinkNew = new JobLink();

            jobLinkNew.LinkType = JobLinkType.Bug;
            jobLinkNew.JobNum   = jobNew.JobNum;
            jobLinkNew.FKey     = Bugs.Insert(bugNew);
            JobLinks.Insert(jobLinkNew);
            BugSubmissions.UpdateBugIds(bugNew.BugId, listSelectedSubs.Select(x => x.BugSubmissionNum).ToList());
            if (MsgBox.Show(form, MsgBoxButtons.YesNo, "Would you like to create a task too?"))
            {
                long taskNum = CreateTask(pat, sub);
                if (taskNum != 0)
                {
                    jobLinkNew          = new JobLink();
                    jobLinkNew.LinkType = JobLinkType.Task;
                    jobLinkNew.JobNum   = jobNew.JobNum;
                    jobLinkNew.FKey     = taskNum;
                    JobLinks.Insert(jobLinkNew);
                }
            }
            Signalods.SetInvalid(InvalidType.Jobs, KeyType.Job, jobNew.JobNum);
            FormOpenDental.S_GoToJob(jobNew.JobNum);
            return(bugNew);
        }
コード例 #2
0
ファイル: FormWikiImages.cs プロジェクト: royedwards/DRDNet
        private void butImport_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFD = new OpenFileDialog();

            openFD.Multiselect = true;
            if (openFD.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            Invalidate();
            string wikiPath = "";

            try {
                wikiPath = WikiPages.GetWikiPath();
            }
            catch (Exception ex) {
                MessageBox.Show(this, ex.Message);
                return;
            }
            foreach (string fileName in openFD.FileNames)
            {
                //check file types?
                string destinationPath = FileAtoZ.CombinePaths(wikiPath, Path.GetFileName(fileName));
                if (FileAtoZ.Exists(destinationPath))
                {
                    switch (MessageBox.Show(Lan.g(this, "Overwrite Existing File") + ": " + destinationPath, "", MessageBoxButtons.YesNoCancel))
                    {
                    case DialogResult.No:                            //rename, do not overwrite
                        InputBox ip = new InputBox(Lan.g(this, "New file name."));
                        ip.textResult.Text = Path.GetFileName(fileName);
                        ip.ShowDialog();
                        if (ip.DialogResult != DialogResult.OK)
                        {
                            continue;                                    //cancel, next file.
                        }
                        bool cancel = false;
                        while (!cancel && FileAtoZ.Exists(FileAtoZ.CombinePaths(wikiPath, ip.textResult.Text)))
                        {
                            MsgBox.Show(this, "File name already exists.");
                            if (ip.ShowDialog() != DialogResult.OK)
                            {
                                cancel = true;
                            }
                        }
                        if (cancel)
                        {
                            continue;                                    //cancel rename, and go to next file.
                        }
                        destinationPath = FileAtoZ.CombinePaths(wikiPath, ip.textResult.Text);
                        break;                                //proceed to save file.

                    case DialogResult.Yes:                    //overwrite
                        try {
                            FileAtoZ.Delete(destinationPath);
                        }
                        catch (Exception ex) {
                            MessageBox.Show(Lan.g(this, "Cannot copy file") + ":" + fileName + "\r\n" + ex.Message);
                            continue;
                        }
                        break;                          //file deleted, proceed to save.

                    default:                            //cancel
                        continue;                       //skip this file.
                    }
                }
                FileAtoZ.Copy(fileName, destinationPath, FileAtoZSourceDestination.LocalToAtoZ);
            }
            FillGrid();
            if (openFD.FileNames.Length == 1)           //if importing exactly one image, select it upon returning.
            {
                textSearch.Text = Path.GetFileName(openFD.FileNames[0]);
            }
        }
コード例 #3
0
ファイル: FormTerminal.cs プロジェクト: kjb7749/testImport
        private void FormTerminal_Load(object sender, EventArgs e)
        {
            Size     = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Size;
            Location = new Point(0, 0);
            labelConnection.Visible = false;
            _listSheets             = new List <Sheet>();
            if (IsSimpleMode)
            {
                //PatNum set externally (in FormPatientForms)
                return;
            }
            //NOT SimpleMode from here down
            Process processCur = Process.GetCurrentProcess();

            //Delete all terminalactives for this computer, except new one, based on CompName and SessionID
            TerminalActives.DeleteForCmptrSessionAndId(Environment.MachineName, processCur.SessionId, excludeId: processCur.Id);
            string clientName = null;
            string userName   = null;

            try {
                clientName = Environment.GetEnvironmentVariable("ClientName");
                userName   = Environment.GetEnvironmentVariable("UserName");
            }
            catch (Exception) {
                //user may not have permission to access environment variables or another error could happen
            }
            if (string.IsNullOrWhiteSpace(clientName))
            {
                //ClientName only set for remote sessions, try to find suitable replacement.
                clientName = userName;
                if (processCur.SessionId < 2 || string.IsNullOrWhiteSpace(userName))
                {
                    //if sessionId is 0 or 1, this is not a remote session, use MachineName
                    clientName = Environment.MachineName;
                }
            }
            if (string.IsNullOrWhiteSpace(clientName) || TerminalActives.IsCompClientNameInUse(Environment.MachineName, clientName))
            {
                InputBox iBox = new InputBox("Please enter a unique name to identify this kiosk.");
                iBox.setTitle(Lan.g(this, "Kiosk Session Name"));
                iBox.ShowDialog();
                while (iBox.DialogResult == DialogResult.OK && TerminalActives.IsCompClientNameInUse(Environment.MachineName, iBox.textResult.Text))
                {
                    MsgBox.Show(this, "The name entered is invalid or already in use.");
                    iBox.ShowDialog();
                }
                if (iBox.DialogResult != DialogResult.OK)
                {
                    DialogResult = DialogResult.Cancel;
                    return;                    //not allowed to enter kiosk mode unless a unique human-readable name is entered for this computer session
                }
                clientName = iBox.textResult.Text;
            }
            //if we get here, we have a SessionId (which could be 0 if not in a remote session) and a unique client name for this kiosk
            TerminalActive terminal = new TerminalActive();

            terminal.ComputerName = Environment.MachineName;
            terminal.SessionId    = processCur.SessionId;
            terminal.SessionName  = clientName;
            terminal.ProcessId    = processCur.Id;
            TerminalActives.Insert(terminal);                                          //tell the database that a terminal is newly active on this computer
            Signalods.SetInvalid(InvalidType.Kiosk, KeyType.ProcessId, processCur.Id); //signal FormTerminalManager to re-fill grids
            timer1.Enabled = true;
        }
コード例 #4
0
        ///<summary>If using the Add button on FormEhrNotPerformed, an input box will allow the user to select from the list of available items that are not being performed.  The SelectedItemIndex will hold the index of the item selected wich corresponds to the enum EhrNotPerformedItem.  We will use this selected item index to set the EhrNotPerformed code and code system.</summary>
        private void FormEhrNotPerformedEdit_Load(object sender, EventArgs e)
        {
            if (IsDateReadOnly)
            {
                textDate.ReadOnly = true;
            }
            List <string> listValueSetOIDs = new List <string>();

            switch (SelectedItemIndex)
            {
            case 0:                    //BMIExam
                listValueSetOIDs = new List <string> {
                    "2.16.840.1.113883.3.600.1.681"
                };                                                                                         //'BMI LOINC Value' value set
                break;

            case 1:                    //InfluenzaVaccination
                listValueSetOIDs = new List <string> {
                    "2.16.840.1.113883.3.526.3.402", "2.16.840.1.113883.3.526.3.1254"
                };                                                                                                                             //'Influenza Vaccination' and 'Influenza Vaccine' value sets
                radioMedReason.Visible = true;
                radioPatReason.Visible = true;
                radioSysReason.Visible = true;
                break;

            case 2:                    //TobaccoScreening
                listValueSetOIDs = new List <string> {
                    "2.16.840.1.113883.3.526.3.1278"
                };                                                                                             //'Tobacco Use Screening' value set
                break;

            case 3:                    //DocumentCurrentMeds
                listValueSetOIDs = new List <string> {
                    "2.16.840.1.113883.3.600.1.462"
                };                                                                                            //'Current Medications Documented SNMD' value set
                break;

            default:                    //should never happen
                break;
            }
            List <EhrCode> listEhrCodes = EhrCodes.GetForValueSetOIDs(listValueSetOIDs, true);

            if (listEhrCodes.Count == 0)           //This should only happen if the EHR.dll does not exist or if the codes in the ehrcode list do not exist in the corresponding table
            {
                MsgBox.Show(this, "The codes used for Not Performed items do not exist in the table in your database.  You should run the Code System Importer tool in Setup | EHR.");
                DialogResult = DialogResult.Cancel;
                return;
            }
            if (EhrNotPerfCur.IsNew)             //if new, CodeValue and CodeSystem are not set, might have to select one
            {
                if (listEhrCodes.Count == 1)     //only one code in the selected value set, use it
                {
                    EhrNotPerfCur.CodeValue  = listEhrCodes[0].CodeValue;
                    EhrNotPerfCur.CodeSystem = listEhrCodes[0].CodeSystem;
                }
                else
                {
                    List <string> listCodeDescripts = new List <string>();
                    for (int i = 0; i < listEhrCodes.Count; i++)
                    {
                        listCodeDescripts.Add(listEhrCodes[i].CodeValue + " - " + listEhrCodes[i].Description);
                    }
                    InputBox chooseItem = new InputBox(Lan.g(this, "Select the " + Enum.GetNames(typeof(EhrNotPerformedItem))[SelectedItemIndex] + " not being performed from the list below."), listCodeDescripts);
                    if (SelectedItemIndex == (int)EhrNotPerformedItem.InfluenzaVaccination)
                    {
                        chooseItem.comboSelection.DropDownWidth = 730;
                    }
                    if (chooseItem.ShowDialog() != DialogResult.OK)
                    {
                        DialogResult = DialogResult.Cancel;
                        return;
                    }
                    if (chooseItem.comboSelection.SelectedIndex == -1)
                    {
                        MsgBox.Show(this, "You must select the " + Enum.GetNames(typeof(EhrNotPerformedItem))[SelectedItemIndex] + " not being performed.");
                        DialogResult = DialogResult.Cancel;
                        return;
                    }
                    EhrNotPerfCur.CodeValue  = listEhrCodes[chooseItem.comboSelection.SelectedIndex].CodeValue;
                    EhrNotPerfCur.CodeSystem = listEhrCodes[chooseItem.comboSelection.SelectedIndex].CodeSystem;
                }
            }
            for (int i = 0; i < listEhrCodes.Count; i++)
            {
                if (listEhrCodes[i].CodeValue == EhrNotPerfCur.CodeValue && listEhrCodes[i].CodeSystem == EhrNotPerfCur.CodeSystem)
                {
                    textDescription.Text = listEhrCodes[i].Description;
                }
            }
            textCode.Text       = EhrNotPerfCur.CodeValue;
            textCodeSystem.Text = EhrNotPerfCur.CodeSystem;
            textDate.Text       = EhrNotPerfCur.DateEntry.ToShortDateString();
            textNote.Text       = EhrNotPerfCur.Note;
            FillReasonList();
            if (comboCodeReason.SelectedIndex > 0)
            {
                textCodeSystemReason.Text  = listEhrCodesReason[comboCodeReason.SelectedIndex - 1].CodeSystem;
                textDescriptionReason.Text = listEhrCodesReason[comboCodeReason.SelectedIndex - 1].Description;
            }
        }