コード例 #1
0
 private void GetIsSelfCheckList(Operation operation)
 {
     foreach (var selfCheck in selfChecks)
     {
         var training = IdHelper.GetEntityByID(trainings, selfCheck.TrainingID);
         if (training.OperationID == operation.ID)
         {
             isSelfCheck.Add(training);
         }
     }
 }
コード例 #2
0
        private void GetTrainingDetails(Training training)
        {
            var project          = IdHelper.GetEntityByID(projects, training.ProjectID);
            var model            = IdHelper.GetEntityByID(project.Models, training.ModelID);
            var operation        = IdHelper.GetEntityByID(model.Operations, training.OperationID);
            var staff            = Staff.GetStaffByID(training.StaffID, staffs);
            var staffName        = staff.GetStaffFullName();
            var modelDescription = $"{project.Name} {model.Name}";

            trainingTextBox.Text             = $"{staffName}; {modelDescription}; {operation.Name}";
            selfCheckReport.StaffID          = training.StaffID.ToString();
            selfCheckReport.StaffName        = staffName;
            selfCheckReport.ModelDescription = modelDescription;
            selfCheckReport.Operation        = operation.Name;
        }
コード例 #3
0
        private void FillTrainingsDataGridView()
        {
            table.Rows.Clear();
            if (trainings == null)
            {
                return;
            }
            foreach (var training in trainings)
            {
                var currentStaff   = Staff.GetStaffByID(training.StaffID, staffs);
                var currentTrainer = Staff.GetStaffByID(training.TrainerID, staffs);
                var currentProject = IdHelper.GetEntityByID(projects, training.ProjectID);
                if (currentProject == null)
                {
                    continue;
                }
                var currentModel = IdHelper.GetEntityByID(currentProject.Models, training.ModelID);
                if (currentModel == null)
                {
                    continue;
                }
                var currentOperation = IdHelper.GetEntityByID(currentModel.Operations, training.OperationID);
                if (currentOperation == null)
                {
                    continue;
                }

                if (currentStaff != null && currentTrainer != null && currentOperation != null)
                {
                    FillSelfCheckColumns(training);
                    var row = table.NewRow();
                    row["trainingID"]     = training.ID.ToString();
                    row["Сотрудник"]      = currentStaff.GetStaffFullName();
                    row["Проект"]         = currentProject.Name;
                    row["Модель"]         = currentModel.Name;
                    row["Операция"]       = currentOperation.Name;
                    row["Инструктор"]     = currentTrainer.GetStaffFullName();
                    row["Дата начала"]    = training.StartDate.ToString("d");
                    row["Дата окончания"] = training.EndDate.ToString("d");
                    row["Дата присвоения самоконтроля"] = selfCheckDate;
                    row["Ответственный"] = selfCheckResponsiblePerson;
                    table.Rows.Add(row);
                }
            }
            bindingSource.DataSource      = table;
            outputDataGridView.DataSource = bindingSource;
            outputDataGridView.Columns["trainingID"].Visible = false;
        }
コード例 #4
0
        private List <Result> GetOutputData()
        {
            var outputData     = new List <Result>();
            var totalTrainings = GetTotalTrainingList();

            foreach (var training in totalTrainings)
            {
                var result = new Result();
                var model  = IdHelper.GetEntityByID(project.Models, training.ModelID);
                result.ModelName = model.Name;
                var operation = IdHelper.GetEntityByID(model.Operations, training.OperationID);
                result.OperationName     = operation.Name;
                result.StartTrainingDate = training.StartDate.ToString("d");
                result.EndTrainingDate   = training.EndDate.ToString("d");
                result.StaffID           = training.StaffID;
                var staff = Staff.GetStaffByID(training.StaffID, staffs);
                if (staff != null)
                {
                    result.StaffFullName = staff.GetStaffFullName();
                }

                foreach (var selfCheck in selfChecks)
                {
                    if (selfCheck.TrainingID == training.ID)
                    {
                        result.SelfCheckDate = selfCheck.Date.ToString("d");
                        break;
                    }
                    else
                    {
                        result.SelfCheckDate = "-";
                    }
                }
                outputData.Add(result);
            }
            return(outputData);
        }