Beispiel #1
0
 private void CheckPermissions()
 {
     //Disable all controls
     comboReviewer.Enabled    = false;
     textDescription.ReadOnly = true;
     comboStatus.Enabled      = false;
     butDelete.Enabled        = false;
     textReviewTime.Enabled   = false;
     if (_jobReviewCur.ReviewerNum == 0 && JobPermissions.IsAuthorized(JobPerm.Writeup, true, secUser.UserNum))         //allow any expert to change the expert if there is no expert.
     {
         comboReviewer.Enabled = true;
     }
     if (_jobReviewCur.ReviewerNum == secUser.UserNum || (_jobReviewCur.ReviewerNum == 0 && JobPermissions.IsAuthorized(JobPerm.Writeup, true, secUser.UserNum)))        //allow current expert to edit things.
     {
         textDescription.ReadOnly = false;
         comboStatus.Enabled      = true;
         butDelete.Enabled        = true;
         textReviewTime.Enabled   = true;
     }
     if (_jobReviewCur.Description == "" && _jobReviewCur.ReviewStatus != JobReviewStatus.Done && JobPermissions.IsAuthorized(JobPerm.Writeup, true, secUser.UserNum))
     {
         butDelete.Enabled = true;
     }
     if (new[] { JobReviewStatus.Done, JobReviewStatus.NeedsAdditionalWork }.Contains(_jobReviewCur.ReviewStatus))
     {
         butDelete.Enabled = false;
     }
 }
Beispiel #2
0
 private void FormJobQuoteEdit_Load(object sender, EventArgs e)
 {
     if (!JobPermissions.IsAuthorized(JobPerm.Quote, true))
     {
         textNote.ReadOnly = true;
         butOK.Enabled     = false;
         butDelete.Enabled = false;
     }
     if (_jobQuote.PatNum > 0)
     {
         Patient pat = Patients.GetPat(_jobQuote.PatNum);
         if (pat != null)
         {
             textPatient.Text = pat.GetNameFL();
         }
         else
         {
             textPatient.Text = "Missing Patient - " + _jobQuote.PatNum;
         }
     }
     textNote.Text           = _jobQuote.Note;
     textAmount.Text         = _jobQuote.Amount;
     textApprovedAmount.Text = _jobQuote.ApprovedAmount;
     textQuoteHours.Text     = _jobQuote.Hours;
     checkIsApproved.Checked = _jobQuote.IsCustomerApproved;
 }
        private void OpenBug(BugSubmission sub)
        {
            if (!JobPermissions.IsAuthorized(JobPerm.Concept, true) &&
                !JobPermissions.IsAuthorized(JobPerm.NotifyCustomer, true) &&
                !JobPermissions.IsAuthorized(JobPerm.FeatureManager, true) &&
                !JobPermissions.IsAuthorized(JobPerm.Documentation, true))
            {
                return;
            }
            FormBugEdit FormBE = new FormBugEdit();

            FormBE.BugCur = Bugs.GetOne(sub.BugId);
            if (FormBE.ShowDialog() == DialogResult.OK && FormBE.BugCur == null)         //Bug was deleted.
            {
                FillSubGrid(true);
            }
        }
Beispiel #4
0
        private void comboCategory_SelectionChangeCommitted(object sender, EventArgs e)
        {
            JobCategory jobCategoryNew = (JobCategory)_listCategoryNames.IndexOf(comboCategory.SelectedItem.ToString());

            if (jobCategoryNew == JobCategory.SpecialProject && !JobPermissions.IsAuthorized(JobPerm.SpecialProject))
            {
                comboCategory.SelectedIndex = _listCategoryNamesFiltered.IndexOf(_jobNew.Category.ToString());
                return;
            }
            if (jobCategoryNew == JobCategory.Bug)
            {
                Def bugDef = _listPriorities.FirstOrDefault(x => x.ItemValue.Contains("BugDefault"));
                comboPriority.SelectedIndex = _listPriorities.IndexOf(bugDef);
                _jobNew.Priority            = bugDef.DefNum;
            }
            _jobNew.Category = jobCategoryNew;
        }
Beispiel #5
0
 private void FormJobAdd_Load(object sender, EventArgs e)
 {
     _listCategoryNames         = Enum.GetNames(typeof(JobCategory)).ToList();
     _listCategoryNamesFiltered = _listCategoryNames.Where(x => x != JobCategory.Query.ToString()).ToList();
     if (!JobPermissions.IsAuthorized(JobPerm.ProjectManager, true))
     {
         _listCategoryNamesFiltered.Remove(JobCategory.NeedNoApproval.ToString());
     }
     if (!JobPermissions.IsAuthorized(JobPerm.SpecialProject, true))
     {
         _listCategoryNamesFiltered.Remove(JobCategory.SpecialProject.ToString());
     }
     _listCategoryNamesFiltered.ForEach(x => comboCategory.Items.Add(x));
     comboCategory.SelectedIndex = _listCategoryNamesFiltered.IndexOf(_jobNew.Category.ToString());
     _listPriorities             = Defs.GetDefsForCategory(DefCat.JobPriorities, true).OrderBy(x => x.ItemOrder).ToList();
     _listPriorities.ForEach(x => comboPriority.Items.Add(new ODBoxItem <Def>(x.ItemName, x)));
     comboPriority.SelectedIndex = _listPriorities.Select(x => x.DefNum).ToList().IndexOf(_jobNew.Priority);
     Enum.GetNames(typeof(JobProposedVersion)).ToList().ForEach(x => comboProposedVersion.Items.Add(x));
     comboProposedVersion.SelectedIndex = (int)JobProposedVersion.Current;
 }
Beispiel #6
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);
        }