public List <BLL_client> SELECTALL(BLL_client bll_client) { List <BLL_client> returning = new List <BLL_client>(); try { con.init(); string query = "SELECT * FROM client ORDER BY address ASC "; command = new MySqlCommand(query, con.connect); infos = command.ExecuteReader(); while (infos.Read()) { BLL_client alloc = new BLL_client(); alloc.id = Convert.ToInt32(infos["id"]); alloc.phone = infos["phone"].ToString(); alloc.address = infos["address"].ToString(); returning.Add(alloc); } con.disconnect(); return(returning); } catch (Exception excep) { throw new Exception("Erro de comandos!\n" + excep.Message); } }
public string DELETE(BLL_client bll_client) { try { con.init(); string query = "DELETE FROM `client` WHERE id = " + bll_client.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_client bll_client) { try { con.init(); string query = "UPDATE client SET phone = '" + bll_client.phone + "',address = '" + bll_client.address + "' WHERE id = '" + bll_client.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_client people) { try { con.init(); string query = "INSERT INTO client(phone,address)VALUES('" + people.phone + "','" + people.address + "')"; 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); } }