///<summary>
        /// Создаёт экземпляр элемента управления, отображающего список директив
        ///</summary>
        ///<param name="currentWorkPackage">Рабочий пакет, которому принадлежат директивы</param>
        public AccessoryRequiredListScreen(WorkPackage currentWorkPackage)
            : this()
        {
            if (currentWorkPackage == null)
            {
                throw new ArgumentNullException("currentWorkPackage");
            }

            _currentWorkPackage = currentWorkPackage;

            if (_currentWorkPackage.Aircraft == null)
            {
                throw new ArgumentNullException("Aircraft is null");
            }

            CurrentAircraft = _currentWorkPackage.Aircraft;
            StatusTitle     = "Kit Forecast";

            #region ButtonPrintContextMenu

            buttonPrintMenuStrip = new ContextMenuStrip();
            //itemPrintReportSchedule = new ToolStripMenuItem { Text = "Scheduled" };
            itemPrintReportMaintenancePlan = new ToolStripMenuItem {
                Text = "Equipment and Materials"
            };
            buttonPrintMenuStrip.Items.AddRange(new ToolStripItem[] { /*itemPrintReportSchedule,*/ itemPrintReportMaintenancePlan });

            ButtonPrintMenuStrip = buttonPrintMenuStrip;

            #endregion

            InitToolStripMenuItems();
            InitListView();
        }
Exemplo n.º 2
0
        private void FillPackage(WorkPackage package, BarcoContext context)
        {
            var members = context.BarcoMembers.Where(m => m.RotaStatus == RotaStatus.Active).ToList();

            package = context.WorkPackages
                      .Where(p => p.Id == package.Id)
                      .Include(p => p.Jobs)
                      .ThenInclude(j => j.Shifts)
                      .Single();
            var result = WorkPackageFactory.FillWorkPackage(package, members, false);

            while (result.UnfilledJobs > 0)
            {
                result = WorkPackageFactory.FillWorkPackage(package, members, true);
            }

            //notified concerned members

            var shiftsByMember = package.Jobs.SelectMany(j => j.Shifts).GroupBy(s => s.BarcoMember);

            foreach (var group in shiftsByMember)
            {
                foreach (var item in group.OrderBy(s => s.BarcoJob.StartDateTime))
                {
                    //
                }
                Notify(group.Key, $"Your shifts for package {package.Name}", "");
            }
        }
