protected void btnBuscarMarca_Click(object sender, ImageClickEventArgs e) { MarcaBL oMarcaBL = new MarcaBL(); oMarcaBL.ErrorEvent += new MarcaBL.ErrorDelegate(Master.Transaction_ErrorEvent); String nomMarca = this.txtNomMarca.Text; String codEstado = this.cboEstadoMarca.SelectedValue; oMarcaBEList = oMarcaBL.GetAll(nomMarca, codEstado); if (oMarcaBEList == null || oMarcaBEList.Count == 0) { JavaScriptHelper.Alert(this, Message.keyNoRegistros, ""); if (oMarcaBEList == null) { oMarcaBEList = new MarcaBEList(); } oMarcaBEList.Add(new MarcaBE()); GuardaParametros(0); } else { GuardaParametros(1); } this.gvMarca.DataSource = oMarcaBEList; this.gvMarca.DataBind(); ViewState["oMarcaBEList"] = oMarcaBEList; this.txhIdMarca.Value = String.Empty; }
protected void btnPassReset_Click(object sender, EventArgs e) { UsuarioBL oUsuarioBL = new UsuarioBL(); oUsuarioBL.ErrorEvent += new UsuarioBL.ErrorDelegate((Master as Seguridad).Transaction_ErrorEvent); oUsuarioBE = (UsuarioBE)ViewState["oUsuarioBE"]; int retorno; try { (Master as Seguridad).onError = false; retorno = oUsuarioBL.ModificarPassWord(this.oUsuarioBE.CUSR_ID, txtClave.Text, Profile.Usuario.CUSR_ID, Profile.UsuarioRed, Profile.Estacion, "1", txtClave.Text);//I/F @016 if (!(Master as Seguridad).onError && retorno > 0) { JavaScriptHelper.Alert(this, "'La contraseña se reinicio exitosamente.'", String.Empty); } else if (retorno == -6) { JavaScriptHelper.Alert(this, "'La contraseña ya fue reinicializada.'", String.Empty); } else { JavaScriptHelper.Alert(this, Message.keyErrorGrabar, String.Empty); } } catch (Exception ex) { (Master as Seguridad).Web_ErrorEvent(this, ex); } }
protected void btnBuscar_Click(object sender, ImageClickEventArgs e) { DestinoBL oDestinoBL = new DestinoBL(); oDestinoBL.ErrorEvent += new DestinoBL.ErrorDelegate(Master.Transaction_ErrorEvent); txhIdDestinos.Value = String.Empty; String codTipoUbicacion = cboTipoDestino.SelectedValue.ToString(); String ruc = this.txtRuc.Text; String ubicacion = this.txtDescripcion.Text; String codEstado = this.ComboEstado1.SelectedValue.ToString(); //METODO DE CARGA DE PARAMETROS DestinoBE oDestinoBE = new DestinoBE(); oDestinoBE.Tipo_ubicacion = codTipoUbicacion; oDestinoBE.Nro_ruc = ruc; oDestinoBE.Nom_ubicacion = ubicacion; oDestinoBE.Cod_estado = codEstado; oDestinoBEList = oDestinoBL.Listar(oDestinoBE); if (oDestinoBEList == null || oDestinoBEList.Count == 0) { JavaScriptHelper.Alert(this, Message.keyNoRegistros, ""); oDestinoBEList.Add(new DestinoBE()); GuardaParametros("0"); } else { GuardaParametros("1"); } this.grwDestino.DataSource = oDestinoBEList; this.grwDestino.DataBind(); ViewState["oDestinoBEList"] = oDestinoBEList; }
protected void btnEliminar_Click(object sender, EventArgs e) { UsuarioBE oUsuario = new UsuarioBE(); PerfilBL oPerfilBL = new PerfilBL(); oPerfilBL.ErrorEvent += new PerfilBL.ErrorDelegate((Master as Seguridad).Transaction_ErrorEvent); try { oUsuario.NID_PERFIL = Int32.Parse(this.txhPerfilUsuarioID.Value); oUsuario.CO_USUARIO_CAMBIO = Profile.Usuario.CUSR_ID; oUsuario.NO_ESTACION_RED = Profile.Estacion; oUsuario.NO_USUARIO_RED = Profile.UsuarioRed; (Master as Seguridad).onError = false; if (oPerfilBL.EliminarUsuariosRelacionados(oUsuario) > 0 && !(Master as Seguridad).onError) { InicializaPerfilUsuario(); JavaScriptHelper.Alert(this, Message.keyElimino, String.Empty); } else { JavaScriptHelper.Alert(this, Message.keyNoElimino, String.Empty); } } catch (Exception ex) { JavaScriptHelper.Alert(this, Message.keyNoElimino, String.Empty); (Master as Seguridad).Web_ErrorEvent(this, ex); } this.txhPerfilUsuarioID.Value = String.Empty; }
protected void btnEliminar_Click(object sender, ImageClickEventArgs e) { PerfilBL oPerfilBL = new PerfilBL(); PerfilBE oPerfilBE = new PerfilBE(); oPerfilBL.ErrorEvent += new PerfilBL.ErrorDelegate(Master.Transaction_ErrorEvent); oPerfilBE.NID_PERFIL = Int32.Parse(this.txhPerfilID.Value.Trim()); oPerfilBE.CCOAPL = Profile.Aplicacion; oPerfilBE.CO_USUARIO_CAMBIO = Profile.Usuario.CUSR_ID; oPerfilBE.NO_ESTACION_RED = Profile.Estacion; oPerfilBE.NO_USUARIO_RED = Profile.UsuarioRed; Int32 retorno = oPerfilBL.EliminarPerfil(oPerfilBE); if (retorno == 1) { JavaScriptHelper.Alert(this, Message.keyElimino, ""); btnBuscar_Click(null, null); this.txhPerfilID.Value = String.Empty; } else if (retorno == 0) { JavaScriptHelper.Alert(this, Message.keyPefilEnUso, ""); this.txhPerfilID.Value = String.Empty; } else { JavaScriptHelper.Alert(this, Message.keyNoElimino, ""); this.txhPerfilID.Value = String.Empty; } }
protected void btnActivar_Click(object sender, ImageClickEventArgs e) { UsuarioBL oUsuarioBL = new UsuarioBL(); UsuarioBE oUsuarioBE = new UsuarioBE(); oUsuarioBL.ErrorEvent += new UsuarioBL.ErrorDelegate((Master as Seguridad).Transaction_ErrorEvent); Int32 retorno = 0, contador; String cadNidPuntoVenta = this.txhCadenaSelNum.Value.Trim(); String[] arrCodigos = this.txhCadenaSelNum.Value.Trim().Split('|'); contador = arrCodigos.Length - 2; oUsuarioBE.CO_USUARIO_CREA = Profile.Usuario.CUSR_ID; oUsuarioBE.NO_ESTACION_RED = Profile.Estacion; oUsuarioBE.NO_USUARIO_RED = Profile.UsuarioRed; retorno = oUsuarioBL.ActivarUsuarioMasivo(oUsuarioBE, cadNidPuntoVenta, contador); if (retorno > 0) { JavaScriptHelper.Alert(this, Message.keyActivo, String.Empty); btnBuscar_Click(null, null); this.txhUsuarioID.Value = String.Empty; } else { JavaScriptHelper.Alert(this, Message.keyNoElimino, String.Empty); this.txhUsuarioID.Value = String.Empty; } }
protected void btnGrabarPerfil_OnClick(object sender, EventArgs e) { Int32 retorno; SeguridadBL oSeguridadBL = new SeguridadBL(); oSeguridadBL.ErrorEvent += new SeguridadBL.ErrorDelegate((Master as Seguridad).Transaction_ErrorEvent); try { String cadena = String.Empty; String[] arrCodigos; arrCodigos = this.txhCodOpciones.Value.Trim().Split('|'); /*Insertamos detalle de opciones por perfil*/ String XML = Global.ObtenerXml(this.txhCodOpciones.Value.Trim(), this.txhIndOpciones.Value.Trim()); retorno = oSeguridadBL.InsertUsuarioOpcion(this.usuarioID, XML, Profile.Usuario.CUSR_ID, Profile.Estacion, Profile.UsuarioRed); if (retorno > 0) { CargaOpcionesModulo(); JavaScriptHelper.Alert(this, Message.keyGrabar, String.Empty); } else { JavaScriptHelper.Alert(this, Message.keyErrorGrabar, String.Empty); } } catch { } }
protected void btnBuscar_Click(object sender, ImageClickEventArgs e) { UsuarioBL oUsuarioBL = new UsuarioBL(); UsuarioBE oUsuarioBE = new UsuarioBE(); int perfilID; oUsuarioBL.ErrorEvent += new UsuarioBL.ErrorDelegate((Master as Seguridad).Transaction_ErrorEvent); oUsuarioBE.VNOMUSR = this.txtNombres.Text; oUsuarioBE.NO_APE_PATERNO = this.txtApeMat.Text; oUsuarioBE.NO_APE_MATERNO = this.txtApePat.Text; oUsuarioBE.NID_UBICA = 0; oUsuarioBE.NID_ROL = 0; Int32.TryParse(this.cboPerfil.SelectedValue, out perfilID); oUsuarioBE.NID_PERFIL = perfilID; oUsuarioBE.FL_INACTIVO = this.cboEstado.SelectedValue; oUsuarioBE.NU_TIPO_DOCUMENTO = this.txtNumDoc.Text; Int32 nidPuntoVenta = 0; Int32.TryParse(this.cboPuntoVenta.SelectedValue, out nidPuntoVenta); oUsuarioBE.VNOMUSR_CUSR_ID = this.txtLogin.Text.Trim(); oUsuarioListBE = oUsuarioBL.GetAllUsuarioBandeja(oUsuarioBE, Profile.Aplicacion); if (oUsuarioListBE == null || oUsuarioListBE.Count == 0) { JavaScriptHelper.Alert(this, Message.keyNoRegistros, String.Empty); oUsuarioListBE.Add(new UsuarioBE()); GuardaParametros(0); } else { this.txhCadenaTotalNum.Value = "|"; this.txhCadenaSelNum.Value = ""; txhFlagChekTodosNum.Value = ""; if (oUsuarioListBE != null || oUsuarioListBE.Count > 0) { for (int i = 0; i < oUsuarioListBE.Count; i++) { this.txhCadenaTotalNum.Value = this.txhCadenaTotalNum.Value + oUsuarioListBE[i].Nid_usuario.ToString() + "|"; } GuardaParametros(0); } GuardaParametros(1); } this.gvUsuarios.DataSource = oUsuarioListBE; this.gvUsuarios.DataBind(); ViewState["oUsuarioListBE"] = oUsuarioListBE; }
protected void btnEliminarMarca_Click(object sender, ImageClickEventArgs e) { MarcaBL oMarcaBL = new MarcaBL(); MarcaBE oMarcaBE = new MarcaBE(); oMarcaBL.ErrorEvent += new MarcaBL.ErrorDelegate(Master.Transaction_ErrorEvent); Int32 retorno; try { Master.onError = false; oMarcaBE.nid_marca = Int32.Parse(this.txhIdMarca.Value.Trim()); oMarcaBE.co_usuario_cambio = Profile.Usuario.CUSR_ID; oMarcaBE.no_estacion = Profile.Estacion; oMarcaBE.no_usuario_red = Profile.UsuarioRed; MarcaBE oMarcaBEMad = new MarcaBE(); oMarcaBEMad = oMarcaBL.GetById(oMarcaBE.nid_marca); oMarcaBE.sfe_cambio = ""; oMarcaBE.fl_inactivo = "1"; retorno = oMarcaBL.Eliminar(oMarcaBE); if (!Master.onError && retorno > 0) { //Si todo es exito recien mostrar mensaje de eliminación con exito JavaScriptHelper.Alert(this, Message.keyElimino, ""); btnBuscarMarca_Click(null, null); this.txhIdMarca.Value = String.Empty; } else { if (retorno == -5) { JavaScriptHelper.Alert(this, Message.keyNoEliminoRelacionado, ""); } else { JavaScriptHelper.Alert(this, Message.keyNoElimino, ""); } this.txhIdMarca.Value = String.Empty; } } catch (Exception ex) { Master.Web_ErrorEvent(this, ex); btnBuscarMarca_Click(null, null); JavaScriptHelper.Alert(this, Message.keyNoElimino, ""); } }
protected void btnExcel_Click(object sender, ImageClickEventArgs e) { try { ModeloBL oMaestroModeloBL = new ModeloBL(); oMaestroModeloBL.ErrorEvent += new ModeloBL.ErrorDelegate(Master.Transaction_ErrorEvent); objEnt.co_modelo = txt_codmodelo.Text.Trim(); objEnt.no_modelo = txt_nommodelo.Text.Trim(); objEnt.nid_marca = int.Parse(ddl_marca.SelectedValue.ToString().Trim()); objEnt.co_negocio = ddl_negocio.SelectedValue.ToString().Trim(); objEnt.co_familia = ddl_familia.SelectedValue.ToString(); objEnt.estado = cboEstado.SelectedValue.ToString().Trim(); this.oMaestroModeloBEList = oMaestroModeloBL.GETListarModelos(objEnt); const string RUTA_DOCUMENTOS = ConstanteBE.RUTA_MANTENIMIENTO_SRC; String carpeta = String.Empty, nombre = String.Empty, RutaFinal = String.Empty; String ruta = Convert.ToString(ConfigurationManager.AppSettings["FileServerPath"]) + RUTA_DOCUMENTOS; ruta = Utility.CrearCarpetaFileServer(ruta); String fl_Ruta = ConstanteBE.FLAT_EXCEL_SRC; ExportarExcelXml oExportarExcelXml = new ExportarExcelXml(); String archivo = oExportarExcelXml.GenerarExcelExportarModelo(this.oMaestroModeloBEList, ruta); if (!archivo.Equals("-1")) { nombre = archivo; carpeta = Utility.ObtenerCarpetaFileServer(nombre); archivo = Convert.ToString(ConfigurationManager.AppSettings["FileServerPath"]) + RUTA_DOCUMENTOS + carpeta + @"\" + Convert.ToString(nombre.Trim()); if (File.Exists(archivo)) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), String.Empty, "<script> window.open('../SGS_Comunes/SGS_VerExcelExpotable.aspx?nombreArchivo=" + nombre + "&flatRuta=" + fl_Ruta + "')</script>"); } } else { JavaScriptHelper.Alert(this, "'Problemas al generar el excel, consulte con el administrador.'", String.Empty); } } catch (Exception ex) { Master.Web_ErrorEvent(this, ex); JavaScriptHelper.Alert(this, ex.Message.ToString(), String.Empty); } }
protected void btnBuscarPerfilUsuario_Click(object sender, EventArgs e) { UsuarioBE oUsuarioBE = new UsuarioBE(); PerfilBL oPerfilBL = new PerfilBL(); oPerfilBL.ErrorEvent += new PerfilBL.ErrorDelegate((Master as Seguridad).Transaction_ErrorEvent); try { oUsuarioBE.NID_PERFIL = this.perfilID; oUsuarioBE.VNOMUSR = this.txtNomUsuario.Text; oUsuarioBE.NO_APE_PATERNO = this.txtApePat.Text; oUsuarioBE.NO_APE_MATERNO = this.txtApeMat.Text; int tipoUsuario; Int32.TryParse(this.cboTipo.SelectedValue, out tipoUsuario); oUsuarioBE.NID_TIPO = tipoUsuario; (Master as Seguridad).onError = false; oPerfilUsuarioListAsig = oPerfilBL.GetAsignacionUsuariosRelacionados(oUsuarioBE, Profile.Aplicacion); if ((Master as Seguridad).onError) { oPerfilUsuarioListAsig = new UsuarioBEList(); } this.txhCadenaTotalPU.Value = "|"; for (int i = 0; i < this.oPerfilUsuarioListAsig.Count; i++) { this.txhCadenaTotalPU.Value = this.txhCadenaTotalPU.Value + this.oPerfilUsuarioListAsig[i].Nid_usuario.ToString() + "|"; } if (oPerfilUsuarioListAsig.Count == 0) { oPerfilUsuarioListAsig.Add(new UsuarioBE()); JavaScriptHelper.Alert(this, Message.keyNoRegistros, String.Empty); } this.gvAsigPerfilUsuario.DataSource = oPerfilUsuarioListAsig; this.gvAsigPerfilUsuario.DataBind(); } catch (Exception ex) { (Master as Seguridad).Web_ErrorEvent(this, ex); } this.txhFlagChekTodosPU.Value = "0"; this.txhCadenaSelPU.Value = String.Empty; this.mpAsigPerfilUsuario.Show(); ViewState["oPerfilUsuarioListAsig"] = oPerfilUsuarioListAsig; }
/// <summary> /// 注册 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnReg_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtRegUserName.Text)) { txtRegUserName.Focus(); JavaScriptHelper.Alert("帐号不能为空。"); return; } if (string.IsNullOrEmpty(txtRegUserPwd.Text)) { txtRegUserPwd.Focus(); JavaScriptHelper.Alert("密码不能为空。"); return; } if (string.IsNullOrEmpty(txtRegUserPwd2.Text)) { txtRegUserPwd2.Focus(); JavaScriptHelper.Alert("确认密码不能为空。"); return; } if (txtRegUserPwd.Text != txtRegUserPwd2.Text) { txtRegUserPwd2.Focus(); JavaScriptHelper.Alert("两次密码输入不一致。"); return; } if (DB.getDataTable("select * from Member where UserName='******'").Rows.Count > 0) { JavaScriptHelper.Alert("此帐号已存在。"); return; } string userpwd = txtRegUserPwd.Text; string sql = "insert into Member(username,userpwd,membername,tel,wenti,daan) "; sql += "values('" + txtRegUserName.Text + "','" + userpwd + "','" + txtRegTitle.Text + "','" + txtRegTel.Text + "','" + wenti.Text + "','" + daan.Text + "')"; SqlConnection cn = DB.OpenConnection(); SqlCommand cmd = new SqlCommand(sql, cn); cmd.ExecuteNonQuery(); cn.Close(); cn.Dispose(); Common.ShowMessage(this.Page, "注册成功,请登录。", "", "userlogin.aspx"); }
/** * codEstructPagina: Estructura de pagína. * Retorno: * '' => No tiene acceso a esta opción. * '0' => Acceso de Solo Lectura. * '1' => Acceso de Lectura y Escritura. **/ public String ValidaTipoAccesoPagina(Page sender, String codEstructPagina) { String retorno = String.Empty; OpcionSeguridadBEList opciones = null; OpcionSeguridadBE opcion = null; try { opciones = Profile.Opciones; if (opciones != null) { opcion = opciones.Find(delegate(OpcionSeguridadBE p) { return(p.CSTRUCT.Trim().Equals(codEstructPagina)); }); if (opcion != null) { if (opcion.IND_REL.Trim().Equals("A")) { retorno = CONSTANTE_SEGURIDAD.AccesoEdicion; } else if (opcion.IND_REL.Trim().Equals("C")) { retorno = CONSTANTE_SEGURIDAD.AccesoConsulta; } else { JavaScriptHelper.Alert(sender, Message.keyAccesoPaginaDenegado, String.Empty); Response.Redirect("../Inicio/Default.aspx", false); Response.End(); } } else { JavaScriptHelper.Alert(sender, Message.keyAccesoPaginaDenegado, String.Empty); Response.Redirect("../Inicio/Default.aspx", false); Response.End(); } } else { btnCerrarSesion_OnClick(null, null); } } catch (Exception ex) { Web_ErrorEvent(this, ex); } return(retorno); }
protected void btnExcel_Click(object sender, ImageClickEventArgs e) { try { ServicioBL oMaestroServicioBL = new ServicioBL(); objServBE.Co_Servicio = txtCodigo.Text.Trim(); objServBE.No_Servicio = txtNom.Text.Trim();; objServBE.Id_TipoServicio = Int32.Parse(cboTServicio.SelectedValue.ToString()); objServBE.Fl_activo = CboEstado.SelectedValue.ToString(); this.oMaestroServicioBEList = oMaestroServicioBL.BusqServicioList(objServBE); const string RUTA_DOCUMENTOS = ConstanteBE.RUTA_MANTENIMIENTO_SRC; String carpeta = String.Empty, nombre = String.Empty, RutaFinal = String.Empty; String ruta = Convert.ToString(ConfigurationManager.AppSettings["FileServerPath"]) + RUTA_DOCUMENTOS; ruta = Utility.CrearCarpetaFileServer(ruta); String fl_Ruta = ConstanteBE.FLAT_EXCEL_SRC; ExportarExcelXml oExportarExcelXml = new ExportarExcelXml(); String archivo = oExportarExcelXml.GenerarExcelExportarServicio(this.oMaestroServicioBEList, ruta); if (!archivo.Equals("-1")) { nombre = archivo; carpeta = Utility.ObtenerCarpetaFileServer(nombre); archivo = Convert.ToString(ConfigurationManager.AppSettings["FileServerPath"]) + RUTA_DOCUMENTOS + carpeta + @"\" + Convert.ToString(nombre.Trim()); if (File.Exists(archivo)) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), String.Empty, "<script> window.open('../SGS_Comunes/SGS_VerExcelExpotable.aspx?nombreArchivo=" + nombre + "&flatRuta=" + fl_Ruta + "')</script>"); } } else { JavaScriptHelper.Alert(this, "'Problemas al generar el excel, consulte con el administrador.'", String.Empty); } } catch (Exception ex) { Master.Web_ErrorEvent(this, ex); JavaScriptHelper.Alert(this, ex.Message.ToString(), String.Empty); } }
protected void btnGrabar_OnClick(object sender, EventArgs e) { try { Int32 retorno; PerfilBL oPerfilBL = new PerfilBL(); oPerfilBL.ErrorEvent += new PerfilBL.ErrorDelegate((Master as Seguridad).Transaction_ErrorEvent); this.CargaDesdeForm(); retorno = oPerfilBL.GrabarPerfil(this.oPerfil); if (retorno > 0) { this.perfilID = retorno; this.oPerfil.NID_PERFIL = this.perfilID; /*Insertamos detalle de opciones por perfil*/ Int32 intRetornoP = 0; String XML = Global.ObtenerXmlPerfil(this.txhCodOpciones.Value, this.txhIndOpciones.Value, this.txhNidOpcionPerfil.Value.Trim()); intRetornoP = oPerfilBL.InsertarOpcionByPerfil(this.oPerfil, XML); if (intRetornoP > 0) { JavaScriptHelper.Alert(this, Message.keyGrabar, ""); } else { JavaScriptHelper.Alert(this, Message.keyErrorGrabar, ""); } this.CargaPerfil(); } else { JavaScriptHelper.Alert(this, Message.keyErrorGrabar, ""); } } catch { JavaScriptHelper.Alert(this, Message.keyErrorGrabar, ""); } }
protected void btnGrabar_OnClick(object sender, EventArgs e) { Int32 retorno; UsuarioBL oUsuarioBL = new UsuarioBL(); oUsuarioBL.ErrorEvent += new UsuarioBL.ErrorDelegate((Master as Seguridad).Transaction_ErrorEvent); SeguridadBL oSeguridadBL = new SeguridadBL(); oSeguridadBL.ErrorEvent += new SeguridadBL.ErrorDelegate((Master as Seguridad).Transaction_ErrorEvent); CargaDesdeForm(); if (!this.txtClave.Text.Trim().Equals(String.Empty)) { this.oUsuarioBE.VUSR_PASS = oSeguridadBL.GetEncripta(this.oUsuarioBE.VUSR_PASS); } retorno = oUsuarioBL.GrabarUsuario(this.oUsuarioBE, Profile.Aplicacion); if (retorno > 0) { this.txhNidUsuario.Value = retorno.ToString(); JavaScriptHelper.Alert(this, Message.keyGrabar, ""); this.usuarioID = retorno; this.oUsuarioBE.Nid_usuario = this.usuarioID; CargaUsuario(); } else { if (retorno == -5) { JavaScriptHelper.Alert(this, Message.keyLoginRepetido, ""); } else if (retorno == -6) { JavaScriptHelper.Alert(this, Message.keyDNIRepetido, ""); } else { JavaScriptHelper.Alert(this, Message.keyErrorGrabar, ""); } } }
protected void btnAsignarPerfilUsuario_Click(object sender, EventArgs e) { PerfilBL oPerfilBL = new PerfilBL(); UsuarioBE oUsuarioBE = new UsuarioBE(); oPerfilBL.ErrorEvent += new PerfilBL.ErrorDelegate((Master as Seguridad).Transaction_ErrorEvent); Int32 retorno; try { oUsuarioBE.NID_PERFIL = this.perfilID; oUsuarioBE.CO_USUARIO_CREA = Profile.Usuario.CUSR_ID; oUsuarioBE.NO_USUARIO_RED = Profile.UsuarioRed; oUsuarioBE.NO_ESTACION_RED = Profile.Estacion; (Master as Seguridad).onError = false; retorno = oPerfilBL.InsertarUsuariosRelacionado(oUsuarioBE, Profile.Aplicacion, this.txhCadenaSelPU.Value); if (!(Master as Seguridad).onError && retorno > 0) { JavaScriptHelper.Alert(this, Message.keyGrabar, String.Empty); InicializaPerfilUsuario(); } else if (retorno == -2) { JavaScriptHelper.Alert(this, Message.keyUsuariosNoVigentes, String.Empty); } else { JavaScriptHelper.Alert(this, Message.keyErrorGrabar, String.Empty); } } catch (Exception ex) { Master.Web_ErrorEvent(this, ex); JavaScriptHelper.Alert(this, Message.keyErrorGrabar, String.Empty); } this.mpAsigPerfilUsuario.Hide(); }
/// <summary> /// 验证 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnyz_Click(object sender, EventArgs e) { DataTable dt = DB.getDataTable("select * from member where username='******'"); if (dt.Rows.Count > 0) { username.Enabled = false; wenti.Text = dt.Rows[0]["wenti"].ToString(); hiddaan.Value = dt.Rows[0]["daan"].ToString(); tr1.Visible = true; tr2.Visible = true; tr3.Visible = true; } else { JavaScriptHelper.Alert("此用户名不存在。"); return; } }
protected void btnExcel_Click(object sender, ImageClickEventArgs e) { try { ParametrosBackOffieBL oParametrosBackOffieBL = new ParametrosBackOffieBL(); oParametrosBackOffieBL.ErrorEvent += new ParametrosBackOffieBL.ErrorDelegate(Master.Transaction_ErrorEvent); ParametrosBackOffieBEList oParametrosBackOffieBEList = new ParametrosBackOffieBEList(); oParametrosBackOffieBEList = oParametrosBackOffieBL.GETListarParametros(); const string RUTA_DOCUMENTOS = ConstanteBE.RUTA_MANTENIMIENTO_SRC; String carpeta = String.Empty, nombre = String.Empty, RutaFinal = String.Empty; String ruta = Convert.ToString(ConfigurationManager.AppSettings["FileServerPath"]) + RUTA_DOCUMENTOS; ruta = Utility.CrearCarpetaFileServer(ruta); String fl_Ruta = ConstanteBE.FLAT_EXCEL_SRC; ExportarExcelXml oExportarExcelXml = new ExportarExcelXml(); String archivo = oExportarExcelXml.GenerarExcelExportableParametroSistema(oParametrosBackOffieBEList, ruta); if (!archivo.Equals("-1")) { nombre = archivo; carpeta = Utility.ObtenerCarpetaFileServer(nombre); archivo = Convert.ToString(ConfigurationManager.AppSettings["FileServerPath"]) + RUTA_DOCUMENTOS + carpeta + @"\" + Convert.ToString(nombre.Trim()); if (File.Exists(archivo)) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), String.Empty, "<script> window.open('../SGS_Comunes/SGS_VerExcelExpotable.aspx?nombreArchivo=" + nombre + "&flatRuta=" + fl_Ruta + "')</script>"); } } else { JavaScriptHelper.Alert(this, "'Problemas al generar el excel, consulte con el administrador.'", String.Empty); } } catch (Exception ex) { Master.Web_ErrorEvent(this, ex); JavaScriptHelper.Alert(this, ex.Message.ToString(), String.Empty); } }
protected void btnEliminar_Click(object sender, ImageClickEventArgs e) { DestinoBL oDestinoBL = new DestinoBL(); oDestinoBL.ErrorEvent += new DestinoBL.ErrorDelegate(Master.Transaction_ErrorEvent); Int32 indicador = 0; String resultado = String.Empty; if (!(txhIdDestinos.Value.Equals(""))) { oDestinoBE = new DestinoBE(); oDestinoBE.Id_ubicacion = Int32.Parse(txhIdDestinos.Value.ToString()); oDestinoBE.Cod_usu_crea = Profile.Usuario.CUSR_ID; oDestinoBE.Nom_estacion = Profile.Estacion; oDestinoBE.Nom_usuario_red = Profile.UsuarioRed; indicador = oDestinoBL.Eliminar(oDestinoBE); if (indicador == -1) { JavaScriptHelper.Alert(this, Message.keyNoElimino, ""); } else if (indicador == -5) { JavaScriptHelper.Alert(this, Message.keyNoEliminoRelacionado, ""); } else if (indicador > 0) { JavaScriptHelper.Alert(this, Message.keyElimino, ""); } btnBuscar_Click(null, null); } else { JavaScriptHelper.Alert(this, Message.keySeleccioneUno, ""); } txhIdDestinos.Value = ""; }
/// <summary> /// 按钮事件:提交信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { try { string sql2 = string.Empty; string user = txtMemberUser.Text; if (string.IsNullOrEmpty(id))//添加 { if (DB.getDataTable("select * from Member where username='******'").Rows.Count > 0) { JavaScriptHelper.Alert("此帐号已存在。"); return; } else { sql2 = "insert into Member(username,userpwd,membername,tel) "; sql2 += "values('" + user + "','" + txtMemberPwd.Text + "','" + txtTitle.Text + "'," + tel.Text + "')"; } } else//修改 { sql2 = "update Member set membername='{0}',userpwd='{1}',tel='{2}' where MemberId=" + id; sql2 = string.Format(sql2, txtTitle.Text, txtMemberPwd.Text, tel.Text); } SqlConnection cn = DB.OpenConnection(); SqlCommand cmd = new SqlCommand(sql2, cn); cmd.ExecuteNonQuery(); cn.Close(); cn.Dispose(); Common.ShowMessage(this.Page, "信息保存成功!", "", "Membermanage.aspx"); } catch (Exception ex) { Common.ShowMessage(this.Page, "信息保存失败,请稍后重试。", ""); return; } }
protected void btnBuscar_Click(object sender, ImageClickEventArgs e) { PerfilBL oPerfilBL = new PerfilBL(); oPerfilBL.ErrorEvent += new PerfilBL.ErrorDelegate((Master as Seguridad).Transaction_ErrorEvent); oPerfilBEList = oPerfilBL.GetPerfilesBandeja(Profile.Aplicacion, this.txtPerfil.Text.Trim(), this.cboEstado.SelectedValue, ""); if (oPerfilBEList == null || oPerfilBEList.Count == 0) { oPerfilBEList = new PerfilBEList(); JavaScriptHelper.Alert(this, Message.keyNoRegistros, ""); oPerfilBEList.Add(new PerfilBE()); GuardaParametros(0); } else { GuardaParametros(1); } this.gvPerfiles.DataSource = oPerfilBEList; this.gvPerfiles.DataBind(); ViewState["oPerfilBEList"] = oPerfilBEList; }
protected void btnBuscarModelo_Click(object sender, ImageClickEventArgs e) { ModeloBL oModelosBL = new ModeloBL(); oModelosBL.ErrorEvent += new ModeloBL.ErrorDelegate(Master.Transaction_ErrorEvent); String codModelo = this.txtCodModelo.Text; String nomModelo = this.txtNomModelo.Text; String codEstado = this.cboEstadoModelo.SelectedValue; this.oModelosBEList = oModelosBL.GetAllBandeja(this.idMarca, codModelo, nomModelo, codEstado, Profile.Usuario.Nid_usuario); if (this.oModelosBEList == null || this.oModelosBEList.Count == 0) { JavaScriptHelper.Alert(this, Message.keyNoRegistros, ""); this.oModelosBEList.Add(new ModeloBE()); } this.gvModelo.DataSource = this.oModelosBEList; this.gvModelo.DataBind(); ViewState["oModelosBEList"] = this.oModelosBEList; this.txhIdModelo.Value = String.Empty; }
protected void GenTeam_Click(object sender, EventArgs e) { if (Session["seasonid"] == null) { return; } if (Convert.ToInt32(Session["seasonid"]) == 0) { return; } var seasonList = SeasonHelper.GetChampionLeagueGroupSeasonList(SeasonHelper.CheckIsEuropaSeasonId(Convert.ToInt32(Session["seasonid"]))); foreach (var season in seasonList) { var isFinished = SeasonHelper.CheckGroupSeasonIsFinnish(season.SeasonId); if (!isFinished) { JavaScriptHelper.Alert("ยังใส่ผล Champion League ไม่ครบทุก Group"); return; } } using (var dc = ThaitaeDataDataContext.Create()) { var checkRecord = dc.TeamSeasons.Any(item => item.SeasonId == Convert.ToInt32(Session["seasonid"])); if (checkRecord) { JavaScriptHelper.Alert("ต้องลบทีมออกให้หมดก่อนถึงจะกดปุ่มนี้ได้"); return; } } foreach (var season in seasonList) { List <TeamSeason> teamSeasonList; var leagueId = Convert.ToInt32(Session["leagueid"]); int i; if (leagueId == 14) { teamSeasonList = TeamSeasonHelper.GetChampionsLeagueFinalTeamList(season.SeasonId); i = 1; } else { teamSeasonList = TeamSeasonHelper.GetEuropaLeagueFinalTeamList(season.SeasonId); i = 2; } foreach (var teamSeason in teamSeasonList) { using (var dc = ThaitaeDataDataContext.Create()) { var teamFinalSelected = TeamSeasonHelper.GetChampionsLeagueFinalTeamFromGroupSeasonId(teamSeason.SeasonId, teamSeason.TeamId); if (teamFinalSelected == null) { var teamFinal = new TeamSeason { TeamDrew = 0, TeamGoalAgainst = 0, TeamGoalDiff = 0, TeamGoalFor = 0, TeamLoss = 0, TeamMatchPlayed = 0, TeamPts = 0, TeamRedCard = 0, TeamWon = 0, TeamYellowCard = 0, GroupSeasonId = 0, GroupSeasonOrder = leagueId == 14 ? i++ : i--, TeamId = teamSeason.TeamId, SeasonId = Convert.ToInt32(Session["seasonid"]) }; dc.TeamSeasons.InsertOnSubmit(teamFinal); } else { teamFinalSelected.GroupSeasonOrder = leagueId == 14 ? i++ : i--; } dc.SubmitChanges(); } } } }
protected void btnGrabar_Click(object sender, ImageClickEventArgs e) { DestinoBL oDestinoBL = new DestinoBL(); oDestinoBL.ErrorEvent += new DestinoBL.ErrorDelegate(Master.Transaction_ErrorEvent); Int32 indicador = 0; Int32.TryParse(txhIdDestino.Value, out destinoID); if (destinoID > 0) { CargarEntidadDesdeForm(); indicador = oDestinoBL.Modificar(oDestinoBE); if (indicador == -3) { JavaScriptHelper.Alert(this, Message.keyErrorGrabarNulo, ""); } else if (indicador == -2) { JavaScriptHelper.Alert(this, Message.KeyRUCExiste, ""); } else if (indicador == -1) { JavaScriptHelper.Alert(this, Message.keyErrorGrabar, ""); } else if (indicador > 0) { tipoAccion = ConstanteBE.TIPO_MODIFICAR; InicializaData(); JavaScriptHelper.Alert(this, Message.keyActualizar, ""); } } else { CargarEntidadDesdeForm(); indicador = oDestinoBL.Insertar(oDestinoBE); if (indicador == -3) { JavaScriptHelper.Alert(this, Message.keyErrorGrabarNulo, ""); } else if (indicador == -2) { JavaScriptHelper.Alert(this, Message.KeyRUCExiste, ""); } else if (indicador == -1) { JavaScriptHelper.Alert(this, Message.keyErrorGrabar, ""); } else if (indicador > 0) { tipoAccion = ConstanteBE.TIPO_MODIFICAR; txhIdDestino.Value = indicador.ToString(); InicializaData(); JavaScriptHelper.Alert(this, Message.keyGrabar, ""); } } }
protected void btnGrabarModelo_Click(object sender, EventArgs e) { Int32 retorno; ModeloBL oModeloBL = new ModeloBL(); oModeloBL.ErrorEvent += new ModeloBL.ErrorDelegate(Master.Transaction_ErrorEvent); try { CargarEntidadModeloDesdeForm(); ModeloBE oModeloBEMad = new ModeloBE(); oModeloBEMad = oModeloBL.GetById(oModeloBE.nid_modelo); if (this.oModeloBE.nid_modelo == 0) { this.oModeloBE.sfe_cambio = String.Empty; } //retorno = oModelosBL.grabarModelo(this.oModeloBE); retorno = oModeloBL.Grabar(this.oModeloBE); if (retorno > 0) { if (this.oModeloBE.nid_modelo == 0) { JavaScriptHelper.Alert(this, Message.keyGrabar, String.Empty); } else { JavaScriptHelper.Alert(this, Message.keyActualizar, String.Empty); } } else { if (retorno == -41) { JavaScriptHelper.Alert(this, Message.KeyModeloExistSGSNET, String.Empty); } else if (retorno == -4) { JavaScriptHelper.Alert(this, Message.keyErrorGrabarLlave, String.Empty); } else if (retorno == -3) { JavaScriptHelper.Alert(this, Message.keyErrorGrabarNulo, String.Empty); } else if (retorno == -2) { JavaScriptHelper.Alert(this, Message.keyErrorGrabarCodDuplicado, String.Empty); } else if (retorno == -1) { JavaScriptHelper.Alert(this, Message.keyErrorGrabar, String.Empty); } else { JavaScriptHelper.Alert(this, Message.keyErrorGrabar, String.Empty); } } this.txtCodModeloPoput.Text = String.Empty; this.txtNomModeloPoput.Text = String.Empty; this.cboNegocioModeloPoput.SelectedValue = String.Empty; cboNegocioModeloPoput_OnSelectedIndexChanged(null, null); this.cboLineaModeloPoput.SelectedValue = String.Empty; this.cboLineaComercialModeloPoput.SelectedValue = String.Empty; this.cboEstadoModeloPoput.SelectedValue = String.Empty; this.btnBuscarModelo_Click(null, null); } catch (Exception ex) { Master.Web_ErrorEvent(this, ex); JavaScriptHelper.Alert(this, Message.keyErrorGrabar, String.Empty); } }
protected void btnGrabarMarca_Click(object sender, ImageClickEventArgs e) { Int32 retorno, indicador2; indicador2 = 0; MarcaBL oMarcaBL = new MarcaBL(); oMarcaBL.ErrorEvent += new MarcaBL.ErrorDelegate(Master.Transaction_ErrorEvent); try { if (CargarEntidadMarcaDesdeForm()) { MarcaBE oMarcaBEMad = new MarcaBE(); oMarcaBEMad = oMarcaBL.GetById(oMarcaBE.nid_marca); retorno = oMarcaBL.Grabar(this.oMarcaBE); if (retorno > 0) { if (indicador2 > 0 || retorno > 0) { if (this.oMarcaBE.nid_marca == 0) { JavaScriptHelper.Alert(this, Message.keyGrabar, ""); } else { JavaScriptHelper.Alert(this, Message.keyActualizar, ""); } this.idMarca = retorno; this.oMarcaBE.nid_marca = this.idMarca; CargaMarca(); } } else { if (retorno == -4) { JavaScriptHelper.Alert(this, Message.keyErrorGrabarLlave, ""); } else if (retorno == -3) { JavaScriptHelper.Alert(this, Message.keyErrorGrabarNulo, ""); } else if (retorno == -2) { JavaScriptHelper.Alert(this, Message.keyErrorGrabarCodDuplicado, ""); } else if (retorno == -1) { JavaScriptHelper.Alert(this, Message.keyErrorGrabar, ""); } else { JavaScriptHelper.Alert(this, Message.keyErrorGrabar, ""); } } } } catch { } }