Example #1
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (!ValidateTitle())
            {
                return;
            }
            if (!ValidateJob())
            {
                return;
            }
            _jobNew.JobVersion   = textVersion.Text;
            _jobNew.Requirements = textConcept.MainRtf;
            long jobNum = Jobs.Insert(_jobNew);

            foreach (JobLink link in _listJobLinks)
            {
                link.JobNum = jobNum;
                JobLinks.Insert(link);
            }
            foreach (JobQuote quote in _listJobQuotes)
            {
                quote.JobNum = jobNum;
                JobQuotes.Insert(quote);
            }
            DialogResult = DialogResult.OK;
        }
Example #2
0
        ///<summary>This is the load method for the class. It initializes the engineer tiles by creating a model and binding it to the ItemsControl template in the xaml code.</summary>
        public JobManagerDashboardTiles()
        {
            InitializeComponent();
            //labelActiveJobs.Foreground=
            Signalods.SubscribeSignalProcessor(this);
            GridToolbar.Visibility     = Visibility.Hidden;
            EngSpecificInfo.Visibility = Visibility.Collapsed;
            Jobs.FillInMemoryLists(_listJobsAll);
            _engInfoList.Add(
                new EngInformation {
                EngName        = "Total Unfinished Quote Jobs: " + JobQuotes.GetUnfinishedJobQuotes().Count,
                EngClockStatus = "Total Unfinished Quote: $" + JobQuotes.GetUnfinishedJobQuotes().Sum(x => PIn.Double(x.Amount)),
                EngWorkStatus  = "Total Unfinished Jobs: " + _listJobsAll.Where(x => x.PhaseCur != JobPhase.Complete && x.Priority != Defs.GetDefsForCategory(DefCat.JobPriorities, true).FirstOrDefault(y => y.ItemValue.Contains("OnHold")).DefNum).ToList().Count,
                StatField1     = "Total Jobs being worked on: " + _listJobsAll.Where(x => x.OwnerAction == JobAction.WriteCode).ToList().Count
            });
            //list of jobs in WriteCode status
            List <Job> listWriteCodeJobs = _listJobsAll.Where(x => x.OwnerAction == JobAction.WriteCode && x.Priority != Defs.GetDefsForCategory(DefCat.JobPriorities, true).FirstOrDefault(y => y.ItemValue.Contains("OnHold")).DefNum).ToList();

            foreach (Userod user in Userods.GetUsersByJobRole(JobPerm.Engineer, false))
            {
                if (!_listActualEngineers.Contains(user.UserName))
                {
                    continue;
                }
                List <TextBlock> jobTitles = new List <TextBlock>();
                //get only write code jobs
                List <string> listEngJobs = listWriteCodeJobs.Where(x => x.UserNumEngineer == user.UserNum).Select(x => x.Title).ToList();
                foreach (string j in listEngJobs)
                {
                    //TODO: Template this in xaml and pass in the object for the template to autogen, save for after initial working commit.
                    TextBlock tb = new TextBlock();
                    tb.Text         = j;
                    tb.TextWrapping = TextWrapping.WrapWithOverflow;
                    jobTitles.Add(tb);
                }
                string needsWork = "";
                int    devHours  = 0;          //listWriteCodeJobs.Where(x => x.UserNumEngineer==user.UserNum).Sum(x => x.MinutesEstimate);
                if (devHours < 20)
                {
                    needsWork = "Needs Work";
                }
                else
                {
                    needsWork = "~" + devHours.ToString() + " Dev Hours";
                }
                _engInfoList.Add(new EngInformation {
                    EngName        = user.UserName,
                    EngClockStatus = ClockEvents.GetLastEvent(user.EmployeeNum).ClockStatus.ToString(),
                    EngWorkStatus  = needsWork,
                    EngJobs        = jobTitles
                });
            }
            EngTiles.ItemsSource = _engInfoList;
        }