public void getZona() { //Variables DataTable dt = new DataTable(); List <clsZona> lstZona = new List <clsZona>(); clsZona c = new clsZona(); BindingSource bs = new BindingSource(); //Lenamos el DS de Categorias Params.Clear(); Data.DataModule.ParamByName(Params, "Datos", ""); Data.DataModule.FillDataSet(spCatEstacionDS1, "spCatZona", Params.ToArray()); dt = spCatEstacionDS1.Tables["spCatZona"]; lstZona = c.FillList(dt); bs.DataSource = lstZona; this.lueZona.Properties.DataSource = bs.List; //this.lueCambiaEstacion.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("EstacionID", "Banco ID")); this.lueZona.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Descripcion", "Descripcion")); this.lueZona.Properties.DisplayMember = "Descripcion"; this.lueZona.Properties.ValueMember = "ZonaID"; this.lueZona.Properties.DropDownRows = lstZona.Count; }
public Boolean Update(clsZona zon) { try { con.conectarBD(); cmd = new MySqlCommand("ActualizaZona", con.conector); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("codzon", zon.CodZona); cmd.Parameters.AddWithValue("descripcion", zon.Descripcion); int x = cmd.ExecuteNonQuery(); if (x != 0) { return(true); } else { return(false); } } catch (MySqlException ex) { throw ex; } finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); } }
public Boolean Insert(clsZona zon) { try { con.conectarBD(); cmd = new MySqlCommand("GuardaZona", con.conector); cmd.CommandType = CommandType.StoredProcedure; MySqlParameter oParam; oParam = cmd.Parameters.AddWithValue("descripcion", zon.Descripcion); oParam = cmd.Parameters.AddWithValue("codusu", zon.CodUser); oParam = cmd.Parameters.AddWithValue("newid", 0); oParam.Direction = ParameterDirection.Output; int x = cmd.ExecuteNonQuery(); zon.CodZonaNuevo = Convert.ToInt32(cmd.Parameters["newid"].Value); if (x != 0) { return(true); } else { return(false); } } catch (MySqlException ex) { throw ex; } finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); } }
public clsZona CargaZona(Int32 Codigo) { clsZona zon = null; try { con.conectarBD(); cmd = new MySqlCommand("MuestraZona", con.conector); cmd.Parameters.AddWithValue("codzon", Codigo); cmd.CommandType = CommandType.StoredProcedure; dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { zon = new clsZona(); zon.CodZona = Convert.ToInt32(dr.GetDecimal(0)); zon.Descripcion = dr.GetString(1); zon.Estado = dr.GetBoolean(2); zon.CodUser = Convert.ToInt32(dr.GetDecimal(3)); zon.FechaRegistro = dr.GetDateTime(4);// capturo la fecha } } return(zon); } catch (MySqlException ex) { throw ex; } finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); } }
public Boolean update(clsZona zon) { try { return(Mzon.Update(zon)); } catch (Exception ex) { DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: " + ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } }
public Boolean insert(clsZona zon) { try { return(Mzon.Insert(zon)); } catch (Exception ex) { if (ex.Message.Contains("Duplicate entry")) { DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: N°- de Documento Repetido", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: " + ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(false); } }