/// <summary>
        /// Fill the Countries table from the Database basing on the AirlineCompanies data source
        /// </summary>
        private void AddCountries()
        {
            _currentDAO = CreateAppropriateDAO();
            _currentDAO.DeleteAllNotRegardingForeignKeys();

            List <string> countries_names = new List <string>();

            foreach (var s_airline in _airlineCompaniesFromExternalSource)
            {
                s_airline.TryGetValue("country", out string s_airline_country_name);
                if (!countries_names.Contains(s_airline_country_name))
                {
                    countries_names.Add(s_airline_country_name);
                }
            }


            foreach (var s_country_name in countries_names)
            {
                Country country = new Country();
                country.COUNTRY_NAME       = _regex.Replace(s_country_name, string.Empty);
                country.COUNTRY_IDENTIFIER = Convert.ToInt64(Statics.GetUniqueKeyOriginal_BIASED(_rnd.Next(4, 9), Charset.OnlyNumber));
                _currentDAO.Add(country as T);
            }
        }
예제 #2
0
 public void Salvar(Log log)
 {
     try
     {
         _dao.Add(log);
         _dao.CommitChanges();
     }catch (Exception ex) { }
 }
예제 #3
0
 public async Task <IActionResult> Create([Bind("Codigo,Nome,Salario")] Funcionario funcionario)
 {
     if (ModelState.IsValid)
     {
         _dao.Add(funcionario);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(funcionario));
 }
        private void AddOneTicket()
        {
            Ticket   ticket         = new Ticket();
            Customer randomCustomer = _customers[_rnd.Next(_customers.Count)];
            Flight   randomFlight   = _flights[_rnd.Next(_flights.Count)];

            ticket.CUSTOMER_ID = randomCustomer.ID;
            ticket.FLIGHT_ID   = randomFlight.ID;

            _currentDAO = CreateAppropriateDAO();
            _currentDAO.Add(ticket as T);
        }
예제 #5
0
파일: FacadeCrud.cs 프로젝트: RaiBSilva/LES
        public string Cadastrar <T>(T e) where T : EntidadeDominio
        {
            string msg = ExecutarRegras(e);

            if (msg == "")
            {
                IDAO <T> dao = new DAO <T>(_contexto);
                return(dao.Add(e));
            }

            return(msg);
        }
예제 #6
0
        public IHttpActionResult Post(Tarefa Tarefa)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Tarefa.CreatedAt = DateTime.Now;
            Tarefa.UpdatedAt = DateTime.Now;

            var added = Dao.Add(Tarefa);

            return(Ok(added));
        }
