Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 private void UcBarnAssignedOnBarnRemoved(object sender, UcBarnAssigned ucBarnAssigned)
 {
     BarnsAssignedControls.Remove(ucBarnAssigned);
     BarnsContainer.Controls.Remove(ucBarnAssigned);
     BarnsControl();
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
 private void UcBarnAssignedOnBarnRemoved(object sender, UcBarnAssigned ucBarnAssigned)
 {
     BarnsAssignedControls.Remove(ucBarnAssigned);
     BarnsContainer.Controls.Remove(ucBarnAssigned);
     BarnsControl();
 }