CatEstatusOrdenServicio aun no listo
This commit is contained in:
@@ -26,14 +26,31 @@ Partial Class OS_CatEstatusOrdenServicio
|
||||
ViewState("CveEstatuOS") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DTEstatusUsuarios As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DTEstatusUsuarios"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DTEstatusUsuarios") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CreaGrid("Req")
|
||||
CreaGrid("OC")
|
||||
CargaGridEstatusUsuarios()
|
||||
ViewState("Orden") = ""
|
||||
'ViewState("TipoSeleccionado") = DdlTipo.SelectedValue
|
||||
|
||||
CveEstatuOS = -1
|
||||
CargaDatos()
|
||||
|
||||
'CargaProyectos()
|
||||
CargaUsuarios()
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -154,4 +171,128 @@ Partial Class OS_CatEstatusOrdenServicio
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "Configuracion"
|
||||
Protected Sub ibOpciones1_Click(sender As Object, e As ImageClickEventArgs)
|
||||
Dim imgBtn As ImageButton = DirectCast(sender, System.Web.UI.WebControls.ImageButton)
|
||||
|
||||
ddlSuperior.Items.Clear()
|
||||
|
||||
If imgBtn.CommandArgument <> "" Then
|
||||
'chkMostrarLimites.Visible = If(GlobalDTOCEstatus.FiltraParametros("CveEstatusSiguiente = " + imgBtn.CommandArgument)(0)("TipoTermino").ToString.ToEntero = 3, False, True)
|
||||
chkMostrarLimites.Style("display") = If(GlobalDTOCEstatus(UsuarioActual.CveEmpresa).FiltraParametros("CveEstatusSiguiente = " + imgBtn.CommandArgument)(0)("TipoTermino").ToString.ToEntero = 3, "none", "inline")
|
||||
|
||||
|
||||
'ddlSuperior.DataSource = DTEstatusUsuarios.FiltraParametros(String.Format("CveEstatus = {0}", imgBtn.CommandArgument), "Nombre DESC")
|
||||
ddlSuperior.DataBind()
|
||||
ddlSuperior.Items.Insert(0, New ListItem("Todos los Superiores", "-1"))
|
||||
Try
|
||||
ddlSuperior.SelectedValue = hdnCveSuperior.Value
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
tblSuperior.Visible = True
|
||||
Else
|
||||
tblSuperior.Visible = False
|
||||
End If
|
||||
|
||||
UPSuperior.Update()
|
||||
UPPEmp.Update()
|
||||
RegistraScript("$('#DivSuperior').show(1000); PosicionaObjeto('" + imgBtn.ClientID + "','DivSuperior'); chkMostrarLimitesCambio();")
|
||||
End Sub
|
||||
Private Sub CreaGrid(Tipo As String)
|
||||
Dim i As Integer = 1
|
||||
|
||||
For Each Row As DataRow In GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).Rows
|
||||
|
||||
GvEstatusUsuariosREQ.Columns(i).HeaderText = Row("EstatusOrdenServicio").ToString.ToUpper
|
||||
GvEstatusUsuariosREQ.Columns(i).FooterText = Row("CveEstatusOrdenServicio").ToString
|
||||
|
||||
i += 1
|
||||
Next
|
||||
|
||||
While i <= 10
|
||||
GvEstatusUsuariosREQ.Columns(i).Visible = False
|
||||
i += 1
|
||||
End While
|
||||
End Sub
|
||||
|
||||
Protected Sub CargaGridEstatusUsuarios()
|
||||
GvEstatusUsuariosREQ.DataSource = GlobalDTUsuarios(CveEmpresa:=UsuarioActual.CveEmpresa)
|
||||
GvEstatusUsuariosREQ.DataBind()
|
||||
UPPEmp.Update()
|
||||
End Sub
|
||||
|
||||
Public Sub CargaUsuarios()
|
||||
ddlSuperior.DataSource = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa)
|
||||
ddlSuperior.DataBind()
|
||||
End Sub
|
||||
|
||||
Protected Sub btnGuardarEstatusUsuariosREQ_Click(sender As Object, e As EventArgs) Handles btnGuardarEstatusUsuariosREQ.Click
|
||||
Dim objEstatusOC As New ClsOS
|
||||
objEstatusOC.IniciaTransacSQL()
|
||||
Dim HuboErrores As Boolean = False
|
||||
Dim CveSubProyecto = 59
|
||||
|
||||
|
||||
For Each Row As GridViewRow In GvEstatusUsuariosREQ.Rows
|
||||
|
||||
Dim r As Integer = 1
|
||||
For i = 0 To Row.Cells.Count - 1
|
||||
|
||||
Dim CveEstatus As Integer = If(IsNumeric(GvEstatusUsuariosREQ.Columns(i).FooterText), GvEstatusUsuariosREQ.Columns(i).FooterText.ToEntero, 0)
|
||||
|
||||
If CveEstatus > 0 Then
|
||||
|
||||
If Row.FCCheckBox("chkEstatus" + r.ToString).Checked = False And Row.FCHiddenField("hdnCveEstatusUsuarios" + r.ToString).Value.ToEntero > 0 Then
|
||||
'Eliminar el registro existente
|
||||
If Not objEstatusOC.RemoveEstatusUsuarios(Row.FCHiddenField("hdnCveEstatusUsuarios" + r.ToString).Value.ToEntero) Then
|
||||
HuboErrores = True
|
||||
Exit For
|
||||
End If
|
||||
ElseIf Row.FCCheckBox("chkEstatus" + r.ToString).Checked = True Then
|
||||
'And Row.FCHiddenField("hdnCveEstatusUsuarios" + r.ToString).Value.ToEntero = -1
|
||||
'Guardado masivo cuando sea SubProyecto "Todos"
|
||||
If CveSubProyecto = -2 Then
|
||||
For Each dr As DataRow In GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).Rows
|
||||
If Not objEstatusOC.AddEstatusUsuarios(CveEstatus, Row.DataKey("CveUsuario").ToString.ToEntero, CveSubProyecto) Then
|
||||
HuboErrores = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If HuboErrores Then
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'Insertar el nuevo registro
|
||||
Else
|
||||
If Not objEstatusOC.AddEstatusUsuarios(CveEstatus, Row.DataKey("CveUsuario").ToString.ToEntero, CveSubProyecto) Then
|
||||
HuboErrores = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
r += 1
|
||||
End If
|
||||
Next
|
||||
|
||||
'Si tubo algun error terminamos el proceso (FOR)
|
||||
If HuboErrores Then
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
If Not HuboErrores Then
|
||||
objEstatusOC.Commit()
|
||||
Alert("Se guardaron los Cambios exitosamente", TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
objEstatusOC.RollBack()
|
||||
Alert("Ocurrió un error al guardar los cambios. Por favor vuelva a intentar", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
objEstatusOC.Dispose()
|
||||
CargaGridEstatusUsuarios()
|
||||
End Sub
|
||||
#End Region
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user