Exemplo n.º 3
0
        public bool SaveWorkPackageToDb(WorkPackage workPackage)
        {
            WorkPackage dbEntry = context.WorkPackages.FirstOrDefault(m => m.WorkPackageID == workPackage.WorkPackageID);


            if (dbEntry != null)
            {   // sprawdzenie czy w bazie danych nie ma juz wpisu o takim workpackCode
                if (dbEntry.WorkPackageCode == workPackage.WorkPackageCode)
                {
                    return(false);
                }
                dbEntry.WorkPackageCode        = workPackage.WorkPackageCode;
                dbEntry.WorkPackageDescription = workPackage.WorkPackageDescription;
                context.SaveChanges();
                return(true);
            }
            try
            {
                context.WorkPackages.Add(workPackage);
                context.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        public static WorkPackage CreateWorkPackage(string name, DateTime startDate, DateTime endDate, BarcoMember manager, JobType jobType, int jobCapacity)
        {
            var workPackage = new WorkPackage
            {
                Name      = name,
                Manager   = manager,
                StartDate = startDate,
                Status    = WorkPackageStatus.Planned,
                Jobs      = new HashSet <BarcoJob>()
            };

            for (DateTime date = startDate; date.Date <= endDate.Date; date = date.AddDays(1))
            {
                var barTimes = GetBarTimes(date);
                workPackage.Jobs.Add(new BarcoJob
                {
                    Created       = DateTime.Now,
                    StartDateTime = barTimes.OpeningDateTime,
                    EndDateTime   = barTimes.ClosingDateTime,
                    JobType       = jobType,
                    JobCapacity   = jobCapacity,
                    WorkPackage   = workPackage
                });
            }

            return(workPackage);
        }
        protected virtual void SetWorkPackage(WorkPackage work)
        {
            MyWork = work;

            // Create the models
            if (MyWork != null && MyWork.Cells.Length > 0)
            {
                Log.DebugFormat("Rank {0}: creating {1} model evaluators", WorldRank, MyWork.Cells.Length);
                Models = new ICatchmentCellModelRunner[MyWork.Cells.Length];
                for (int i = 0; i < MyWork.Cells.Length; i++)
                {
                    CellDefinition cellDefinition = MyWork.Cells[i];
                    Log.DebugFormat("Rank {0}: model instance {1}, catchment {2}, cell {3}", WorldRank, i, cellDefinition.CatchmentId, cellDefinition.Id);
                    var inputs = (TIME.Tools.Metaheuristics.Persistence.Gridded.ModelInputsDefinition)cellDefinition.ModelRunDefinition.Inputs;
                    if (inputs != null && !File.Exists(inputs.NetCdfDataFilename))
                    {
                        string msg = String.Format(
                            "Rank {0}: Input netcdf file '{1}' not found. Catchment: {2}, cell {3}",
                            WorldRank,
                            inputs.NetCdfDataFilename,
                            cellDefinition.CatchmentId,
                            cellDefinition.Id);
                        throw new ConfigurationException(msg);
                    }
#if USE_TOY_MODEL
                    Models[i] = new GriddedCatchmentToyModel(MyWork.Cells[i]);
#else
                    Log.DebugFormat("Rank {0}: creating cell evaluator", rank);
                    Models[i] = GridModelHelper.CreateCellEvaluator(cellDefinition);
                    Log.DebugFormat("Rank {0}: Evaluator created", rank);
#endif
                }
                Log.DebugFormat("Rank {0}: models created", WorldRank);
            }
        }
        public void Execute()
        {
            WorkPackage WorkPackage;

            int[] Assignment;

            Console.WriteLine("Execute " + this.GetType().ToString());

            NumberConnectedComponents = 0;

            for (int i = 0; i < ThreadCount; i++)
            {
                WorkPackage        = new WorkPackage();
                WorkPackage.Method = ExecuteActivity;
                WorkPackage.Image  = Image;

                Assignment    = new int[2];
                Assignment[0] = i;           //start index
                Assignment[1] = ThreadCount; //step size through list

                WorkPackage.Assignment = (object)Assignment;
                WorkPackage.Parameter  = (object)0;
                RunPackage(WorkPackage);
            }

            WaitForWorkDone(this.GetType().ToString());

            //Add Statistics
            OCR.Statistics.AddCounter("Number connected components", NumberConnectedComponents);
        }
 public WorkPackageReportGetViewModel(WorkPackageReport workPackageReport,
                                      WorkPackage workPackage, Project project, Employee projectManager,
                                      Employee responsibleEngineer, List <EmployeeReportViewModel> engineers,
                                      List <WorkPackageReportDetailsViewModel> details)
 {
     this.WorkPackageName     = workPackage.Name;
     this.WorkPackageId       = workPackageReport.WorkPackageId;
     this.WorkPackageCode     = workPackage.WorkPackageCode;
     this.ProjectId           = workPackage.ProjectId;
     this.ProjectCode         = project.ProjectCode;
     this.ProjectName         = project.ProjectName;
     this.WorkPackageReportId = workPackageReport.WorkPackageReportId;
     this.ReportDate          = workPackageReport.ReportDate;
     this.StartDate           = workPackageReport.StartDate;
     this.EndDate             = workPackageReport.EndDate;
     this.ProjectManager      = new EmployeeReportViewModel(projectManager);
     this.ResponsibleEngineer = new EmployeeReportViewModel(responsibleEngineer);
     this.Engineers           = engineers;
     this.Comment             = workPackageReport.Comment;
     this.WorkAccomplished    = workPackageReport.WorkAccomplished;
     this.WorkPlanned         = workPackageReport.WorkPlanned;
     this.ProblemsThisPeriod  = workPackageReport.ProblemsThisPeriod;
     this.ProblemsAnticipated = workPackageReport.ProblemsAnticipated;
     this.Details             = details;
 }
        public void GetAllWorkPackagesTest()
        {
            WorkPackage workPackage = new WorkPackage(connManager);
            DataSet     ds          = workPackage.GetAll();

            Assert.AreEqual(21, ds.Tables[0].Columns.Count);
        }
        /// <summary>This function launches multiple threads to execute the algorithm
        /// for detecting sentences
        /// </summary>
        public void Execute()
        {
            //int[] Assignment;

            Console.WriteLine("Execute " + this.GetType().ToString());

            CreateAreas();

            for (int i = 0; i < 1 /*ThreadCount*/; i++)
            {
                //At the moment we only start one thread for this part
                //The algorithm doesn't multithread very easily.

                WorkPackage WorkPackage = new WorkPackage();
                WorkPackage.Image     = Image;
                WorkPackage.Method    = ExecuteActivity;
                WorkPackage.Parameter = (object)m_Areas;
                RunPackage(WorkPackage);
            }

            WaitForWorkDone(this.GetType().ToString());

            //Clean up sentences
            CleanUpSentences(Image);

            //Add Statistics
            OCR.Statistics.AddCounter("Detected sentences", Image.Sentences.Count);
        }
Exemplo n.º 10
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] WorkPackage workPackage)
        {
            if (id != workPackage.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(workPackage);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WorkPackageExists(workPackage.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(workPackage));
        }
Exemplo n.º 11
0
        public async Task <Timesheet> GetFullTimesheetDetails(Timesheet ts)
        {
            Employee emp = await _employeeRepository.Get(ts.EmployeeId);

            emp.Timesheets = null;
            ts.Employee    = emp;

            var timesheetRows = (await _timesheetRowRepository.GetAll())
                                .Where(t => t.TimesheetId == ts.TimesheetId && t.TimesheetVersionNumber == ts.VersionNumber);

            if (ts.TimesheetRows != null)
            {
                foreach (var tsTimesheetRow in ts.TimesheetRows)
                {
                    tsTimesheetRow.Timesheet = null;
                    WorkPackage wp = await _workPackageRepository.Get(tsTimesheetRow.WorkPackageId);

                    Project proj = await _projectRepository.Get(wp.ProjectId);

                    TimesheetRowViewModel tsRowViewModel = new TimesheetRowViewModel(tsTimesheetRow, proj, wp.WorkPackageCode);
                }
            }

            TimesheetViewModel tsViewModel = new TimesheetViewModel(ts);

            ts.TimesheetRows = timesheetRows.ToList();

            return(ts);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Создает форму для привязки задач к выполнению чека программы обслуживания
        /// </summary>
        public MaintenanceCheckBindTaskInWPForm(MaintenanceCheck maintenanceCheck,
                                                IEnumerable <MaintenanceCheck> allWpChecks,
                                                WorkPackage workPackage)
            : this()
        {
            if (maintenanceCheck == null)
            {
                throw new ArgumentNullException("maintenanceCheck", "must be not null");
            }
            if (workPackage == null)
            {
                throw new ArgumentNullException("workPackage", "must be not null");
            }
            _maintenanceCheck = maintenanceCheck;
            _currentAircraft  = maintenanceCheck.ParentAircraft;
            _workPackage      = workPackage;

            if (allWpChecks != null && allWpChecks.Count() > 0)
            {
                _allWpChecks = allWpChecks;
            }
            else
            {
                _allWpChecks = new List <MaintenanceCheck> {
                    maintenanceCheck
                }
            };

            _animatedThreadWorker.DoWork             += AnimatedThreadWorkerDoLoad;
            _animatedThreadWorker.RunWorkerCompleted += BackgroundWorkerRunWorkerLoadCompleted;
        }
Exemplo n.º 13
0
        public void Execute()
        {
            Console.WriteLine("Execute " + this.GetType().ToString());

            WorkPackage WorkPackage;
            int         AreaHeight = Image.Area.Height / ThreadCount;

            //Reset the ID counter in PageComponent.
            PageComponent.newID = 0;

            //Create the workpackages
            for (int i = 0; i < ThreadCount; i++)
            {
                WorkPackage            = new WorkPackage();
                WorkPackage.Method     = ExecuteActivity;
                WorkPackage.Image      = Image;
                WorkPackage.Assignment = (object)new Rectangle(Image.Area.Left,
                                                               Image.Area.Top + AreaHeight * i,
                                                               Image.Area.Width,
                                                               AreaHeight);
                WorkPackage.Parameter = (object)(Byte)(i + 1);
                RunPackage(WorkPackage);
            }

            WaitForWorkDone(this.GetType().ToString());

            //Cleanup components
            CleanUpComponents(Image);


            OCR.Statistics.AddCounter("Detected components", Image.Components.Count);
        }
    protected void updateWorkPackage(string workpackID, decimal allocBudget, decimal unallocBudget)
    {
        try
        {
            WorkPackage workpackage = ff.WorkPackages.Where(wp => wp.wpId == workpackID).First();
            if (allocBudget > Convert.ToDecimal(allocOriginal))
            {
                workpackage.unallocated_dollars = workpackage.unallocated_dollars - (allocBudget - Convert.ToDecimal(allocOriginal));
                workpackage.allocated_dollars   = workpackage.allocated_dollars + (allocBudget - Convert.ToDecimal(allocOriginal));
            }
            else if (allocBudget < Convert.ToDecimal(allocOriginal))
            {
                workpackage.unallocated_dollars = workpackage.unallocated_dollars + (Convert.ToDecimal(allocOriginal) - allocBudget);
                workpackage.allocated_dollars   = workpackage.allocated_dollars - (Convert.ToDecimal(allocOriginal) - allocBudget);
            }
            if (unallocBudget > Convert.ToDecimal(unallocOriginal))
            {
                workpackage.unallocated_dollars = workpackage.unallocated_dollars - (unallocBudget - Convert.ToDecimal(unallocOriginal));
                workpackage.allocated_dollars   = workpackage.allocated_dollars + (unallocBudget - Convert.ToDecimal(unallocOriginal));
            }
            else if (unallocBudget < Convert.ToDecimal(unallocOriginal))
            {
                workpackage.unallocated_dollars = workpackage.unallocated_dollars + (Convert.ToDecimal(unallocOriginal) - unallocBudget);
                workpackage.allocated_dollars   = workpackage.allocated_dollars - (Convert.ToDecimal(unallocOriginal) - unallocBudget);
            }

            ff.SubmitChanges();
        }
        catch (Exception exception)
        {
            //lblException.Text = exception.StackTrace;
        }
    }
Exemplo n.º 15
0
        public void Execute()
        {
            WorkPackage WorkPackage;

            int[] Assignment;

            Console.WriteLine("Execute " + this.GetType().ToString());

            //Read the wordlist from disc
            WordList tempWordList = new WordList();

            m_Wordlist = tempWordList.LoadXML(OCR.BaseFolder() + "wordlist.xml");

            //create a workpackage per thread.
            for (int i = 0; i < ThreadCount; i++)
            {
                WorkPackage        = new WorkPackage();
                WorkPackage.Method = ExecuteActivity;
                WorkPackage.Image  = Image;

                Assignment    = new int[2];
                Assignment[0] = i;           //start index
                Assignment[1] = ThreadCount; //step size through list

                WorkPackage.Assignment = (object)Assignment;
                WorkPackage.Parameter  = (object)m_Wordlist;
                RunPackage(WorkPackage);
            }

            WaitForWorkDone(this.GetType().ToString());
        }
Exemplo n.º 16
0
 /// <summary>
 /// —оздает форму дл¤ добавлени¤ нестандартной работы
 /// </summary>
 /// <param name="parentWorkPackage">–абочий пакет, к которому добавл¤етс¤ нестандартна¤ работа</param>
 public NonRoutineJobForm(WorkPackage parentWorkPackage)
 {
     this.parentWorkPackage = parentWorkPackage;
     currentNonRoutineJob   = new NonRoutineJob();
     mode = ScreenMode.Add;
     InitializeComponent();
 }
Exemplo n.º 17
0
        private void ComposeWorkPackage()
        {
            WorkPackage workPackage = new WorkPackage();

            workPackage.Title = currentAircraft.GetNewWorkPackageTitle();

            try
            {
                currentAircraft.AddWorkPackage(workPackage);
                for (int i = 0; i < listViewJobCards.SelectedItems.Count; i++)
                {
                    workPackage.AddItem(listViewJobCards.SelectedItems[i]);
                }
                if (MessageBox.Show("Work Package " + workPackage.Title + " created successfully." + Environment.NewLine + "Open work package screen?",
                                    new TermsProvider()["SystemName"].ToString(), MessageBoxButtons.YesNoCancel,
                                    MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    OnDisplayerRequested(new ReferenceEventArgs(new DispatcheredWorkPackageScreen(workPackage), ReflectionTypes.DisplayInNew, currentAircraft.RegistrationNumber + ". " + workPackage.Title));
                }
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while creating work package", ex);
            }
        }
Exemplo n.º 18
0
    protected void gvWorkPackages_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        // try
        //{
        string fullname2 = "";
        string fullname3 = "";

        try
        {
            string[] fullname = lblProjectManager2.Text.Split(' ');
            fullname2 = fullname[0].ToLower() + "_" + fullname[1].ToLower();
            fullname3 = fullname[0] + "_" + fullname[1];
        }
        catch (Exception exception)
        {
            fullname2 = "";
            fullname3 = "";
        }
        if (e.CommandName == "btnView")
        {
            int         row         = Convert.ToInt32(e.CommandArgument);
            GridViewRow selectedRow = gvWorkPackages.Rows[row];
            Session["wpID"] = selectedRow.Cells[0].Text;
            Response.Redirect("~/RE/ManageWorkPackage.aspx");
        }

        if (e.CommandName == "btnDeactivate")
        {
            FlyingFishClassesDataContext gg = new FlyingFishClassesDataContext();
            if (User.Identity.Name == fullname2 || User.Identity.Name == fullname3)
            {
                int         row         = Convert.ToInt32(e.CommandArgument);
                GridViewRow selectedRow = gvWorkPackages.Rows[row];
                WorkPackage workpackage = gg.WorkPackages.Where(wp => wp.wpId == selectedRow.Cells[0].Text).First();
                workpackage.isActive = 0;
                var wps =
                    from wp in ff.WorkPackages
                    where (wp.wpId.ToString().Contains(workpackage.wpId))
                    select wp;
                foreach (var wp in wps)
                {
                    wp.isActive = 0;
                    string s2 = wp.wpId;
                    gg.SubmitChanges();
                }
                gg.SubmitChanges();

                populateManageProject();
            }
            else
            {
                MessageBox.Show("You are not the project manager.");
            }
        }
        // }
        //catch (Exception exception)
        //{
        //lblException.Text = exception.StackTrace;
        //}
    }
Exemplo n.º 19
0
 private void UnHookWorkPackage(WorkPackage workPackage)
 {
     workPackage.Saved     -= WorkPackage_Saved;
     workPackage.Saving    -= WorkPackage_Saving;
     workPackage.Reloading -= WorkPackage_Reloading;
     workPackage.Reloaded  -= WorkPackage_Reloaded;
 }
Exemplo n.º 20
0
 private void WorkPackage_Reloading(object sender, CancelEventArgs e)
 {
     if (!InvokeRequired)
     {
         workPackageBeforeReloading = (WorkPackage)sender;
     }
 }
Exemplo n.º 21
0
        public static void ExecuteActivity(object Parameter)
        {
            WorkPackage WorkPackage = (WorkPackage)Parameter;
            Rectangle   Assignment  = (Rectangle)WorkPackage.Assignment;



            //Step 1: Deskew
            Bitmap ImageToDeskew;

            ImageToDeskew = WorkPackage.Image.Image;

            DocumentSkewChecker skewChecker = new DocumentSkewChecker();

            skewChecker.MinBeta = -5;
            skewChecker.MaxBeta = 5;

            // get documents skew angle
            double angle = skewChecker.GetSkewAngle(ImageToDeskew);

            if (Math.Abs(angle) > 2)
            {
                Console.WriteLine(" Deskewing original image");

                // create rotation filter
                RotateBilinear rotationFilter = new RotateBilinear(-angle);
                rotationFilter.FillColor = Color.White;

                // rotate image applying the filter
                Bitmap rotatedImage = rotationFilter.Apply(ImageToDeskew);

                //set the rotated image in the PageImage of the Workpackage
                WorkPackage.Image.Image = rotatedImage;
            }

            //WorkPackage WorkPackage = (WorkPackage)Parameter;
            //Rectangle Assignment = (Rectangle)WorkPackage.Assignment;
            int x = Assignment.X;
            int y = Assignment.Y;

            while (y < Assignment.Bottom)
            {
                x = 0;
                while (x < Assignment.Right)
                {
                    if (WorkPackage.Image.Bytes[x, y] > WorkPackage.Image.Threshold)
                    {
                        WorkPackage.Image.BinaryBytes[x, y] = 0xFF;
                    }
                    else
                    {
                        WorkPackage.Image.BinaryBytes[x, y] = 0x0;
                    }
                    x++;
                }
                y++;
            }

            SignalWorkDone();
        }
Exemplo n.º 22
0
        //Удаляет рабочий пакет
        private void ToolStripMenuItemPrintWorkscope(object sender, EventArgs e)
        {
            if (_directivesViewer.SelectedItem == null)
            {
                return;
            }

            WorkPackage wp = _directivesViewer.SelectedItem;

            if (wp.WorkPackageItemsLoaded == false)
            {
                GlobalObjects.WorkPackageCore.GetWorkPackageItemsWithCalculate(wp);
            }

            SelectWorkscopePrintTasksForm form = new SelectWorkscopePrintTasksForm(wp);

            if (form.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            ReferenceEventArgs refE = new ReferenceEventArgs();

            _workscopeReportBuilder.ReportedAircraft = wp.Aircraft;
            _workscopeReportBuilder.WorkPackage      = wp;
            _workscopeReportBuilder.AddDirectives(form.SelectedItems);
            refE.DisplayerText    = aircraftHeaderControl1.Operator + "." + wp.Title + "." + "Workscope";
            refE.RequestedEntity  = new ReportScreen(_workscopeReportBuilder);
            refE.TypeOfReflection = ReflectionTypes.DisplayInNew;
            InvokeDisplayerRequested(refE);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Публикует рабочий пакет
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolStripMenuItemPublishClick(object sender, EventArgs e)
        {
            foreach (WorkPackage item in _directivesViewer.SelectedItems)
            {
                WorkPackage wp = item;
                if (wp.Status != WorkPackageStatus.Closed)
                {
                    GlobalObjects.WorkPackageCore.Publish(item, DateTime.Now, "");
                }
                else
                {
                    switch (MessageBox.Show(@"This work package is already closed," +
                                            "\nif you want to republish it," +
                                            "\nrecordings created during its execution will be erased." + "\n\n Republish " + wp.Title + " work package?", (string)new GlobalTermsProvider()["SystemName"],
                                            MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation,
                                            MessageBoxDefaultButton.Button2))
                    {
                    case DialogResult.Yes:
                        GlobalObjects.WorkPackageCore.Publish(item, DateTime.Now, "");
                        break;

                    case DialogResult.No:
                        //arguments.Cancel = true;
                        break;
                    }
                }
            }

            AnimatedThreadWorker.DoWork -= AnimatedThreadWorkerDoWork;
            AnimatedThreadWorker.DoWork -= AnimatedThreadWorkerDoFilteringWork;
            AnimatedThreadWorker.DoWork += AnimatedThreadWorkerDoWork;

            AnimatedThreadWorker.RunWorkerAsync();
        }
Exemplo n.º 24
0
 ///<summary>
 ///</summary>
 public NonRoutineJobForm(WorkPackageRecord wpr, WorkPackage wp) : this()
 {
     _currentWorkPackage       = wp;
     _currentWorkPackageRecord = wpr;
     ataChapterComboBox.UpdateInformation();
     UpdateControl();
 }
Exemplo n.º 25
0
        private void ComboBoxWorkPackageSelectedIndexChanged(object sender, EventArgs e)
        {
            _selectedWorkPackage = comboBoxWorkPackage.SelectedItem as WorkPackage;
            hangarWorkPackageView.WorkPackage = _selectedWorkPackage;

            DoAsyncWork();
        }
Exemplo n.º 26
0
        protected void AddWorkPackageToContextMenu(WorkPackage wp)
        {
            var item = new RadMenuItem(wp.Title);

            item.Click += AddToWorkPackageItemClick;
            item.Tag    = wp;
            _toolStripMenuItemsWorkPackages.Items.Add(item);
        }
Exemplo n.º 27
0
 private void HookWorkPackage(WorkPackage workPackage)
 {
     UnHookWorkPackage(workPackage);
     workPackage.Saving    += WorkPackage_Saving;
     workPackage.Saved     += WorkPackage_Saved;
     workPackage.Reloading += WorkPackage_Reloading;
     workPackage.Reloaded  += WorkPackage_Reloaded;
 }
Exemplo n.º 28
0
 /// <summary>
 /// Создается построитель отчета Release To Service
 /// </summary>
 /// <param name="workPackage">Рабочий пакет</param>
 /// <param name="items"></param>
 /// <param name="aircraftBaseDetails"></param>
 public WorkPackageTitlePageBuilder(WorkPackage workPackage,
                                    List <KeyValuePair <string, int> > items,
                                    IEnumerable <BaseComponent> aircraftBaseDetails)
 {
     _currentWorkPackage = workPackage;
     _items = items;
     _aircraftBaseDetails = aircraftBaseDetails;
 }
Exemplo n.º 29
0
 /// <summary>
 /// Создает форму для редактирования свойств рабочего пакета
 /// </summary>
 /// <param name="currentWorkPackage">Редактируемый рабочий пакет</param>
 public WorkPackageForm(WorkPackage currentWorkPackage)
 {
     this.currentWorkPackage = currentWorkPackage;
     mode = ScreenMode.Edit;
     InitializeComponent();
     Text = ((Aircraft)currentWorkPackage.Parent).RegistrationNumber + ". " + currentWorkPackage.Title;
     UpdateInformation();
 }
        public async Task <IActionResult> CreateChildWorkPackage([Bind("WorkPackageId,WorkPackageCode,Name,Description,Contractor,Purpose,Input,Output,Activity,Status,ProjectId,ParentWorkPackageId")] WorkPackage workPackage, int?wId, int?pId)
        {
            int[] workpackageCode = new int[10];
            for (int i = 0; i < 10; i++)
            {
                workpackageCode[i] = -1;
            }
            workPackage.ProjectId = pId;
            workPackage.Status    = WorkPackage.OPENED;
            var workPackages = await _context.WorkPackages.Where(u => u.ProjectId == pId).ToListAsync();

            var parentWorkPackage = await _context.WorkPackages.FindAsync(wId);

            var project = await _context.Projects.Where(m => m.ProjectId == pId).FirstOrDefaultAsync();

            int workPackageLength = 0;

            foreach (WorkPackage tempWorkPackage in workPackages)
            {
                if (tempWorkPackage.ParentWorkPackageId == parentWorkPackage.WorkPackageId)
                {
                    workPackageLength = tempWorkPackage.WorkPackageCode.Length;
                    // Debug.WriteLine("tempWorkPackage.WorkPackageCode----------" + tempWorkPackage.WorkPackageCode);
                    workpackageCode[Int32.Parse(tempWorkPackage.WorkPackageCode.Substring(parentWorkPackage.WorkPackageCode.Length, 1))] = Int32.Parse(tempWorkPackage.WorkPackageCode);
                }
            }

            string theWorkpackageCode = null;

            for (int i = 0; i < 10; i++)
            {
                if (workpackageCode[i] == -1 && i != 0)
                {
                    theWorkpackageCode = ((Math.Pow(10, workPackageLength)) + workpackageCode[i - 1] + 1).ToString();
                    theWorkpackageCode = theWorkpackageCode.Substring(1);
                    break;
                }

                if (workpackageCode[i] == -1 && i == 0)
                {
                    theWorkpackageCode = parentWorkPackage.WorkPackageCode + "0";
                    break;
                }
            }

            workPackage.ParentWorkPackageId = wId;
            workPackage.WorkPackageCode     = theWorkpackageCode;
            if (ModelState.IsValid)
            {
                _context.Add(workPackage);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(ProjectWorkPackges), new { id = pId }));
            }
            //ViewData["ParentWorkPackageId"] = new SelectList(_context.WorkPackages, "WorkPackageId", "WorkPackageId", workPackage.ParentWorkPackageId);
            //ViewData["ProjectId"] = new SelectList(_context.Projects, "ProjectId", "ProjectId", workPackage.ProjectId);
            return(View(workPackage));
        }
    protected void btnCreateWorkPackage_Click(object sender, EventArgs e)
    {
        try
        {
            WorkPackage wp = new WorkPackage();
            if (ff.WorkPackages.Where(te => te.wpId == Convert.ToInt32(Session["projID"]) + "." + tbwpID.Text).ToArray().Length > 0 && Session["wpID"] == null)
            {
                lblError.Text = "Work Package already exists";
            }
            else
            {
                if (Session["wpID"] == null)
                    wp.wpId = Convert.ToInt32(Session["projID"]) + "." + tbwpID.Text;
                else
                {
                    wp.wpId = Session["wpID"].ToString() + "." + tbwpID.Text;
                    if (ff.WorkPackages.Where(te => te.wpId == Session["wpID"].ToString() + "." + tbwpID.Text).ToArray().Length > 0)
                    {
                        lblError.Text = "Work Package already exists";
                        return;
                    }
                }
                wp.name = tbwpName.Text;
                wp.description = tbDescription.Text;
                wp.projId = Convert.ToInt32(Session["projID"]);
                wp.isActive = 1;
                Session["wpID"] = wp.wpId;
                ff.WorkPackages.InsertOnSubmit(wp);
                ff.SubmitChanges();
                divCreateWorkPackage.Visible = false;
                divCreateSuccess.Visible = true;
                lblSuccessMsg.Text = "Work Package(" + wp.wpId + ") is created successfully.";

            }
        }
        catch (Exception exception)
        {
            //lblException.Text = exception.StackTrace;
        }
    }
 partial void DeleteWorkPackage(WorkPackage instance);
 partial void UpdateWorkPackage(WorkPackage instance);
 partial void InsertWorkPackage(WorkPackage instance);
	private void detach_WorkPackages(WorkPackage entity)
	{
		this.SendPropertyChanging();
		entity.Project = null;
	}
 protected void populateParentWPs(String[] wpArray)
 {
     try
     {
         List<WorkPackage> l = new List<WorkPackage>();
         string s = "";
         for (int j = wpArray.Length - 1; j > 1; j--)
         {
             for (int i = 0; i < j; i++)
             {
                 if (i == j - 1)
                     s += wpArray[i];
                 else
                     s += wpArray[i] + ".";
             }
             var subwp =
                         from wp in ff.WorkPackages
                         where (wp.wpId.ToString() == s && !wp.wpId.ToString().Contains(Session["wpID"].ToString()) && wp.isActive == 1)
                         select new { wp.wpId, wp.name, wp.unallocated_dollars, wp.allocated_dollars, wp.description };
             WorkPackage temp = new WorkPackage();
             temp.wpId = s;
             temp.unallocated_dollars = subwp.First().unallocated_dollars;
             temp.allocated_dollars = subwp.First().allocated_dollars;
             temp.name = subwp.First().name;
             l.Add(temp);
             s = "";
         }
         l.Reverse();
         gvParentsWP.DataSource = l;
         gvParentsWP.DataBind();
     }
     catch (Exception e)
     {
         //They are in an inactive workpackage
     }
 }