예제 #7
0
        public IHttpActionResult Post(Prioridade prioridade)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            prioridade.CreatedAt = DateTime.Now;
            prioridade.UpdatedAt = DateTime.Now;

            var added = Dao.Add(prioridade);

            return(Ok(added));
        }
        public IHttpActionResult Post(ListaDeTarefas ListaDeTarefas)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            ListaDeTarefas.CreatedAt = DateTime.Now;
            ListaDeTarefas.UpdatedAt = DateTime.Now;

            var added = Dao.Add(ListaDeTarefas);

            return(Ok(added));
        }
 public void Salvar(ExecucaoAgendamento exeAgd)
 {
     try
     {
         if (exeAgd.IdExecucaoAgendamento == 0)
         {
             _dao.Add(exeAgd);
             _dao.CommitChanges();
         }
         else
         {
             _dao.Update(exeAgd, exeAgd.IdExecucaoAgendamento);
         }
     }catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #10
0
 public void Salvar(Arquivo arquivo)
 {
     try
     {
         if (arquivo.IdArquivo == 0)
         {
             _dao.Add(arquivo);
             _dao.CommitChanges();
         }
         else
         {
             _dao.Update(arquivo, arquivo.IdArquivo);
         }
     }catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #11
0
 public void Salvar(Emissor emissor)
 {
     try
     {
         if (emissor.IdEmissor == 0)
         {
             _dao.Add(emissor);
             _dao.CommitChanges();
         }
         else
         {
             _dao.Update(emissor);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #12
0
 public void Salvar(Agendamento agendamento)
 {
     try
     {
         if (agendamento.IdAgendamento == 0)
         {
             _dao.Add(agendamento);
             _dao.CommitChanges();
         }
         else
         {
             _dao.Update(agendamento, agendamento.IdAgendamento);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #13
0
 public void Salvar(Subcampo subcampo)
 {
     try
     {
         if (subcampo.IdSubcampo == 0)
         {
             _dao.Add(subcampo);
             _dao.CommitChanges();
         }
         else
         {
             _dao.Update(subcampo);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private void AddOneFlight()
        {
            Flight         flight        = new Flight();
            AirlineCompany randomAirline = _airlineCompanies[_rnd.Next(_airlineCompanies.Count)];

            flight.AIRLINECOMPANY_ID        = randomAirline.ID;
            flight.ORIGIN_COUNTRY_CODE      = _countries[_rnd.Next(_countries.Count)].ID;
            flight.DESTINATION_COUNTRY_CODE = _countries[_rnd.Next(_countries.Count)].ID;

            var departureDateTime = Statics.GetRandomDate(DateTime.Now, DateTime.Now.AddHours(Convert.ToDouble(_rnd.Next(1, 3))).AddMinutes(Convert.ToDouble(_rnd.Next(10, 55))));

            flight.DEPARTURE_TIME = departureDateTime;
            //flight.LANDING_TIME = Statics.GetRandomDate(flight.DEPARTURE_TIME, new DateTime(flight.DEPARTURE_TIME.Year, flight.DEPARTURE_TIME.Month, flight.DEPARTURE_TIME.Day, flight.DEPARTURE_TIME.Hour + _rnd.Next(0, 24 - flight.DEPARTURE_TIME.Hour), 0, 0));
            flight.LANDING_TIME      = Statics.GetRandomDate(flight.DEPARTURE_TIME, flight.DEPARTURE_TIME.AddHours(_rnd.Next(18, 20)).AddMinutes(_rnd.Next(5, 45)));
            flight.REMAINING_TICKETS = _rnd.Next(0, 500);

            _currentDAO = CreateAppropriateDAO();
            _currentDAO.Add(flight as T);
        }
예제 #15
0
 public void Salvar(TipoDado tipoDado)
 {
     try
     {
         if (tipoDado.IdTipoDado == 0)
         {
             _dao.Add(tipoDado);
             _dao.CommitChanges();
         }
         else
         {
             _dao.Update(tipoDado);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #16
0
 public void Salvar(Layout layout)
 {
     try
     {
         if (layout.IdLayout == 0)
         {
             _dao.Add(layout);
             _dao.CommitChanges();
         }
         else
         {
             _dao.Update(layout);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #17
0
 public void Salvar(Registro registro)
 {
     try
     {
         if (registro.IdRegistro == 0)
         {
             _dao.Add(registro);
             _dao.CommitChanges();
         }
         else
         {
             _dao.Update(registro);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #18
0
 public void Salvar(Informacao informacao)
 {
     try
     {
         if (informacao.idInformacao == 0)
         {
             _dao.Add(informacao);
             _dao.CommitChanges();
         }
         else
         {
             _dao.Update(informacao);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #19
0
 public void Salvar(Usuario usuario)
 {
     try
     {
         usuario.Senha = LAB5Utils.CriptografiaUtils.TripleDESEncrypt(usuario.Senha, true);
         if (usuario.IdUsuario == 0)
         {
             _dao.Add(usuario);
             _dao.CommitChanges();
         }
         else
         {
             _dao.Update(usuario);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #20
0
        public void Salvar(TransacaoElo transacao)
        {
            try
            {
                if (transacao.Id_TransacaoElo == 0)
                {
                    _dao.Add(transacao);

                    _dao.CommitChanges();
                }
                else
                {
                    _dao.Update(transacao);
                }
            }
            catch (DbUpdateException dbex)
            {
                throw dbex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #21
0
파일: UnitDAO.cs 프로젝트: Lucasus/sepuku
 public void Update(Unit u)
 {
     DataObject = u;
     DAO <UnitDAO, Unit> .Add("SepUnitUpdate", this);
 }
예제 #22
0
파일: UnitDAO.cs 프로젝트: Lucasus/sepuku
 public int Add(Unit o)
 {
     DataObject = o;
     return(DAO <UnitDAO, Unit> .Add("SepUnitAdd", this));
 }
예제 #23
0
 public int Add(Technology o)
 {
     DataObject = o;
     return(DAO <TechnologyDAO, Technology> .Add("DnTechnologyAdd", this));
 }
예제 #24
0
 public int Add(Order o)
 {
     DataObject = o;
     return(DAO <OrderDAO, Order> .Add("SepOrderAdd", this));
 }
예제 #25
0
 public int Add(Kingdom o)
 {
     DataObject = o;
     return(DAO <KingdomDAO, Kingdom> .Add("SepKingdomAdd", this));
 }
예제 #26
0
파일: EventDAO.cs 프로젝트: Lucasus/sepuku
 public int Add(Event o)
 {
     DataObject = o;
     return(DAO <EventDAO, Event> .Add("DnEventAdd", this));
 }
예제 #27
0
 public int Add(User user)
 {
     DataObject = user;
     return(DAO <UserDAO, User> .Add("DnUserAdd", this));
 }
예제 #28
0
 public int Add(UnitType o)
 {
     DataObject = o;
     return(DAO <UnitTypeDAO, UnitType> .Add("DnUnitTypeAdd", this));
 }
예제 #29
0
 public int Add(Log o)
 {
     DataObject = o;
     return(DAO <LogDAO, Log> .Add("DnLogAdd", this));
 }
예제 #30
0
 public int Add(OrderType o)
 {
     DataObject = o;
     return(DAO <OrderTypeDAO, OrderType> .Add("SepOrderTypeAdd", this));
 }