protected void pagarFactura_Click(object sender, EventArgs e) { var factura = DD_Pagar.SelectedValue; var tipoPago = DD_Pago.SelectedValue; var prove = DD_Provedor.SelectedValue; ConectionDB conection = new ConectionDB(); String SqlCommand = String.Format("UPDATE [dbo].[Factura] SET [pago] = {0},[fechaPago] = '{1}',[Estatus] = 5 WHERE idFactura = {2}", tipoPago, DateTime.Now.ToString("yyyy-MM-dd"), factura); try { var result = conection.insertCommand(SqlCommand); if (result != 0) { //notificacion DD_Pagar.Dispose(); DD_Pago.Dispose(); Response.Write("<script>alert('Pago registrado Exitosamente.');</script>"); Response.Redirect("~/PagarFactura"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } conection.CloseDB(); DD_Pagar.SelectedValue = ""; DD_Pago.SelectedValue = ""; }
protected void Btn_guardar_Click(object sender, EventArgs e) { var requisicion = DropDownRequisiciones.SelectedValue; var monto = Txt_Monto.Text; string sqlCommand = "update [dbo].[Factura] set total = " + monto + " , fechaMaxPago = '" + DateTime.Now.AddDays(30).ToString("yyyy-MM-dd") + "' where requisicion = " + requisicion + ""; ConectionDB connection = new ConectionDB(); int result = connection.insertCommand(sqlCommand); sqlCommand = "update [dbo].[Requisicion] set estado = 3, fechaEntrega = '" + DateTime.Now.ToString("yyyy-MM-dd") + "';"; result = connection.insertCommand(sqlCommand); if (result != 0) { //notificacion DD_Pagar.Dispose(); DD_Pago.Dispose(); Response.Write("<script>alert('Requisicion actualizada correctamente.');</script>"); Response.Redirect("~/NuevaRequisicion"); } }