コード例 #1
0
        public List <custumer> consult_customer()
        {
            List <custumer> peoples = new List <custumer>();

            try
            {
                con.connect();
                string query = "SELECT `nm_customer`,`cpf_cnpj`, `is_active`, `vl_total` FROM `tb_customer_account` WHERE id_customer > 1500 and id_customer < 2700 and vl_total >560 ORDER BY vl_total DESC ";
                command = new MySqlCommand(query, con.connection);
                infos   = command.ExecuteReader();

                while (infos.Read())
                {
                    custumer user = new custumer();
                    user.nm_customer = infos["nm_customer"].ToString();
                    user.cpf_cnpj    = infos["cpf_cnpj"].ToString();
                    user.is_active   = Convert.ToInt32(infos["is_active"]);
                    user.vl_total    = Convert.ToInt32(infos["vl_total"]);

                    peoples.Add(user);
                }
                con.disconnect();
                return(peoples);
            }
            catch (Exception excep)
            {
                throw new Exception("Erro de comandos!\n" + excep.Message);
            }
        }
コード例 #2
0
 public Form1()
 {
     InitializeComponent();
     people    = new custumer();
     da        = new dal();
     generator = new massive_add();
 }
コード例 #3
0
 public void add_customer(custumer people)
 {
     try
     {
         con.connect();
         string query = "INSERT INTO tb_customer_account(cpf_cnpj,nm_customer,is_active,vl_total)VALUES('" + people.cpf_cnpj + "','" + people.nm_customer + "'," + people.is_active + "," + people.vl_total + ")";
         command = new MySqlCommand(query, con.connection);
         command.ExecuteNonQuery();
         con.disconnect();
     }
     catch (Exception excep)
     {
         throw new Exception("Erro de comandos!\n" + excep.Message);
     }
 }