public List <BLL_product> SELECTALL() { List <BLL_product> returning = new List <BLL_product>(); try { con.init(); string query = "SELECT * FROM `product` ORDER BY name ASC "; command = new MySqlCommand(query, con.connect); infos = command.ExecuteReader(); while (infos.Read()) { BLL_product alloc = new BLL_product(); alloc.id = Convert.ToInt32(infos["id"]); alloc.name = infos["name"].ToString(); alloc.value = infos["value"].ToString(); returning.Add(alloc); } con.disconnect(); return(returning); } catch (Exception excep) { throw new Exception("Erro de comandos!\n" + excep.Message); } }
public string DELETE(BLL_product bll_product) { try { con.init(); string query = "DELETE FROM `product` WHERE id = " + bll_product.id; command = new MySqlCommand(query, con.connect); infos = command.ExecuteReader(); con.disconnect(); return("Excluido com sucesso"); } catch (Exception excep) { throw new Exception("Erro de comandos!\n" + excep.Message); } }
public string UPDATE(BLL_product bll_product) { try { con.init(); string query = "UPDATE product SET name ='" + bll_product.name + "' , value = '" + bll_product.value + "' WHERE id = " + bll_product.id; command = new MySqlCommand(query, con.connect); infos = command.ExecuteReader(); con.disconnect(); return("Alterado com sucesso"); } catch (Exception excep) { throw new Exception("Erro de comandos!\n" + excep.Message); } }
public string INSERT(BLL_product product) { try { con.init(); string query = "INSERT INTO product(name,value)VALUES('" + product.name + "','" + product.value + "')"; command = new MySqlCommand(query, con.connect); command.ExecuteNonQuery(); con.disconnect(); return("Adicionado com sucesso"); } catch (Exception excep) { throw new Exception("Erro de comandos!\n" + excep.Message); } }
private void lb_changed_DoubleClick(object sender, EventArgs e) { BLL_product selleraux = new BLL_product(); double pvalue, pamount; if (rb_product.Checked == true) { if (lb_changed.SelectedIndex != -1) { selleraux = L_bllProduct[lb_changed.SelectedIndex]; pvalue = Convert.ToDouble(selleraux.value); pamount = Convert.ToDouble(txt_amount.Text); double sum = pvalue * pamount; string nname = selleraux.name; selleraux.name = pamount + "x " + nname; selleraux.value = string.Format("{0:n2}", sum); sellerlist.Add(selleraux); lb_changed.Items.Clear(); lb_sellerProducts.Items.Add(selleraux.name + " " + selleraux.value); lbl_finalvalue.Text = finalvalue(); } else { MessageBox.Show("Nenhum produto selecionado"); } } else if (rb_client.Checked == true) { if (lb_changed.SelectedIndex != -1) { sellerClient = L_bllClient[lb_changed.SelectedIndex]; txt_sellerClient.Text = " \n " + sellerClient.phone + " " + sellerClient.address; } else { MessageBox.Show("Nenhum Cliente Selecionado"); } } txt_amount.Text = "1"; }
public Form1() { InitializeComponent(); control = new Ux_control(gb_order, gb_client, gb_product); bll_client = new BLL_client(); bll_product = new BLL_product(); L_bllProduct = new List <BLL_product>(); L_bllClient = new List <BLL_client>(); sellerlist = new List <BLL_product>(); sellerClient = new BLL_client(); verification = new verify(); count_voucher = 1; count_purchase = 1; con = new connection(); try { con.init(); string query = "SELECT `number` FROM `count` WHERE id like " + 1; command = new MySqlCommand(query, con.connect); infos = command.ExecuteReader(); while (infos.Read()) { count_purchase = Convert.ToInt32(infos["number"]); } con.disconnect(); } catch (Exception excep) { throw new Exception("Erro de comandos!\n" + excep.Message); } }