Example #1
0
        private void FormOnBarnSelected(object sender, Barn barn)
        {
            if (RemainBirdsAmount <= 0)
            {
                MessageBoxDisplayService.ShowError("Ya se han asignado el total de aves del lote a los galpones");
                return;
            }

            var ucBarnAssigned = new UcBarnAssigned();

            ucBarnAssigned.MessageBoxDisplayService = this.MessageBoxDisplayService;
            ucBarnAssigned.FormFactory  = this.FormFactory;
            ucBarnAssigned.BarnRemoved += UcBarnAssignedOnBarnRemoved;

            ucBarnAssigned.BarnAssigned = new BarnAssigned()
            {
                BarnId       = barn.Id,
                BarnCapacity = barn.Capacity ?? 0,
                BarnName     = barn.Name,
                BirdsAmount  = (int)(RemainBirdsAmount > barn.Capacity ? barn.Capacity.GetValueOrDefault() : RemainBirdsAmount)
            };

            BarnsAssignedControls.Add(ucBarnAssigned);
            BarnsContainer.Controls.Add(ucBarnAssigned);
        }
Example #2
0
 private void UcBarnAssignedOnBarnRemoved(object sender, UcBarnAssigned ucBarnAssigned)
 {
     BarnsAssignedControls.Remove(ucBarnAssigned);
     BarnsContainer.Controls.Remove(ucBarnAssigned);
     BarnsControl();
 }
Example #3
0
        private void FormOnBarnSelected(object sender, Barn barn)
        {
            if (RemainBirdsAmount <= 0)
            {
                MessageBoxDisplayService.ShowError("Ya se han asignado el total de aves del lote a los galpones");
                return;
            }

            var ucBarnAssigned = new UcBarnAssigned();

            ucBarnAssigned.MessageBoxDisplayService = this.MessageBoxDisplayService;
            ucBarnAssigned.FormFactory = this.FormFactory;
            ucBarnAssigned.BarnRemoved += UcBarnAssignedOnBarnRemoved;

            ucBarnAssigned.BarnAssigned = new BarnAssigned()
                                          {
                                              BarnId = barn.Id,
                                              BarnCapacity = barn.Capacity ?? 0,
                                              BarnName = barn.Name,
                                              BirdsAmount = (int) (RemainBirdsAmount > barn.Capacity ? barn.Capacity.GetValueOrDefault() : RemainBirdsAmount)
                                          };

            BarnsAssignedControls.Add(ucBarnAssigned);
            BarnsContainer.Controls.Add(ucBarnAssigned);
        }
Example #4
0
 private void UcBarnAssignedOnBarnRemoved(object sender, UcBarnAssigned ucBarnAssigned)
 {
     BarnsAssignedControls.Remove(ucBarnAssigned);
     BarnsContainer.Controls.Remove(ucBarnAssigned);
     BarnsControl();
 }