Ejemplo n.º 1
0
        public bool Confirm()
        {
            try
            {
                //remove equipe caso tipo de Fora de Serviço seja não operacional, desde que não seja por equipe incompleta
                if (!string.IsNullOrEmpty(SelectedOutType.OutServiceTypeId) &&
                    SelectedOutType.OutServiceTypeId.StartsWith("NO") &&
                    !SelectedOutType.OutServiceTypeId.Equals("NO_EQI") &&
                    !SelectedOutType.OutServiceTypeId.Equals("NO_SEQ"))
                {
                    if (!ShowConfirmMessage("Colocar uma AM como 'Não Operacional' fará ela PERDER SUA EQUIPE. Deseja realmente continuar?"))
                    {
                        return(false);
                    }

                    UnitBusiness.LogOutAllMembers(UnitId);
                    UnitForceMapBusiness.LogOutAllMembers(UnitId);
                    UnitForceMapBusiness.RemoveSubstituteUnit(UnitId);
                }

                int alarmTime = (string.IsNullOrEmpty(AlarmTime) ? 0 : int.Parse(AlarmTime));
                Location = (string.IsNullOrEmpty(Location) ? string.Empty : Location);
                double?mileage = (string.IsNullOrEmpty(Mileage) ? null : (double?)double.Parse(Mileage));

                UnitBusiness.UnitOutOfService(UnitId, SelectedOutType.OutServiceTypeId, Location, alarmTime, mileage, Remarks);

                return(true);
            }
            catch
            {
                ShowMessage("Falha ao realizar solicitação");
            }

            return(false);
        }