Exemple #1
0
        public void UpdateUnitInForceMap(string unitId)
        {
            UnitVM selectedUnit = this.UnitList.Where(uvm => uvm.UnitModel.UnitId == unitId)
                                  .FirstOrDefault();

            if (selectedUnit != null)
            {
                selectedUnit.UnitModel = UnitForceMapBusiness.GetCurrentUnitForceMap(unitId);
                UnitForceMapBusiness.UpdateUnitForceMap(selectedUnit.UnitModel);
            }
        }
Exemple #2
0
        public bool Confirm()
        {
            //try
            //{
            Result = false;

            VerifyRepeatedSelections();

            if (SelectedUnit.Station == null)
            {
                ShowMessage("Selecione a base da viatura");
            }
            else
            {
                if (HasConflicts())
                {
                    ShowMessage("Resolva os conflitos indicados na tela");
                }
                else
                {
                    switch (_currentShiftTime)
                    {
                    case WorkShiftModel.ShiftTime.Actual:

                        SelectedUnit.WorkShiftStarted = "T";

                        Result = UnitForceMapBusiness.UpdateUnitForceMap(SelectedUnit);
                        break;

                    case WorkShiftModel.ShiftTime.Forward:
                        Result = UnitForceMapBusiness.UpdateFutureUnitForceMap(SelectedUnit);
                        break;
                    }

                    if (!Result)
                    {
                        ShowMessage("Falha ao confirmar edição da viatura");
                    }
                }
            }

            /*}
             * catch (UnauthorizedAccessException ex)
             * {
             *  ShowMessage(ex.Message);
             * }
             * catch
             * {
             *  ShowMessage("Falha ao confirmar edição da viatura");
             * }*/

            return(Result);
        }
Exemple #3
0
        private void LoginSelectedUnit()
        {
            if (!CadBusiness.UnitInService(SelectedTargetUnitId, RemarkText))
            {
                throw new Exception();
            }

            UnitForceMapModel unit = UnitForceMapBusiness.GetCurrentUnitForceMap(SelectedTargetUnitId);

            if (UnitForceMapBusiness.UpdateUnitForceMap(unit) == null)
            {
                throw new Exception();
            }
        }
Exemple #4
0
        public void StartQAP()
        {
            if (this.SelectedUnit.UnitModel.OutType != OutOfServiceTypeModel.OUT_TYPE_AGUARDANDO_QAP)
            {
                MessageBox.Show("Apenas viaturas \"Fora de Serviço - Aguardando QAP\" podem ser selecionadas", "Atenção!", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                if (MessageBox.Show("Confirma o início de QAP da AM '" + this.SelectedUnit.UnitModel.UnitId + "'?\n\n (Essa ação não pode ser revertida)", "Atenção!", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    try
                    {
                        UnitForceMapBusiness.StartQAP(this.SelectedUnit.UnitModel);
                        UnitForceMapBusiness.UpdateUnitForceMap(this.SelectedUnit.UnitModel);

                        //SelectedUnit.UnitModel = UnitForceMapBusiness.GetUnitForceMapModel(this.SelectedUnit.UnitModel.UnitId, DateTime.Now, this.CurrentWorkShift);
                    }
                    catch (Exception exception)
                    {
                        throw exception;
                    }
                }
            }
        }