Esempio n. 1
0
        public void Deletar(entity_Time objTime)
        {
            SqlCommand cmd = null;

            IGerenciadorTransacao objGerenciadorTransacao = null;

            try
            {
                using (objGerenciadorTransacao = FabricaGerenciadorTransacao.GetGerenciador(TipoBDGerenciador.SqlServer))
                {
                    cmd = new SqlCommand(this.Delete);

                    cmd.Parameters.AddWithValue("@id", objTime.TimeID);


                    objGerenciadorTransacao.Execute(cmd);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (cmd != null)
                {
                    cmd.Dispose();
                }
            }
        }
Esempio n. 2
0
        public void Adicionar(entity_Time objTime)
        {
            SqlCommand cmd = null;

            IGerenciadorTransacao objGerenciadorTransacao = null;

            try
            {
                using (objGerenciadorTransacao = FabricaGerenciadorTransacao.GetGerenciador(TipoBDGerenciador.SqlServer))
                {
                    cmd = new SqlCommand(this.Insert);

                    cmd.Parameters.AddWithValue("@Time", objTime.Time);
                    cmd.Parameters.AddWithValue("@Estado", objTime.Estado);
                    cmd.Parameters.AddWithValue("@Cores", objTime.Cores);


                    objGerenciadorTransacao.Execute(cmd);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (cmd != null)
                {
                    cmd.Dispose();
                }
            }
        }
Esempio n. 3
0
        public ActionResult Delete(int id)
        {
            regranegocio_Time regranegocio_Time = null;
            entity_Time       objTime           = null;

            try
            {
                regranegocio_Time = new regranegocio_Time();
                objTime           = new entity_Time();

                objTime.TimeID = id;

                if (regranegocio_Time.Deletar(objTime))
                {
                    ViewBag.Mensagem = "Time Excluido com Sucesso.";
                }


                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                return(View("Index"));
            }
        }
Esempio n. 4
0
        public void Deletar(entity_Time objTime)
        {
            dal_Time dalTime = null;

            try
            {
                dalTime = new dal_Time();

                dalTime.Deletar(objTime);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 5
0
        public ActionResult Update(int id, entity_Time objTime)
        {
            regranegocio_Time regranegocio_Time = null;

            try
            {
                regranegocio_Time = new regranegocio_Time();

                regranegocio_Time.Atualizar(objTime);

                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                return(View("Index"));
            }
        }
Esempio n. 6
0
        public IList <entity_Time> Pesquisar()
        {
            dal_Time    dalTime = null;
            entity_Time objTime = null;
            var         lstTime = new List <entity_Time>();
            DataTable   dt      = null;

            try
            {
                dalTime = new dal_Time();
                dt      = dalTime.Pesquisar();

                foreach (DataRow dr in dt.Rows)
                {
                    objTime = new entity_Time();

                    if (!Convert.IsDBNull(dr["TimeID"]))
                    {
                        objTime.TimeID = Convert.ToInt32(dr["TimeID"]);
                    }

                    if (!Convert.IsDBNull(dr["Time"]))
                    {
                        objTime.Time = dr["Time"].ToString();
                    }

                    if (!Convert.IsDBNull(dr["Estado"]))
                    {
                        objTime.Estado = dr["Estado"].ToString();
                    }

                    if (!Convert.IsDBNull(dr["Cores"]))
                    {
                        objTime.Cores = dr["Cores"].ToString();
                    }

                    lstTime.Add(objTime);
                }
                return(lstTime);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 7
0
        public bool Deletar(entity_Time objTime)
        {
            repositorio_Time repositorio_Time = null;
            bool             delete           = false;

            try
            {
                repositorio_Time = new repositorio_Time();

                //Deleta Time
                repositorio_Time.Deletar(objTime);

                delete = true;

                return(delete);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 8
0
        public bool Atualizar(entity_Time objTime)
        {
            repositorio_Time repositorio_Time = null;
            bool             update           = false;

            try
            {
                repositorio_Time = new repositorio_Time();

                //Atualiza Time
                repositorio_Time.Atualizar(objTime);

                update = true;

                return(update);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 9
0
        public bool Adicionar(entity_Time objTime)
        {
            repositorio_Time repositorio_Time = null;
            bool             insert           = false;

            try
            {
                repositorio_Time = new repositorio_Time();

                //Adiciona Time
                repositorio_Time.Adicionar(objTime);

                insert = true;

                return(insert);
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
        }
Esempio n. 10
0
        public ActionResult Create(entity_Time objTime)
        {
            regranegocio_Time regranegocio_Time = null;

            try
            {
                if (ModelState.IsValid)
                {
                    regranegocio_Time = new regranegocio_Time();


                    if (regranegocio_Time.Adicionar(objTime))
                    {
                        ViewBag.Mensagem = "Time Cadastrado com Sucesso.";
                    }
                }

                return(View());
            }
            catch (Exception)
            {
                return(View("Index"));
            }
        }