private void FunCargarCabecera(int _codigo) { SoftCob_PERFIL _perfilactual = new ControllerDAO().FunGetPerfilPorID(_codigo, int.Parse(Session["CodigoEMPR"].ToString())); TxtPerfil.Text = _perfilactual.perf_descripcion; TxtDescripcion.Text = _perfilactual.perf_observacion; ViewState["Perfil"] = TxtPerfil.Text; ChkCrear.Checked = (bool)_perfilactual.perf_crearparametro; ChkCrear.Text = (bool)_perfilactual.perf_crearparametro ? "Si" : "No"; ChkModificar.Checked = (bool)_perfilactual.perf_modiparametro; ChkModificar.Text = (bool)_perfilactual.perf_modiparametro ? "Si" : "No"; ChkEliminar.Checked = (bool)_perfilactual.perf_eliminaparametro; ChkEliminar.Text = (bool)_perfilactual.perf_eliminaparametro ? "Si" : "No"; ChkPerfil.Checked = (bool)_perfilactual.perf_perfilactitudinal; ChkPerfil.Text = (bool)_perfilactual.perf_perfilactitudinal ? "Si" : "No"; ChkEstilos.Checked = (bool)_perfilactual.perf_estilosnegociacion; ChkEstilos.Text = (bool)_perfilactual.perf_estilosnegociacion ? "Si" : "No"; ChkMetaprogramas.Checked = (bool)_perfilactual.perf_metaprogramas; ChkMetaprogramas.Text = (bool)_perfilactual.perf_metaprogramas ? "Si" : "No"; ChkModalidad.Checked = (bool)_perfilactual.perf_modalidades; ChkModalidad.Text = (bool)_perfilactual.perf_modalidades ? "Si" : "No"; ChkEstadosdelYo.Checked = (bool)_perfilactual.perf_estadosdelyo; ChkEstadosdelYo.Text = (bool)_perfilactual.perf_estadosdelyo ? "Si" : "No"; ChkImpulsores.Text = (bool)_perfilactual.perf_impulsores ? "Si" : "No"; ChkImpulsores.Checked = (bool)_perfilactual.perf_impulsores; ChkEstado.Checked = (bool)_perfilactual.perf_estado; ChkEstado.Text = (bool)_perfilactual.perf_estado ? "Activo" : "Inactivo"; }
protected void Page_Load(object sender, EventArgs e) { ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page); scriptManager.RegisterPostBackControl(this.ImgExportar); if (!IsPostBack) { ViewState["codigoLTCA"] = Request["codigoLTCA"]; ViewState["codigoGestor"] = Request["codigoGestor"]; ViewState["codigoCEDE"] = Request["codigoCEDE"]; ViewState["codigoCPCE"] = Request["codigoCPCE"]; ViewState["Catalogo"] = Request["Catalogo"]; ViewState["FechaDesde"] = Request["FechaDesde"]; ViewState["FechaHasta"] = Request["FechaHasta"]; ViewState["Tipo"] = Request["Tipo"]; ViewState["Gestor"] = Request["Gestor"]; ViewState["Estado"] = Request["Estado"]; SoftCob_USUARIO usuario = new ControllerDAO().FunGetUsuarioPorID(int.Parse(ViewState["codigoGestor"].ToString())); ViewState["NameGestor"] = usuario.usua_nombres + "_" + usuario.usua_apellidos; _dts = new ConsultaDatosDAO().FunConsultaDatos(23, int.Parse(ViewState["codigoLTCA"].ToString()), 0, 0, "", "", "", Session["Conectar"].ToString()); Lbltitulo.Text = "Reporte Monitoreo Lista " + _dts.Tables[0].Rows[0]["ListaTrabajo"].ToString() + " - " + usuario.usua_nombres + " " + usuario.usua_apellidos; FunCargarMantenimiento(); } }
/// <summary> /// Al ingresar los datos, se agregan a la lista de publicaciones si esta no está ya agregada y se muestra en datagrid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Publicacion_btnAgregarClick(object sender, EventArgs e) { try { if (cboTipo.SelectedIndex != -1 && CmboBxPublis_Clientes.SelectedIndex != -1 && CmboBxPublis_Barcos.SelectedIndex != -1) { Publicacion publicacion1 = new Publicacion(int.Parse(Publicacion_textBox_Tomo.Text), (Publicacion.Formato)cboTipo.SelectedValue, Publicacion_textBox_Titulo.Text, int.Parse(Publicacion_textBox_Edicion.Text), Publicacion_textBox_Editor.Text, Publicacion_textBox_Codigo.Text, ((int)nudPublicacionCantidad.Value)); if (!(publicacion1 is null)) { if (stock + publicacion1) { stock_Dtgv.Add(tabPublicacion_dtgv, Stock.Publicaciones); tabPublicacion_dtgv.Refresh(); ControllerDAO.GuardarPublicacion(publicacion1, Controller.BuscarBarcoPorId(CmboBxPublis_Barcos.Text), false); Stock.AgregarMercaderia_alBarco(publicacion1, CmboBxPublis_Clientes.Text, CmboBxPublis_Barcos.Text); MessageBox.Show("Publicación agregada con éxito", "Publicación agregada", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (this.flag == true) { DialogResult = MessageBox.Show("Esta publicación ya se encuentra en la base de datos, se agregará 1 unidad al barco seleccionado. Favor confirmar", "Agregar unidad", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (DialogResult == DialogResult.OK) { ControllerDAO.GuardarPublicacion(publicacion1, Controller.BuscarBarcoPorId(CmboBxPublis_Barcos.Text), true); Stock.AgregarMercaderia_alBarco(publicacion1, CmboBxPublis_Clientes.Text, CmboBxPublis_Barcos.Text); tabPublicacion_dtgv.Refresh(); this.flag = false; MessageBox.Show("La cantidad fue actualizada con éxito", "Publicación agregada", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { DialogResult = MessageBox.Show("Esta publicación ya se encuentra en la base de datos, se agregará 1 unidad. Favor confirmar", "Agregar unidad", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (DialogResult == DialogResult.OK) { MessageBox.Show("La cantidad fue actualizada con éxito", "Publicación duplicada", MessageBoxButtons.OK, MessageBoxIcon.Information); tabPublicacion_dtgv.Refresh(); } } } } } else { MessageBox.Show("Deberá cargar información para poder agregar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (FormatException fexe) { MessageBox.Show($"Deberá cargar información para poder agregar\n{fexe.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception exe) { MessageBox.Show($"Deberá cargar información para poder agregar\n{exe.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
protected void BtnGrabar_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(TxtPerfil.Text.Trim())) { new FuncionesDAO().FunShowJSMessage("Ingrese Nombre del Perfil..!", this); return; } if (ViewState["Perfil"].ToString() != TxtPerfil.Text.Trim().ToUpper()) { if (new ControllerDAO().FunConsultaPerfil(TxtPerfil.Text.Trim().ToUpper(), int.Parse(Session["CodigoEMPR"].ToString())) > 0) { new FuncionesDAO().FunShowJSMessage("Nombre del Perfil ya Existe..!", this); return; } } SoftCob_PERFIL _pernew = new SoftCob_PERFIL(); { _pernew.PERF_CODIGO = int.Parse(ViewState["CodigoPERF"].ToString()); _pernew.perf_descripcion = TxtPerfil.Text.ToUpper(); _pernew.perf_observacion = TxtDescripcion.Text.ToUpper(); _pernew.perf_estado = ChkEstado.Checked; _pernew.perf_crearparametro = ChkCrear.Checked; _pernew.perf_modiparametro = ChkModificar.Checked; _pernew.perf_eliminaparametro = ChkEliminar.Checked; _pernew.perf_perfilactitudinal = ChkPerfil.Checked; _pernew.perf_estilosnegociacion = ChkEstilos.Checked; _pernew.perf_metaprogramas = ChkMetaprogramas.Checked; _pernew.perf_modalidades = ChkModalidad.Checked; _pernew.perf_estadosdelyo = ChkEstadosdelYo.Checked; _pernew.perf_impulsores = ChkImpulsores.Checked; _pernew.perf_fum = DateTime.Now; _pernew.perf_uum = int.Parse(Session["usuCodigo"].ToString()); _pernew.perf_tum = Session["MachineName"].ToString(); } _mensaje = new ControllerDAO().FunUpdatePerfil(_pernew); if (_mensaje == "") { Response.Redirect("WFrm_PerfilAdmin.aspx?MensajeRetornado=Guardado con Éxito", true); } else { Lblerror.Text = _mensaje; } } catch (Exception ex) { Lblerror.Text = ex.ToString(); } }
/// <summary> /// Al cargarse este menú principal, guardará en archivos XML todo lo necesario para el funcionamiento del programa. /// Instanciará el objeto Stock, el cual es un singleton. /// Y deserializará las cartas y publicaciones en listas para su posterior manejo. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form_Mercaderia_Load(object sender, EventArgs e) { initForm = new FrmInicioPrograma(); initForm.ShowDialog(); stock = Stock.GetStock(); ControllerDAO.LeerBarcos(Stock.Barcos); ControllerDAO.LeerCartas(Stock.Cartas); ControllerDAO.LeerClientes(Stock.Clientes); ControllerDAO.LeerPublicaciones(Stock.Publicaciones); Controller.ObtenerBarcosPorCadaCliente(Stock.Clientes, Stock.Barcos); }
private void FunCargarMantenimiento() { SoftCob_MENU _menu = new ControllerDAO().FunGetMenuPorID(int.Parse(ViewState["CodigoMENU"].ToString()), int.Parse(Session["CodigoEMPR"].ToString())); TxtNombreMenu.Text = _menu.menu_descripcion; ChkEstado.Checked = _menu.menu_estado; ChkEstado.Text = _menu.menu_estado ? "Activo" : "Inactivo"; ViewState["NombreMenu"] = TxtNombreMenu.Text; _dts = new ControllerDAO().FunGetMenuNewEdit(int.Parse(ViewState["CodigoMENU"].ToString()), int.Parse(Session["CodigoEMPR"].ToString())); GrdvDatos.DataSource = _dts; GrdvDatos.DataBind(); GrdvDatos.UseAccessibleHeader = true; GrdvDatos.HeaderRow.TableSection = TableRowSection.TableHeader; _imgsubir = (ImageButton)GrdvDatos.Rows[0].Cells[3].FindControl("ImgSubirNivel"); _imgsubir.ImageUrl = "~/Botones/desactivada_up.png"; _imgsubir.Enabled = false; foreach (GridViewRow _row in GrdvDatos.Rows) { _imgsubir = _row.FindControl("ImgSubirNivel") as ImageButton; _imgbajar = _row.FindControl("ImgBajarNivel") as ImageButton; _chkagregar = _row.FindControl("ChkAgregar") as CheckBox; if (GrdvDatos.DataKeys[_row.RowIndex].Values["Selecc"].ToString() == "SI") { _chkagregar.Checked = true; } else { _chkagregar.Checked = false; } if (_chkagregar.Checked == false) { _imgsubir.ImageUrl = "~/Botones/desactivada_up.png"; _imgsubir.Enabled = false; _imgbajar.ImageUrl = "~/Botones/desactivada_down.png"; _imgbajar.Enabled = false; } else { _fila = _row.RowIndex; } } _imgbajar = (ImageButton)GrdvDatos.Rows[_fila].FindControl("imgBajarNivel"); _imgbajar.ImageUrl = "~/Botones/desactivada_down.png"; _imgbajar.Enabled = false; }
protected void BtnGrabar_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(TxtPassAnterior.Text.Trim())) { new FuncionesDAO().FunShowJSMessage("Ingrese Contraseña Anterior..!", this); return; } if (string.IsNullOrEmpty(TxtNuevoPass.Text.Trim())) { new FuncionesDAO().FunShowJSMessage("Ingrese Contraseña Nueva..!", this); return; } if (string.IsNullOrEmpty(TxtConfirmarPass.Text.Trim())) { new FuncionesDAO().FunShowJSMessage("Ingrese Confirmar Contraseña..!", this); return; } SoftCob_USUARIO _user = new ControllerDAO().FunGetUsuarioPorID(int.Parse(Session["usuCodigo"].ToString())); if (new FuncionesDAO().FunDesencripta(_user.usua_password) != TxtPassAnterior.Text.Trim()) { new FuncionesDAO().FunShowJSMessage("Contraseña anterior incorrecta..!", this); return; } if (TxtNuevoPass.Text.Trim() != TxtConfirmarPass.Text.Trim()) { new FuncionesDAO().FunShowJSMessage("Contraseñas no Coinciden..!", this); return; } _user.usua_password = new FuncionesDAO().FunEncripta(TxtNuevoPass.Text.Trim()); new ControllerDAO().FunChangePassword(_user); _redirect = string.Format("{0}?MensajeRetornado={1}", Request.Url.AbsolutePath, "Contraseña cambiada con Exito..!"); Response.Redirect(_redirect, true); } catch (Exception ex) { Lblerror.Text = ex.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page); scriptManager.RegisterPostBackControl(this.ImgExportar); if (!IsPostBack) { ViewState["codigoCEDE"] = Request["codigoCEDE"]; ViewState["codigoCPCE"] = Request["codigoCPCE"]; ViewState["codigoUSU"] = Request["codigoUSU"]; SoftCob_USUARIO usuario = new ControllerDAO().FunGetUsuarioPorID(int.Parse(ViewState["codigoUSU"].ToString())); ViewState["Gestor"] = usuario.usua_nombres + "_" + usuario.usua_apellidos; Lbltitulo.Text = "Reporte Cartera Gestor " + usuario.usua_nombres + " " + usuario.usua_apellidos; FunCargarMantenimiento(); } }
private void FunCargaMantenimiento() { try { SoftCob_TAREA _tarea = new SoftCob_TAREA(); _tarea = new ControllerDAO().FunGetTareaPorCodigo(int.Parse(ViewState["CodigoTARE"].ToString())); TxtTarea.Text = _tarea.tare_descripcion; TxtRuta.Text = _tarea.tare_programa; ChkEstado.Checked = _tarea.tare_estado; ChkEstado.Text = _tarea.tare_estado ? "Activo" : "Inactivo"; ViewState["NomTarea"] = TxtTarea.Text.Trim(); } catch (Exception ex) { Lblerror.Text = ex.ToString(); } }
private void FunCargarMantenimiento(int _Codigo) { try { SoftCob_DEPARTAMENTO _depar = new ControllerDAO().FunGetDepartamentoPorCodigo(_Codigo, int.Parse(Session["CodigoEMPR"].ToString())); TxtDepartamento.Text = _depar.depa_descripcion; ChkEstado.Text = _depar.depa_estado ? "Activo" : "Inactivo"; ChkEstado.Checked = _depar.depa_estado; ChkEvalua.Checked = _depar.depa_auxi1 == 1 ? true : false; ChkEvalua.Text = _depar.depa_auxi1 == 1 ? "SI" : "NO"; ViewState["NomDepa"] = TxtDepartamento.Text.ToUpper(); } catch (Exception ex) { Lblerror.Text = ex.ToString(); } }
private void FunCargaMantenimiento(int _codigo) { SoftCob_USUARIO _user = new ControllerDAO().FunConsultarUsuarioPorCodigo(_codigo); TxtNombres.Text = _user.usua_nombres; TxtApellidos.Text = _user.usua_apellidos; TxtUser.Text = _user.usua_login; TxtPassword.Attributes.Add("Value", new FuncionesDAO().FunDesencripta(_user.usua_password)); DdlDepartamento.SelectedValue = _user.DEPA_CODIGO.ToString(); DdlPerfil.SelectedValue = _user.PERF_CODIGO.ToString(); DdlTipoUsuario.SelectedValue = _user.usua_tipousuario.ToString(); ChkCaduca.Checked = _user.usua_caducapass; ChkCaduca.Text = _user.usua_caducapass ? "Si" : "No"; TxtFechaCaduca.Enabled = ChkCaduca.Checked; TxtFechaCaduca.Text = _user.usua_fechacaduca.ToString("MM/dd/yyyy"); ChkCambiar.Checked = _user.usua_cambiarpass; ChkCambiar.Text = _user.usua_cambiarpass ? "Si" : "No"; ChkPermisos.Checked = _user.usua_permisosespeciales; ChkPermisos.Text = _user.usua_permisosespeciales ? "Si" : "No"; ChkEstado.Checked = _user.usua_estado; ChkEstado.Text = _user.usua_estado == true ? "Activo" : "Inactivo"; ViewState["Login"] = TxtUser.Text; }
/// <summary> /// Según la opción seleccionada, leerá /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnAceptar_click(object sender, EventArgs e) { string tablaSeleccionada = lstbxTablas.SelectedItem.ToString(); switch (tablaSeleccionada) { case "Cartas especiales": ControllerDAO.LeerCartas(Stock.nuevasEdiciones_Cartas, "dbo.cartasNuevasEdiciones1"); break; case "Cartas Río Paraná": ControllerDAO.LeerCartas(Stock.nuevasEdiciones_Cartas, "dbo.cartasNuevasEdiciones2"); break; case "Listado de publicaciones especiales": ControllerDAO.LeerPublicaciones(Stock.nuevasEdiciones_Publicaciones, "dbo.publicacionesNuevasEdiciones1"); break; case "Listado de publicaciones ordinarios": ControllerDAO.LeerPublicaciones(Stock.nuevasEdiciones_Publicaciones, "dbo.publicacionesNuevasEdiciones2"); break; } this.Close(); }
protected void BtnGrabar_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(TxtParametro.Text)) { new FuncionesDAO().FunShowJSMessage("Ingrese nombre del Parámetro..!", this); return; } _dtbparametro = (DataTable)ViewState["DatosParametros"]; if (_dtbparametro.Rows.Count > 0) { List <ParametroNew> _newparametro = new List <ParametroNew>(); foreach (DataRow _drfila in _dtbparametro.Rows) { _newparametro.Add(new ParametroNew() { Codigo = int.Parse(_drfila["Codigo"].ToString()), Nombre = _drfila["Detalle"].ToString(), ValorV = _drfila["ValorV"].ToString(), ValorI = int.Parse(_drfila["ValorI"].ToString()), Orden = int.Parse(_drfila["Orden"].ToString()), Estado = _drfila["Estado"].ToString() == "Activo" ? true : false }); } _dts = new FuncionesDAO().FunCambiarDataSet(_newparametro); SoftCob_PARAMETRO_CABECERA _parametro = new SoftCob_PARAMETRO_CABECERA(); { _parametro.PARA_CODIGO = int.Parse(ViewState["CodigoParametro"].ToString()); _parametro.para_nombre = TxtParametro.Text.Trim().ToUpper(); _parametro.para_descripcion = TxtDescripcion.Text.Trim().ToUpper(); _parametro.para_estado = ChkEstadoPar.Checked; _parametro.para_auxv1 = ""; _parametro.para_auxiv2 = ""; _parametro.para_auxii1 = 0; _parametro.para_auxii2 = 0; _parametro.para_fechacreacion = DateTime.Now; _parametro.para_usuariocreacion = int.Parse(Session["usuCodigo"].ToString()); _parametro.para_terminalcreacion = Session["MachineName"].ToString(); _parametro.para_fum = DateTime.Now; _parametro.para_uum = int.Parse(Session["usuCodigo"].ToString()); _parametro.para_tum = Session["MachineName"].ToString(); } if (ViewState["CodigoParametro"].ToString() == "0") { _mensaje = new ControllerDAO().FunCrearParametro(_newparametro, _parametro); if (_mensaje != "") { Lblerror.Text = _mensaje; } else { Response.Redirect("WFrm_ParametroAdmin.aspx?MensajeRetornado=Guardado con Éxito"); } } else { if (ViewState["NombreParametro"].ToString() != TxtParametro.Text.Trim().ToUpper()) { _contar = new ControllerDAO().FunConsultaParametro(TxtParametro.Text.Trim().ToUpper()); } if (_contar == 0) { _mensaje = new ControllerDAO().FunParametroDetalle(_parametro, _dts); if (_mensaje != "") { Lblerror.Text = _mensaje; } else { Response.Redirect("WFrm_ParametroAdmin.aspx?MensajeRetornado=Guardado con Éxito", true); } } } } else { new FuncionesDAO().FunShowJSMessage("Ingrese al menos un parámetro Detalle..!", this); } } catch (Exception ex) { Lblerror.Text = ex.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["usuCodigo"] == null || Session["usuCodigo"].ToString() == "") { Response.Redirect("~/Reload.html"); } ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page); scriptManager.RegisterPostBackControl(this.ImgExportar); if (!IsPostBack) { if (Session["IN-CALL"].ToString() == "SI") { Response.Redirect("WFrm_GestionListaTrabajo.aspx?IdListaCabecera=" + Session["IdListaCabecera"].ToString(), true); return; } _dtbcodigos.Columns.Add("Codigo"); _dtbcodigos.Columns.Add("Descripcion"); ViewState["CodigosOPM"] = _dtbcodigos; _dtbgstsave.Columns.Add("CodigoCLDE"); _dtbgstsave.Columns.Add("codigoPERS"); _dtbgstsave.Columns.Add("gestorasignado"); _dtbgstsave.Columns.Add("estado"); _dtbgstsave.Columns.Add("operacion"); ViewState["DatosSave"] = _dtbgstsave; ViewState["CodigoLista"] = Request["CodigoLista"]; ViewState["Preview"] = false; ViewState["CodigoCEDE"] = "0"; ViewState["CodigoLTCA"] = "0"; ViewState["CodigoCPCE"] = "0"; ViewState["CodMarcado"] = "0"; TxtFechaInicio.Text = DateTime.Now.ToString("MM/dd/yyyy"); TxtFechaFin.Text = DateTime.Now.ToString("MM/dd/yyyy"); TxtFechaDesde.Text = DateTime.Now.ToString("MM/dd/yyyy"); TxtFechaHasta.Text = DateTime.Now.ToString("MM/dd/yyyy"); LblTotal.InnerText = "0"; FunCargarCombos(0); FunCargarCombos(1); if (int.Parse(ViewState["CodigoLista"].ToString()) == 0) { Lbltitulo.Text = "Nueva Lista de Trabajo << APOYO >>"; ViewState["Nuevo"] = "0"; } else { ViewState["CodigosOPM"] = _dtbcodigos; ViewState["Nuevo"] = "1"; PnlConfiguracion.Enabled = false; PnlGestores.Enabled = false; PnlOpcionGestion.Enabled = false; DdlEstrategia.Enabled = false; DdlCedente.Enabled = false; DdlCatalogo.Enabled = false; RdbOpcionesApoyo.Enabled = false; FunCargarMantenimiento(); _dts = new ConsultaDatosDAO().FunConsultaDatos(147, int.Parse(ViewState["CodigoLista"].ToString()), 0, 0, "", "", "", Session["Conectar"].ToString()); _codigosopm = _dts.Tables[0].Rows[0]["Codigos"].ToString().Split(','); RdbOpcionesApoyo.SelectedValue = _dts.Tables[0].Rows[0]["Opcion"].ToString(); _dtbcodigos = (DataTable)ViewState["CodigosOPM"]; SoftCob_USUARIO user = new SoftCob_USUARIO(); foreach (var datos in _codigosopm) { user = new ControllerDAO().FunGetUsuarioPorID(int.Parse(datos)); _result = _dtbcodigos.NewRow(); _result["Codigo"] = datos; _result["Descripcion"] = user.usua_nombres + " " + user.usua_apellidos; _dtbcodigos.Rows.Add(_result); } GrdvOrigen.DataSource = _dtbcodigos; GrdvOrigen.DataBind(); Lbltitulo.Text = "Editar Lista de Trabajo"; lblEstado.Visible = true; ChkEstado.Visible = true; ImgPreview.Enabled = false; TxtFechaInicio.Enabled = false; } } }
protected void BtnIngresar_Click(object sender, ImageClickEventArgs e) { try { if (Session["MachineName"] == null) { FunGetTerminal(); } _usucodigo = new ControllerDAO().FunGetLogin(0, TxtUsuario.Text, TxtClave.Text); if (_usucodigo != 0 && _usucodigo != -1 && _usucodigo != -2) { SoftCob_USUARIO _user = new ControllerDAO().FunGetUsuarioPorID(_usucodigo); Session["CodigoEMPR"] = "0"; Session["usuCodigo"] = _usucodigo; Session["usuPerfil"] = _user.PERF_CODIGO; Session["usuNombres"] = _user.usua_nombres + " " + _user.usua_apellidos; Session["usuSoloNombre"] = _user.usua_nombres; Session["usuCambiarPass"] = _user.usua_cambiarpass; ViewState["FechaCaduca"] = _user.usua_fechacaduca.ToString("MM/dd/yyyy"); Session["IN-CALL"] = "NO"; Session["PermisoEspecial"] = _user.usua_permisosespeciales ? "SI" : "NO"; Session["CedeCodigo"] = new ControllerDAO().FunGetGestor(_usucodigo); Session["CrearParam"] = _user.SoftCob_PERFIL.perf_crearparametro == true ? "SI" : "NO"; //Verificar si el password no esta if (_user.usua_caducapass) { if (DateTime.ParseExact(ViewState["usuFechaCaduca"].ToString(), "MM/dd/yyyy", CultureInfo.InvariantCulture) <= DateTime.ParseExact(DateTime.Now.ToString("MM/dd/yyyy"), "MM/dd/yyyy", CultureInfo.InvariantCulture)) { Lblmensaje.Text = "Exipiró Acceso al Usuario, consulte con el Administrador..!"; return; } } //Actualizar Status de logueo SoftCob_USUARIO _usua = new SoftCob_USUARIO(); { _usua.USUA_CODIGO = _usucodigo; _usua.usua_statuslogin = true; _usua.usua_terminallogin = Session["MachineName"].ToString(); } new ControllerDAO().FunUpdateLogueo(_usua); //Registrar Logueo inicial SoftCob_LOGUEO_TIEMPOS _loguintime = new SoftCob_LOGUEO_TIEMPOS(); { _loguintime.USUA_CODIGO = _usucodigo; _loguintime.empr_codigo = 0; _loguintime.cpce_codigo = 0; _loguintime.ltca_codigo = 0; _loguintime.loti_tipologueo = "LI"; _fechalogueo = DateTime.Now.ToString("MM/dd/yyyy"); _loguintime.loti_fechalogueo = DateTime.ParseExact(_fechalogueo, "MM/dd/yyyy", CultureInfo.InvariantCulture); _horalogueo = DateTime.Now.ToString("HH:mm:ss"); _loguintime.loti_horalogueo = TimeSpan.Parse(_horalogueo); _loguintime.loti_fechacompleta = DateTime.Now; _loguintime.loti_auxv1 = ""; _loguintime.loti_auxv2 = ""; _loguintime.loti_auxv3 = ""; _loguintime.loti_auxv4 = ""; _loguintime.loti_auxv5 = ""; _loguintime.loti_auxi1 = 0; _loguintime.loti_auxi2 = 0; _loguintime.loti_auxi3 = 0; _loguintime.loti_auxi4 = 0; _loguintime.loti_auxi5 = 0; _loguintime.loti_auxd1 = DateTime.Now; _loguintime.loti_auxd2 = DateTime.Now; _loguintime.loti_auxd3 = DateTime.Now; _loguintime.loti_auxd4 = DateTime.Now; _loguintime.loti_auxd5 = DateTime.Now; _loguintime.loti_fechacreacion = DateTime.Now; _loguintime.loti_usuariocreacion = _usucodigo; _loguintime.loti_terminalcreacion = Session["MachineName"].ToString(); } new ControllerDAO().FunCrearLogueoTiempos(_loguintime); Response.Redirect("~/Views/Mantenedor/WFrm_Principal.aspx", false); } else { switch (_usucodigo) { case 0: Lblmensaje.Text = "Usuario o Password incorrecto..!"; break; case -1: Lblmensaje.Text = "Usuario se encuentra logueado..!"; break; case -2: Lblmensaje.Text = "Usuario se encuentra logueado en esta estación..!"; break; } } } catch (Exception ex) { LblError.Text = ex.ToString(); } }
/// <summary> /// Al ingresar los datos, se agregan a la lista de cartas si esta no está ya agregada y se muestra en datagrid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Cartas_btnAgregarClick(object sender, EventArgs e) { try { DateTime fecha = DateTime.Parse(Cartas_txtBoxFechaCorreccion.Text); Carta carta1 = new Carta(Cartas_txtBoxTitulo.Text, int.Parse(Cartas_txtBoxEdicion.Text), Cartas_txtBoxEditor.Text, Cartas_txtBoxCodigo.Text, (int)nudCartaCantidad.Value, fecha); if (CmboBxCartas_Clientes.SelectedIndex != -1 && CmboBxCartas_Barcos.SelectedIndex != -1) { { if (!(carta1 is null)) { if (stock + carta1) { stock_Dtgv.Add(tabCartas_dtgv, Stock.Cartas); tabCartas_dtgv.Refresh(); MessageBox.Show("Carta agregada con éxito", "Carta agregada", MessageBoxButtons.OK, MessageBoxIcon.Information); ControllerDAO.GuardarCarta(carta1, Controller.BuscarBarcoPorId(CmboBxCartas_Barcos.Text), false); Stock.AgregarMercaderia_alBarco(carta1, CmboBxCartas_Clientes.Text, CmboBxCartas_Barcos.Text); } else { if (this.flag == true) { DialogResult = MessageBox.Show("Esta publicación ya se encuentra en la base de datos, se agregará 1 unidad al barco seleccionado. Favor confirmar", "Agregar unidad", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (DialogResult == DialogResult.OK) { ControllerDAO.GuardarCarta(carta1, Controller.BuscarBarcoPorId(CmboBxCartas_Barcos.Text), true); Stock.AgregarMercaderia_alBarco(carta1, CmboBxCartas_Clientes.Text, CmboBxCartas_Barcos.Text); tabCartas_dtgv.Refresh(); this.flag = false; MessageBox.Show("La cantidad fue actualizada con éxito", "Publicación agregada", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { DialogResult = MessageBox.Show("Esta carta ya se encuentra en la base de datos, se agregará 1 unidad. Favor confirmar", "Agregar unidad", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (DialogResult == DialogResult.OK) { ControllerDAO.GuardarCarta(carta1, Controller.BuscarBarcoPorId(CmboBxCartas_Barcos.Text), true); MessageBox.Show("La cantidad fue actualizada con éxito", "Carta duplicada", MessageBoxButtons.OK, MessageBoxIcon.Information); tabCartas_dtgv.Refresh(); } } } } } } else { MessageBox.Show("Deberá cargar información para poder agregar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (FormatException fexe) { MessageBox.Show($"Deberá cargar información para poder agregar\n{fexe.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception exe) { MessageBox.Show($"Deberá cargar información para poder agregar\n{exe.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }