/// <summary> /// Manejador del evento OnClick del btnModificar. /// Actualiza el precio del producto seleccionado en la base de datos. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnModificarClick(object sender, EventArgs e) { double nuevoPrecio; if (Double.TryParse(this.txtNuevoPrecio.Text, out nuevoPrecio)) { DialogResult result = MessageBox.Show("¿Seguro desea modificar el producto?", "Modificar Producto", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { // Punto 4B - Actualizar el precio del producto en la tabla de productos. productoSeleccionado.Precio = nuevoPrecio; ConnectionDAO.UpdateData(productoSeleccionado); this.Close(); } } else { this.lblError.Text = "Error. Debe ingresar un precio válido."; } }
/// <summary> /// Manejador del evento OnClick del btnAgregar. /// Agrega un nuevo producto. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnAgregar_Click(object sender, EventArgs e) { if (Validar()) { string nuevaDescripcion = this.txtDescripcion.Text; double nuevoPrecio = Convert.ToDouble(this.txtPrecio.Text); int nuevoStock = (int)this.txtStock.Value; Producto myProduct = new Producto(); myProduct.Descripcion = nuevaDescripcion; myProduct.Precio = nuevoPrecio; myProduct.Stock = nuevoStock; // Punto 4A - Insertar los datos del nuevo producto en la tabla de productos. if (ConnectionDAO.InsertData(myProduct)) { MessageBox.Show("Product added successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.Close(); } }
protected void Page_Load(object sender, EventArgs e) { c = new ConnectionDAO(); con = c.GetConnection(); SqlCommand cmd = new SqlCommand("SELECT Timeslot.appoid, Timeslot.date, timeslot_tab.timeslot, Timeslot.status FROM Timeslot INNER JOIN timeslot_tab ON Timeslot.timeslotid = timeslot_tab.id WHERE (Timeslot.pid = " + Convert.ToInt32(Session["id"]) + ") ORDER BY Timeslot.date DESC, timeslot_tab.timeslot", con); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.Read()) { DataTable dt = new DataTable(); DataColumn Appid = new DataColumn("Appointment Id"); DataColumn Date = new DataColumn("Date"); DataColumn Timeslot = new DataColumn("Time Slot"); DataColumn Status = new DataColumn("Status"); dt.Columns.Add(Appid); dt.Columns.Add(Date); dt.Columns.Add(Timeslot); dt.Columns.Add(Status); DataRow row; do { row = dt.NewRow(); row[Appid] = rdr[0]; row[Date] = rdr[1]; row[Timeslot] = rdr[2]; row[Status] = rdr[3]; dt.Rows.Add(row); }while(rdr.Read()); GridView1.DataSource = dt; GridView1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { c = new ConnectionDAO(); con = c.GetConnection(); if (!IsPostBack) { SqlCommand cmd1 = new SqlCommand("select MAX(id) from doctor", con); con.Open(); Label1.Text = ((int)cmd1.ExecuteScalar() + 1).ToString(); con.Close(); SqlCommand cmd = new SqlCommand("select specialist from specialist_tab", con); con.Open(); DropDownList1.DataSource = cmd.ExecuteReader(); DropDownList1.DataTextField = "specialist"; DropDownList1.DataValueField = "specialist"; DropDownList1.DataBind(); DropDownList1.Items.Insert(0, new ListItem("Select", "Select")); con.Close(); } }
protected void Page_Load(object sender, EventArgs e) { c = new ConnectionDAO(); con = c.GetConnection(); SqlCommand cmd = new SqlCommand("SELECT Patient.id, Patient.name, Timeslot.appoid, Timeslot.date, timeslot_tab.timeslot FROM Patient INNER JOIN Timeslot ON Patient.id = Timeslot.pid INNER JOIN timeslot_tab ON Timeslot.timeslotid = timeslot_tab.id WHERE (Timeslot.did = " + Session["did"] + ")", con); con.Open(); SqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { GridView1.DataSource = rdr; GridView1.DataBind(); } else { Label1.ForeColor = System.Drawing.Color.Red; Label1.Text = "No Data Found...!"; } con.Close(); }
public IEnumerable <Prestador> GetAdministradores() { _con = new ConnectionDAO(); return(_con.GetPrestadorAdmin()); }
protected void Page_Load(object sender, EventArgs e) { c = new ConnectionDAO(); con = c.GetConnection(); }
public OrcamentoRepository(GestaoContext dbContext) : base(dbContext) { _dbContext = dbContext; _dao = new ConnectionDAO(); }
public LogInPage() { c = new ConnectionDAO(); con = c.GetConnection(); }
public RegisterPatient() { c = new ConnectionDAO(); con = c.GetConnection(); }