예제 #1
0
        public int Delete(PizzeriaBO obj)
        {
            string     delete = "DELETE FROM Pizzeria WHERE IDPizzeria = @IdPizzeria";
            SqlCommand cmd    = new SqlCommand(delete, conn);

            cmd.Parameters.Add(new SqlParameter("@IdPizzeria", SqlDbType.Int));
            cmd.Parameters["@IdPizzeria"].Value = obj.IdPizzeria;
            return(EjecutarSQL(cmd));
        }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     obj    = new PizzeriaBO();
     objdao = new PizzeriaDAO();
     if (!IsPostBack)
     {
         Facade("Select");
     }
 }
예제 #3
0
        private void Eliminar()
        {
            PizzeriaBO prod = new PizzeriaBO();

            prod.IdPizzeria = Convert.ToInt32(HiddenId.Value);
            if (prod.IdPizzeria > 0)
            {
                objdao.Delete(prod);
                Select();
                Limpiar();
            }
        }
예제 #4
0
        private void Guardar()
        {
            string validado = validar();

            if (validado == "")
            {
                PizzeriaBO pizz = InterfaceToData();
                objdao.Save(pizz);
                Facade("Select");
                Facade("Limpiar");
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Favor de llenar los campos')", true);
            }
        }
예제 #5
0
        public int Save(PizzeriaBO obj)
        {
            string insert = "INSERT INTO Pizzeria(Nombre,RFC,Direccion,Telefono) " +
                            "VALUES(@Nombre,@RFC,@Direccion,@Telefono)";
            SqlCommand cmd = new SqlCommand(insert, conn);

            cmd.Parameters.Add(new SqlParameter("@Nombre", SqlDbType.VarChar));
            cmd.Parameters.Add(new SqlParameter("@RFC", SqlDbType.VarChar));
            cmd.Parameters.Add(new SqlParameter("@Direccion", SqlDbType.VarChar));
            cmd.Parameters.Add(new SqlParameter("@Telefono", SqlDbType.VarChar));

            cmd.Parameters["@Nombre"].Value    = obj.Nombre;
            cmd.Parameters["@RFC"].Value       = obj.RFC;
            cmd.Parameters["@Direccion"].Value = obj.Direccion;
            cmd.Parameters["@Telefono"].Value  = obj.Telefono;
            return(EjecutarSQL(cmd));
        }