コード例 #1
0
        public async Task <ActionResult> EspecificaMotivo(MotivoModel motivo)
        {
            if (ModelState.IsValid)
            {
                IdentityMessage message = new IdentityMessage();

                string MotivoFormatado = motivo.MotivoDaRemocao.Replace(Environment.NewLine, "<br />");

                message.Body        = "Sugiro remoção deste campeonato.<br />Motivo: " + motivo.MotivoDaRemocao;
                message.Destination = "*****@*****.**";
                message.Subject     = "Sugestão de remoção no campeonato " + motivo.Nome + " - de " + User.Identity.Name;

                EmailService emailService = new EmailService();

                await emailService.SendAsync(message);


                return(RedirectToAction("AwaitingApproval"));
            }

            else
            {
                return(View(motivo));
            }
        }
コード例 #2
0
        //METODO DE BUSCA POR ID
        public MotivoModel SelectByID(int id)
        {
            try
            {
                String sql = "SELECT mot_cod, mot_descricao FROM motivo WHERE mot_cod = @id";
                con = Conexao.conectar();
                MySqlCommand cmd = new MySqlCommand(sql, con);
                cmd.Parameters.AddWithValue("@id", id);
                MySqlDataReader dr;

                MotivoModel motivo = new MotivoModel();
                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

                while (dr.Read())
                {
                    motivo.mot_cod       = Convert.ToInt32(dr["mot_cod"]);
                    motivo.mot_descricao = dr["mot_descricao"].ToString();
                }
                return(motivo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                Conexao.fechar();
            }
        }
コード例 #3
0
        // GET
        public ActionResult EspecificaMotivo(string time)
        {
            MotivoModel motivo = new MotivoModel();

            motivo.Nome = time;

            return(View(motivo));
        }
コード例 #4
0
        // GET
        public ActionResult EspecificaMotivo(string campeonato)
        {
            MotivoModel motivo = new MotivoModel();

            motivo.Nome = campeonato;

            return(View(motivo));
        }
コード例 #5
0
        public void ShearhName(DataGridView dgv, string nombre)
        {
            MotivoModel  objMod = new MotivoModel();
            MotivoEntity objEnt = new MotivoEntity();

            objEnt.Nombre = nombre;
            objMod.BuscarMotivo(dgv, nombre);
        }
コード例 #6
0
        public bool Update(MotivoModel motivo)
        {
            MotivoDAO dao = new MotivoDAO();

            if (motivo.mot_cod != 0 || motivo.mot_descricao != string.Empty)
            {
                dao.Update(motivo);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #7
0
        //METODDO DE INSERIR
        public bool Inserir(MotivoModel motivo)
        {
            MotivoDAO dao = new MotivoDAO();

            //VERIFICA SE TEM DADOS DENTRO DO OBJETO
            if (motivo.mot_descricao != string.Empty)
            {
                dao.Insert(motivo);
                //SE DER TUDO CERTO RETORNA TRUE
                return(true);
            }
            else
            {
                //SE NAO RETORNA FALSE
                return(false);
            }
        }
コード例 #8
0
        //======================================================================================
        //======================================================================================

        //=========== MOTIVOS DE TROCAS ========================================================

        private void btnSalvarMotivo_Click(object sender, EventArgs e)
        {
            try
            {
                MotivoControl control = new MotivoControl();
                MotivoModel   tipo    = new MotivoModel();

                tipo.mot_descricao = txtDescMotivo.Text;

                switch (seletor)
                {
                case 0:
                    if (!control.Inserir(tipo))
                    {
                        MessageBox.Show("Verifique os campos digitados", "ATENÇÃO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    break;

                case 1:

                    if (txtCodTipo.Text != string.Empty)
                    {
                        tipo.mot_cod = Convert.ToInt32(txtCodMotivo.Text);
                    }

                    if (!control.Update(tipo))
                    {
                        MessageBox.Show("Verifique os campos digitados", "ATENÇÃO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    break;

                default:
                    MessageBox.Show("Selecione a opção NOVO CADASTRO ou EDITAR", "ATENÇÃO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERRO: " + ex, "ATENÇÃO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            finally
            {
                //CHAMA METODO PARA LIMPAR OS CAMPOS
                LimpaCampoMotivo();
            }
        }
コード例 #9
0
 //METODO DE INSERT
 public void Insert(MotivoModel motivo)
 {
     try
     {
         String sql = "INSERT INTO motivo (mot_descricao) VALUES (@descricao)";
         con = Conexao.conectar();
         MySqlCommand cmd = new MySqlCommand(sql, con);
         cmd.Parameters.AddWithValue("@descricao", motivo.mot_descricao);
         cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         Conexao.fechar();
     }
 }
コード例 #10
0
        private void btnListarMotivo_Click(object sender, EventArgs e)
        {
            MotivoControl        control = new MotivoControl();
            MotivoModel          model   = new MotivoModel();
            frmListaCadastrosAdm lista   = new frmListaCadastrosAdm(3);

            lista.ShowDialog();

            if (lista.codigo != 0)
            {
                model = control.SelectByID(lista.codigo);

                txtCodMotivo.Text  = Convert.ToString(model.mot_cod);
                txtDescMotivo.Text = model.mot_descricao;
            }
            else
            {
                LimpaCampoMotivo();
            }
        }
コード例 #11
0
 //METODO DE UPDATE
 public void Update(MotivoModel motivo)
 {
     try
     {
         String sql = "UPDATE motivo SET mot_descricao = @descricao WHERE mot_cod = @id ";
         con = Conexao.conectar();
         MySqlCommand cmd = new MySqlCommand(sql, con);
         cmd.Parameters.AddWithValue("@id", motivo.mot_cod);
         cmd.Parameters.AddWithValue("@descricao", motivo.mot_descricao);
         cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         Conexao.fechar();
     }
 }
コード例 #12
0
        public static FormularioModel GetFormularioXSeleccion(MotivoModel motivo, NegocioModel negocio)
        {
            Query supQuery = new Query();

            CompositeTest where = new CompositeTest();
            where.SetOperator(CompositeTest.AND);
            where.Add(new AttributeTest("idMotivo", motivo.IdMotivo, AttributeTest.EQUAL));
            where.Add(new AttributeTest("idNegocio", negocio.IdNegocio, AttributeTest.EQUAL));

            supQuery.Where(where);

            GenericList <SeleccionFormulario> seleccionFormulario = SeleccionFormulario.FindWithQuery(supQuery);

            if (seleccionFormulario.Size() > 0)
            {
                return(FormularioModel.Create(seleccionFormulario[0].Formulario));
            }
            else
            {
                return(null);
            }
        }
コード例 #13
0
        public void Delete(MotivoEntity objEnt)
        {
            MotivoModel objMod = new MotivoModel();

            objMod.Delete(objEnt);
        }
コード例 #14
0
        public void Update(MotivoEntity objEnt)
        {
            MotivoModel objMod = new MotivoModel();

            objMod.Update(objEnt);
        }
コード例 #15
0
        public void Add(MotivoEntity objEnt)
        {
            MotivoModel objMod = new MotivoModel();

            objMod.Insert(objEnt);
        }
コード例 #16
0
        public void View(DataGridView dgv)
        {
            MotivoModel objMod = new MotivoModel();

            objMod.ListarMotivos(dgv);
        }
コード例 #17
0
        public static FormularioModel GetFormularioXSeleccion(MotivoModel motivo, NegocioModel negocio)
        {
            Query supQuery = new Query();

            CompositeTest where = new CompositeTest();
            where.SetOperator(CompositeTest.AND);
            where.Add(new AttributeTest("idMotivo", motivo.IdMotivo, AttributeTest.EQUAL));
            where.Add(new AttributeTest("idNegocio", negocio.IdNegocio, AttributeTest.EQUAL));

            supQuery.Where(where);

            GenericList<SeleccionFormulario> seleccionFormulario = SeleccionFormulario.FindWithQuery(supQuery);
            if (seleccionFormulario.Size() > 0)
                return FormularioModel.Create(seleccionFormulario[0].Formulario);
            else
                return null;
        }