Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

211 lines (144 sloc) 7.457 kb
Imports System.Data
Partial Class RegBascula
Inherits cBase
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.finSession()
If Me.IsPostBack = False Then
If String.IsNullOrEmpty(Me.Request("Cliente")) = False Then
Dim ControlCliente As New cCliente
Dim dsDatosCliente As New DataSet
dsDatosCliente = ControlCliente.RecuperarClientePorId(Request("Cliente"))
Me.txtCliente.Text = dsDatosCliente.Tables(0).Rows(0).Item("NombreCliente")
Me.hdIdCliente.Value = Request("Cliente")
Me.IniciarConClienteAsignado()
LlenarTransportesPorCliente(Request("Cliente"))
LlenarTipoIngreso()
Else
Iniciar()
DeshabilitarForm()
Me.ddlbTransporte.Items.Insert("0", New ListItem("Seleccionar...", "0"))
LlenarTipoIngreso()
End If
Me.btnBuscarCliente.Attributes.Add("onclick", "javascript:urlCliente();")
End If
Me.txtFechaIngreso.Text = CDate(Now)
Me.lblPuntoTransferencia.Text = Me.Session.Item("PuntoTransferencia")
Me.hdPuntoTransferencia.Value = Me.Session.Item("idPuntoTransferencia")
End Sub
Function LlenarTipoIngreso() As Integer
Dim Control As New cTipoIngreso
Dim dsDatos As New DataSet
dsDatos = Control.RecuperarNombreTipos
If dsDatos.Tables(0).Rows.Count > 0 Then
ddlbTipoIngreso.DataSource = dsDatos.Tables(0)
ddlbTipoIngreso.DataTextField = "NombreTipo"
ddlbTipoIngreso.DataValueField = "IdTipoIngreso"
ddlbTipoIngreso.DataBind()
End If
Me.ddlbTipoIngreso.Items.Insert("0", New ListItem("Seleccionar...", "0"))
End Function
Function LlenarTransportesPorCliente(ByVal IdCliente As Integer) As Integer
Dim control As New cTransporte
Dim dsDatos As New DataSet
dsDatos = control.RecuperarTransportePorCliente(IdCliente)
If dsDatos.Tables(0).Rows.Count > 0 Then
ddlbTransporte.DataSource = dsDatos.Tables(0)
ddlbTransporte.DataTextField = "Transporte_idTransporte"
ddlbTransporte.DataValueField = "IdTransportePorCliente"
ddlbTransporte.DataBind()
End If
Me.ddlbTransporte.Items.Insert("0", New ListItem("Seleccionar...", "0"))
End Function
Function IniciarConClienteAsignado() As Integer
Me.btnModificar.Visible = False
Me.btnDeschabilitar.Visible = False
Me.btnBuscar.Visible = False
Me.btnAgregar.Visible = False
End Function
Function Iniciar() As Integer
Me.btnGuardar.Visible = False
Me.btnCancelar.Visible = False
Me.btnModificar.Visible = False
Me.btnDeschabilitar.Visible = False
Me.btnBuscarCliente.Visible = False
Me.btnBuscar.Visible = False
End Function
Function HabilitaForm() As Integer
Me.txtIdTransferencia.ReadOnly = True
Me.txtPesoBruto.Enabled = True
Me.ddlbTipoIngreso.Enabled = True
Me.ddlbTransporte.Enabled = True
Me.txtPesoBruto.Enabled = True
Me.txtFechaIngreso.Enabled = True
End Function
Function DeshabilitarForm() As Integer
Me.txtIdTransferencia.ReadOnly = True
Me.ddlbTipoIngreso.Enabled = False
Me.ddlbTransporte.Enabled = False
Me.txtPesoBruto.Enabled = False
Me.txtFechaIngreso.Enabled = False
End Function
Function LimpiarForm() As Integer
Me.txtIdTransferencia.Text = ""
Me.txtPesoBruto.Text = ""
End Function
Protected Sub btnAgregar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAgregar.Click
Me.Session.Item("Accion") = "Agregar"
Me.btnAgregar.Visible = False
Me.btnGuardar.Visible = True
Me.btnCancelar.Visible = True
Me.btnBuscarCliente.Visible = True
Me.btnBuscar.Visible = False
HabilitaForm()
End Sub
Protected Sub btnCancelar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancelar.Click
Iniciar()
DeshabilitarForm()
LimpiarForm()
End Sub
Protected Sub btnGuardar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGuardar.Click
Dim control As New cRegistroTransferencia
Dim eRegistro As New RegistroTransferencia
Dim pb, pt As Integer
pb = Me.txtPesoBruto.Text
pt = hdPesoTara.Value
If pb < pt Then
Me.MsgBox1.ShowAlert("El dato ingresado como peso Bruto es menor al peso tara, el peso tara del vehiculo seleccionado es : " & Me.hdPesoTara.Value, "", Cooperator.Framework.Web.Controls.AlertOption.NoAction)
Me.RequiredFieldValidator4.IsValid = False
ElseIf pb = pt Then
Me.MsgBox1.ShowAlert("El dato ingresado como peso Bruto no debe de ser igual al peso tara", "", Cooperator.Framework.Web.Controls.AlertOption.NoAction)
Me.RequiredFieldValidator4.IsValid = False
Else
If String.IsNullOrEmpty(Me.txtIdTransferencia.Text) = True Then
eRegistro.FechaRegistro = Me.txtFechaIngreso.Text
eRegistro.TipoIngreso = Me.ddlbTipoIngreso.SelectedValue
eRegistro.PesoBruto = Me.txtPesoBruto.Text
eRegistro.IdEstado = Me.EstadoPendienteRegistrarTransferencia
eRegistro.IdUsuario = Me.Session.Item("IdUsuario")
eRegistro.IdPuntoTransferencia = hdPuntoTransferencia.Value
eRegistro.IdTransporte = ddlbTransporte.SelectedValue
eRegistro.IdCliente = Me.hdIdCliente.Value
Me.hdTransferencia.Value = control.GuardarRegistroBascula(eRegistro)
If Me.hdTransferencia.Value > 0 Then
Me.MsgBox1.ShowAlert("Registro Guardado Satisfactoriamente", "", Cooperator.Framework.Web.Controls.AlertOption.NoAction, Cooperator.Framework.Web.Controls.AlertType.Information)
Me.txtIdTransferencia.Text = Me.hdTransferencia.Value
Me.btnGuardar.Visible = False
Me.btnBuscarCliente.Visible = False
Me.DeshabilitarForm()
Else
Me.MsgBox1.ShowAlert("Ocurriio un problema al guardar", "", Cooperator.Framework.Web.Controls.AlertOption.NoAction, Cooperator.Framework.Web.Controls.AlertType.Stop)
End If
Else
Me.MsgBox1.ShowAlert("Desea hacer otro registro, recomendamos dar clic en cancelar para lugo agregar un nuevo resgistro al sistema", "", Cooperator.Framework.Web.Controls.AlertOption.NoAction, Cooperator.Framework.Web.Controls.AlertType.Information)
End If
End If
End Sub
Protected Sub ddlbTransporte_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlbTransporte.SelectedIndexChanged
Dim control As New cTransporte
Dim dsDatos As New DataSet
dsDatos = control.RecuperarTransportePorId(Me.ddlbTransporte.SelectedItem.ToString)
If dsDatos.Tables(0).Rows.Count > 0 Then
Me.hdPesoTara.Value = dsDatos.Tables(0).Rows(0).Item("PesoTara")
End If
End Sub
End Class
Jump to Line
Something went wrong with that request. Please try again.