Exemple #1
0
 public void Update(SolicitanteEntity objSolicitanteEnt)
 {
     try
     {
         cn = objConn.Conectar();
         cn.Open();
         const string Query = "SP_UPD_SOLICITANTE";
         using (SqlCommand cmd = new SqlCommand(Query, cn))
         {
             cmd.Parameters.AddWithValue("@nombre", objSolicitanteEnt.Nombres);
             cmd.Parameters.AddWithValue("@apepaterno", objSolicitanteEnt.ApePaterno);
             cmd.Parameters.AddWithValue("@apematerno", objSolicitanteEnt.ApeMaterno);
             cmd.Parameters.AddWithValue("@id_solicitante", objSolicitanteEnt.IdSolicitante);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.ExecuteNonQuery();
         }
     }
     catch (Exception ex)
     {
         ex.Message.ToString();
         throw;
     }
     finally
     {
         if (cn.State == ConnectionState.Open)
         {
             cn.Close();
         }
     }
 }
Exemple #2
0
 private void ActualizarSolicitante()
 {
     try
     {
         SolicitanteEntity objEntSol = new SolicitanteEntity();
         objEntSol.Nombres       = txtNombre.Text.Trim().ToUpper();
         objEntSol.ApePaterno    = txtApePaterno.Text.Trim().ToUpper();
         objEntSol.ApeMaterno    = txtApeMaterno.Text.Trim().ToUpper();
         objEntSol.IdSolicitante = IdSolicitante;
         objSolicitanteController.ActualizarSoli(objEntSol);
         //MessageConfirmation("Solicitante registrado >>>" + id_solicitante);
     }
     catch (Exception ex)
     {
         MessageBox.Show(string.Format("Error: {0}", ex.Message), "Error inesperado solicitante");
     }
 }
Exemple #3
0
        public int Insertar(SolicitanteEntity objSolicitanteEnt)
        {
            int id_solicitante = 0;

            try
            {
                cn = objConn.Conectar();
                cn.Open();
                const string Query = "SP_INS_SOLICITANTE";
                using (SqlCommand cmd = new SqlCommand(Query, cn))
                {
                    cmd.Parameters.AddWithValue("@nombre", objSolicitanteEnt.Nombres);
                    cmd.Parameters.AddWithValue("@apepaterno", objSolicitanteEnt.ApePaterno);
                    cmd.Parameters.AddWithValue("@apematerno", objSolicitanteEnt.ApeMaterno);

                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@id_solicitante", SqlDbType.Int).Direction = ParameterDirection.Output;
                    cmd.ExecuteNonQuery();

                    id_solicitante = Convert.ToInt32(cmd.Parameters["@id_solicitante"].Value.ToString());
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
                throw;
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close();
                }
            }
            return(id_solicitante);
        }
 public void ActualizarSoli(SolicitanteEntity objEntSol)
 {
     objSoliModel.Update(objEntSol);
 }
 public int Insertar(SolicitanteEntity objEntSol)
 {
     return(objSoliModel.Insertar(objEntSol));
 }