public void Registrar() { SqlConnection Conn = new SqlConnection(); Conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["PickUp.Properties.Settings.Cadena"].ToString(); SqlCommand cmd = new SqlCommand(); Conn.Open(); cmd.Connection = Conn; cmd.CommandText = "UPDATE PickUp SET Nombre_Cliente = '" + txt_Cliente.Text + "',Direccion = '" + txt_Direccion.Text + "',Contacto = '" + txt_Contacto.Text + "',Hora_Pu_Ini = '" + ddl_Inicio.SelectedValue + "',Hora_Peu_Fin = '" + ddl_Fin.SelectedValue + "',Status = 'PENDIENTE',Conductor_Asignado = '" + ddl_Conductor.SelectedValue + "',Comentario_PickUp = '" + txt_Comentarios.Text + "',Fecha_Registro = getdate(),Fecha_Finalizacion = '',Estado_Correlativo = '2' WHERE Correlativo_PickUp = '" + Session["contador"] + "'"; cmd.ExecuteNonQuery(); Conn.Close(); rptPickUp.DataBind(); Registro_OK.Visible = true; registro_NOOK.Visible = false; RPT_Finalizados.DataBind(); RPTCANCELADAS.DataBind(); }
protected void rptPickUp_ItemCommand(object source, RepeaterCommandEventArgs e) { string num = Convert.ToString(e.CommandArgument); SqlConnection Conn = new SqlConnection(); Conn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["PickUp.Properties.Settings.Cadena"].ToString(); SqlCommand cmd = new SqlCommand(); switch (e.CommandName) { case "Finalizar": try { Conn.Open(); cmd.Connection = Conn; cmd.CommandText = "UPDATE PickUp SET Status = 'FINALIZADO',Fecha_Finalizacion = GETDATE() WHERE Correlativo_PickUp='" + num + "'"; cmd.ExecuteNonQuery(); Conn.Close(); rptPickUp.DataBind(); RPT_Finalizados.DataBind(); RPTCANCELADAS.DataBind(); Registro_OK.Visible = true; registro_NOOK.Visible = false; }catch (InvalidCastException) { registro_NOOK.Visible = true; Registro_OK.Visible = false; } break; case "Cancelar": try { Conn.Open(); cmd.Connection = Conn; cmd.CommandText = "UPDATE PickUp SET Status = 'CANCELADA',Fecha_Finalizacion = GETDATE() WHERE Correlativo_PickUp='" + num + "'"; cmd.ExecuteNonQuery(); Conn.Close(); rptPickUp.DataBind(); RPT_Finalizados.DataBind(); RPTCANCELADAS.DataBind(); Registro_OK.Visible = true; registro_NOOK.Visible = false; } catch (InvalidCastException) { registro_NOOK.Visible = true; Registro_OK.Visible = false; } break; case "MensajeMail": string Val = Enviar_Mail(num); if (Val == "Enviado") { Registro_OK.Visible = true; registro_NOOK.Visible = false; } else { Registro_OK.Visible = false; registro_NOOK.Visible = true; } break; } }