public Bol Get(int id) { MySqlDataReader reader = null; MySqlConnection myConnection = new MySqlConnection(); myConnection.ConnectionString = @"Server=127.0.0.1;Port=49489;Database=lean_tech_backend_test;Uid=azure;Pwd=6#vWHD_$;"; MySqlCommand sqlCmd = new MySqlCommand(); sqlCmd.CommandText = "SELECT * FROM bols where id_bol = " + id.ToString(); sqlCmd.CommandType = CommandType.Text; sqlCmd.Connection = myConnection; myConnection.Open(); reader = sqlCmd.ExecuteReader(); Bol obj = null; while (reader.Read()) { obj = new Bol(); obj.id = Convert.ToInt32(reader.GetValue(0)); obj.name = reader.GetValue(1).ToString(); obj.date = Convert.ToDateTime(reader.GetValue(2)); obj.instructions = reader.GetValue(3).ToString(); obj.items = reader.GetValue(4).ToString(); } myConnection.Close(); return(obj); }
public override int GetHashCode() { int hash = 1; if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (Bol != false) { hash ^= Bol.GetHashCode(); } hash ^= stringlt_.GetHashCode(); hash ^= numberlt_.GetHashCode(); if (birthday_ != null) { hash ^= Birthday.GetHashCode(); } hash ^= results_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public IHesaplayıcı HesaplayiciFactoryMethod(DortIslem islem) { IHesaplayıcı sonuc = null; switch (islem) { case DortIslem.Bol: sonuc = new Bol(); break; case DortIslem.Carp: sonuc = new Carp(); break; case DortIslem.Cikar: sonuc = new Cikar(); break; case DortIslem.Topla: default: sonuc = new Topla(); break; } return(sonuc); }
//Concluir ou Excluir private void BtnOp_Click(object sender, EventArgs e) { if (BtnOp.Text == "C") { Ordem.Editar(Ordem.IDORDEM, "Concluído"); foreach (BL_Boleta Bol in new BL_Boleta().DadosIDORDEM(Ordem.IDORDEM).Where(x => x.STATUS == "Boletado")) { Bol.Editar(Bol.IDBOLETA, Bol.COTIZACAO, Bol.IMPACTO, "Concluído"); } Ordem = new BL_Ordem().DadosPorIDORDEM(Ordem.IDORDEM); RefreshData(); } else if (BtnOp.Text == "X") { List <BL_Boleta> BoletasControle = new BL_Boleta().DadosIDORDEM(Ordem.IDORDEM); if (BoletasControle.Count == BoletasControle.Where(x => x.STATUS != "Boletado" && x.STATUS != "Concluído").Count()) { foreach (BL_Boleta Bol in BoletasControle) { Bol.Deletar(Bol.IDBOLETA); new BL_RegistroResgate().DeletarIDBOLETA(Bol.IDBOLETA); } Ordem.Deletar(Ordem.IDORDEM); PainelControle.Controls.Remove(this); } else { MessageBox.Show("Exitem boletas já processadas. Controle Atualizado."); } } }
public IEnumerable <Bol> Get() { var ret = new List <Bol>(); var str = Environment.GetEnvironmentVariable("MYSQLCONNSTR_localdb").ToString(); try { MySqlDataReader reader = null; MySqlConnection myConnection = new MySqlConnection(); myConnection.ConnectionString = @"Server=127.0.0.1;Port=49489;Database=lean_tech_backend_test;Uid=azure;Pwd=6#vWHD_$;"; MySqlCommand sqlCmd = new MySqlCommand(); sqlCmd.CommandText = "SELECT * FROM bols"; sqlCmd.CommandType = CommandType.Text; sqlCmd.Connection = myConnection; myConnection.Open(); reader = sqlCmd.ExecuteReader(); Bol obj = null; while (reader.Read()) { obj = new Bol(); obj.id = Convert.ToInt32(reader.GetValue(0)); obj.name = reader.GetValue(1).ToString(); obj.date = Convert.ToDateTime(reader.GetValue(2)); obj.instructions = reader.GetValue(3).ToString(); obj.items = reader.GetValue(4).ToString(); ret.Add(obj); } myConnection.Close(); return(ret); } catch (Exception ex) { var obj = new Bol(); obj.id = 0; obj.name = ex.Message + " " + str; ret.Add(obj); return(ret); } }
public void Post(Bol obj) { MySqlConnection myConnection = new MySqlConnection(); myConnection.ConnectionString = @"Server=127.0.0.1;Port=49489;Database=lean_tech_backend_test;Uid=azure;Pwd=6#vWHD_$;"; MySqlCommand sqlCmd = new MySqlCommand(); sqlCmd.CommandType = CommandType.Text; sqlCmd.CommandText = "INSERT INTO bols (id_bol,name,date,instructions,items) Values (@id_bol, @name, @date, @instructions, @items)"; sqlCmd.Connection = myConnection; sqlCmd.Parameters.AddWithValue("@id_bol", obj.id); sqlCmd.Parameters.AddWithValue("@name", obj.name); sqlCmd.Parameters.AddWithValue("@date", obj.date); sqlCmd.Parameters.AddWithValue("@instructions", obj.instructions); sqlCmd.Parameters.AddWithValue("@items", obj.items); myConnection.Open(); int rowInserted = sqlCmd.ExecuteNonQuery(); myConnection.Close(); }