Beispiel #1
0
        public FormOperacijaRada(OperationPlan operationPlan, List <Item> items, UnitOfWork unitOfWork, bool newOP = false)
        {
            _operationPlan = operationPlan;
            _unitOfWork    = unitOfWork;
            _newOP         = newOP;
            InitializeComponent();



            var bs = new BindingSource {
                DataSource = operationPlan.ProductionPlans
            };

            items.Add(new Item
            {
                Id = 0, Name = "Izaberite proizvod"
            });

            var shifts = new List <Shift>
            {
                new Shift {
                    Value = 0, Display = "Nije izabrano"
                },
                new Shift {
                    Value = 1, Display = "1 smena"
                },
                new Shift {
                    Value = 2, Display = "2 smene"
                },
                new Shift {
                    Value = 3, Display = "3 smene"
                }
            };

            var shiftsCell = new DataGridViewComboBoxCell
            {
                DataSource    = (List <Shift>)shifts,
                ValueType     = typeof(int),
                DisplayMember = "Display",
                ValueMember   = "Value",
                DisplayStyle  = DataGridViewComboBoxDisplayStyle.Nothing
            };


            var cell = new DataGridViewComboBoxCell
            {
                DataSource    = (List <Item>)items,
                ValueType     = typeof(int),
                DisplayMember = "Name",
                ValueMember   = "Id",
                DisplayStyle  = DataGridViewComboBoxDisplayStyle.Nothing
            };


            dataGridView1.Columns[1].CellTemplate = cell;
            dataGridView1.Columns[2].CellTemplate = shiftsCell;

            dataGridView1.DataSource = bs;
            DataToView();
        }
 public bool DeleteOperationPlan(OperationPlan operationPlan)
 {
     using (var _userImmovableAssetManagementPlan = new UserImmovableAssetManagementPlanRepository(_appSettings))
     {
         return(_userImmovableAssetManagementPlan.DeleteOperationPlan(operationPlan));
     }
 }
        private void EditOperationPlan(OperationPlan operationPlan, bool newOP = false)
        {
            var items             = _unitOfWork.Items.GetAllFinalItems().ToList();
            var formOperacijaRada = new FormOperacijaRada(operationPlan, items, _unitOfWork, newOP);

            formOperacijaRada.ShowDialog();
        }
 public double CalculateParallelTimeForOperationPlan(OperationPlan operationPlan)
 {
     if (operationPlan.ProductionPlans.Count < 1)
     {
         return(0);
     }
     return(0);
 }
        private void btnDodaj_Click(object sender, EventArgs e)
        {
            var operationPlan = new OperationPlan
            {
                CreationDate = DateTime.Today,
                StartDate    = DateTime.Today
            };

            _operationPlans.Add(operationPlan);
            EditOperationPlan(operationPlan, true);

            LoadOperationPlans();
        }
 public double CalculateProductionTimeForOperationPlane(OperationPlan operationPlan)
 {
     return(operationPlan.ProductionPlans.Count == 0 ? 0 : operationPlan.ProductionPlans.Sum(productionPlan => productionPlan.Quantity * _unitOfWork.WorkOperations.GetOperationTimeForItemId(productionPlan.ItemId)));
 }
        public DateTime CalculateDeadlineForOperationPlan(OperationPlan operationPlan, int shifts)
        {
            // TODO: Implement this method!!!

            return(DateTime.Today.AddDays(10));
        }