예제 #1
0
파일: CD_Area.cs 프로젝트: Gsaico/IDSTORE
        public bool VerificarExisteArea(CE_Area objce_area)
        {
            //la funcion me permite recuperar los datos
            try
            {

                OracleConnection cnx = Conexion.ObtenerConexionOracle();
                OracleCommand cmd = new OracleCommand(String.Format("select * from area where nombrearea ='{0}'", objce_area.nombrearea), cnx);
                cnx.Open();
                OracleDataReader reader;

                reader = cmd.ExecuteReader();

                Boolean existearea = reader.HasRows;

                cnx.Close();

                return existearea;

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
파일: CD_Area.cs 프로젝트: Gsaico/IDSTORE
        public int NuevaArea(CE_Area objce_area)
        {
            //el metodo m
            try
            {
                int filasafectadas = 0;

                OracleConnection cnx = Conexion.ObtenerConexionOracle();
                OracleCommand cmd = new OracleCommand();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection = cnx;
                cmd.CommandText = "sp_Nueva_Area";
                //asignar paramentros al procedimiento almacenado
                cmd.Parameters.AddWithValue("nombreareaX", objce_area.nombrearea);

                //abrir la conexion
                cnx.Open();
                //ejecutar el procedimiento almacenado
                filasafectadas = cmd.ExecuteNonQuery();
                //Cerrar conexion
                cnx.Close();
                return filasafectadas;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #3
0
파일: Area.cs 프로젝트: Gsaico/IDSTORE
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            CE_Area objce_area = new CE_Area();
            CN_Area objcn_area = new CN_Area();

            objce_area.nombrearea = txtArea.Text;

            if (objcn_area.VerificarExisteArea(objce_area) == true)
            {

                MessageBox.Show("El area ya existe", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

            }
            else
            {

                int filasafectadas = objcn_area.NuevaArea(objce_area);

                if (filasafectadas > 0)
                {
                    MessageBox.Show("La actualizacion se realizo con Exito!!", "Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("No se pudo actualizar", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

                this.dgvArea.DataSource = objcn_area.Listar_Areas();

            }
        }
예제 #4
0
파일: CN_Area.cs 프로젝트: Gsaico/IDSTORE
        public int NuevaArea(CE_Area objce_area)
        {
            int filasafectadas = 0;
            CD_Area objcd_area = new CD_Area();

            filasafectadas = objcd_area.NuevaArea(objce_area);

            return filasafectadas;
        }
예제 #5
0
파일: CN_Area.cs 프로젝트: Gsaico/IDSTORE
        public bool VerificarExisteArea(CE_Area objce_area)
        {
            CD_Area objcd_area = new CD_Area();

            return  objcd_area.VerificarExisteArea(objce_area);
        }