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); } }
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); } }
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); } }
private void cmd_FinishPurchase_Click(object sender, EventArgs e) { if ((txt_sellerClient.Text != "") && (lb_sellerProducts.Items.Count != 0)) { string print; print = "Gelocar\n"; print += "Nº: " + count_purchase + "\n"; if (count_voucher == 1) { count_voucher++; } else { count_voucher = 1; count_purchase++; try { con.init(); string query = "UPDATE count SET number = " + count_purchase + " WHERE id = " + 1; command = new MySqlCommand(query, con.connect); infos = command.ExecuteReader(); con.disconnect(); } catch (Exception excep) { throw new Exception("Erro de comandos!\n" + excep.Message); } } DateTime date = DateTime.Now; print += date.Day + "/" + date.Month + "/" + date.Year + " - " + date.Hour + ":" + date.Minute + ":" + date.Second; print += "\nTelefone: " + sellerClient.phone + "\n"; print += "Endereço: " + sellerClient.address + "\n"; print += "\nProdutos\n"; for (int i = 0; i < sellerlist.Count; i++) { print += sellerlist[i].name + " R$ " + sellerlist[i].value + "\n"; } if (cb_rate.Checked) { print += "Taxa de entrega R$ 7,00\n"; } if (rb_money.Checked) { print += "\nPagamento no DINHEIRO"; } if (rb_card.Checked) { print += "\nPagamento no CARTÃO"; } if (rb_doublePayment.Checked) { print += "\nPagamento no CARTÃO e Dinheiro"; } print += "\nTOTAL: " + finalvalue(); print += "\n\nObs:\n" + rtb_observation.Text; printin(print); } else { MessageBox.Show("Cliente ou Lista de produtos vazio"); } }