コード例 #1
0
        public async Task <IActionResult> Index()
        {
            var idusuario = DatosSesion.GetNameIdentifier(User);
            var usuario   = await _context.Usuario.Where(u => u.Id != Int32.Parse(idusuario)).ToListAsync();

            return(View(usuario));
        }
コード例 #2
0
 private void dataCatalogo_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == dataCatalogo.Columns["Canjear"].Index)
     {
         int      idProducto = Int32.Parse(dataCatalogo.Rows[e.RowIndex].Cells[1].Value.ToString());
         DateTime fechaCanje = DatosSesion.getFechaSistema();
         try
         {
             int stockActual      = Int32.Parse(dataCatalogo.Rows[e.RowIndex].Cells[2].Value.ToString());
             int puntosRequeridos = Int32.Parse(dataCatalogo.Rows[e.RowIndex].Cells[4].Value.ToString());
             this.validarCanje(stockActual, puntosRequeridos);
             string resultado = catalogoMng.canjearProducto(idProducto, DatosSesion.id_usuario);
             MessageBox.Show("Se realizó el canje correctamente. \n CODIGO DE CANJE: " + resultado);
             cargarCatalogo();
             this.cargarPuntosTotales();
         }
         catch (Exception exc)
         {
             MessageBox.Show(exc.Message,
                             "No pudo realizarse operacion",
                             MessageBoxButtons.OK,
                             MessageBoxIcon.Exclamation,
                             MessageBoxDefaultButton.Button1);
         }
     }
 }
コード例 #3
0
        private void iniciarBtn_Click(object sender, EventArgs e)
        {
            try
            {
                this.verificarCamposObligatorios();
                Login_Manager loginMng = new Login_Manager();
                password   = Encriptacion.getHashSha256(passBox.Text);
                id_usuario = loginMng.iniciarLogin(userBox.Text, password);
                username   = userBox.Text;
                if (id_usuario != 0)
                {
                    Boolean esPrimerLogin = loginMng.esPrimerLogueo(id_usuario);
                    if (esPrimerLogin)
                    {
                        MessageBox.Show("A continuacion debe actualizar su contraseña");
                        CambiarPassForm cambiarPassForm = new CambiarPassForm(username, password, id_usuario);
                        if (cambiarPassForm.ShowDialog(this) != DialogResult.OK)
                        {
                            cambioPassOK = false;
                            MessageBox.Show("Operacion cancelada. Debe cambiar contraseña para ingresar al sistema.");
                        }
                        cambiarPassForm.Dispose();
                        cambiarPassForm.Close();
                    }

                    if (cambioPassOK)
                    {
                        rolesDeUsuario = rolMng.getRolesConIDUsuario(id_usuario);
                        if (rolesDeUsuario.Count > 1)
                        {
                            //Abro ventana para seleccionar rol, en caso de ser necesario
                            SeleccionRolForm seleccionForm = new SeleccionRolForm(rolesDeUsuario);
                            if (seleccionForm.ShowDialog(this) == DialogResult.OK)
                            {
                                id_rol_seleccionado = seleccionForm.get_IdRolSeleccionado();
                            }
                            else
                            {
                                MessageBox.Show("Operacion cancelada");
                            }
                            seleccionForm.Dispose();
                            seleccionForm.Close();
                            this.limpiarCampos();
                        }
                        else
                        {
                            id_rol_seleccionado = rolesDeUsuario.ElementAt(0).id_rol;
                        }
                        funcionalidades = funcMng.funcionalidadesXRol(id_rol_seleccionado);
                        DatosSesion.iniciarSesion(id_usuario, username, password, id_rol_seleccionado, funcionalidades);
                        this.Close();
                    }
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
コード例 #4
0
        private void genArchivo()
        {
            DatosSesion datos = new DatosSesion("25", 1, true, 5, 2);

            string jsonAux = JsonConvert.SerializeObject(datos);

            File.AppendAllText("..\\Archivo\\ArchivoSinc.txt", jsonAux + "\n");
        }
コード例 #5
0
 private void closeSessionLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     DatosSesion.cerrar_sesion();
     inicioSesionLink.Visible   = true;
     closeSessionLink.Visible   = false;
     passLinkLabel.Visible      = false;
     menuStrip1.Visible         = false;
     this.panelReservas.Enabled = false;
 }
コード例 #6
0
 private void cargarOpciones()
 {
     this.cargarRubros();
     this.cargarEstados();
     this.cargarGradosPublicacion();
     this.cargarHorarios();
     this.cargarUbicaciones();
     publicacionCalendar.MinDate = DatosSesion.getFechaSistema();
 }
コード例 #7
0
 private void cargarOpciones()
 {
     this.cargarRubros();
     this.cargarEstados();
     this.cargarGradosPublicacion();
     this.cargarHorarios();
     this.cargarUbicaciones();
     fechaEspectaculoPicker.MinDate = DatosSesion.getFechaSistema();
 }
コード例 #8
0
        private void acceptLoginButton_Click(object sender, EventArgs e)
        {
            //obtengo funcionalidades segun el rol
            funcionalidades = funcCtrl.funcionalidadesXRol(id_rol);
            //InicioSesion segun los datos ingresaados en una clase
            DatosSesion.iniciar_sesion(id_usuario, password, id_rol, id_hotel, funcionalidades, username);

            this.Dispose();
            this.Close();
        }
コード例 #9
0
        private void EnviarDatos()
        {
            DatosSesion datos = new DatosSesion(tokenID, nro_ejercicio, result, desvios, prom);

            GenerarJSON();
            string jsonAux = JsonConvert.SerializeObject(datos);

            listaDatos.Add(datos);
            json = JsonConvert.SerializeObject(listaDatos);
            string url = "https://ataxia-services-project.herokuapp.com/session";

            //es un path de mock server
            //string url = "https://5f504b6e-15a3-4946-87de-56cdfdccf0ca.mock.pstmn.io/pathgabi";

            var request = (HttpWebRequest)WebRequest.Create(url);

            request.Method      = "POST";
            request.ContentType = "application/json";

            try
            {
                using (var streamWriter = new StreamWriter(request.GetRequestStream()))
                {
                    streamWriter.Write(json);
                    streamWriter.Flush();
                    streamWriter.Close();
                }

                var httpResponse = (HttpWebResponse)request.GetResponse();
                using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
                {
                    var result = streamReader.ReadToEnd();

                    //si todo sale exitosamente Y existe el archivo, debo eliminar el archivo:

                    if (File.Exists("..\\Archivo\\ArchivoSinc.txt"))
                    {
                        File.Delete("..\\Archivo\\ArchivoSinc.txt");
                    }
                }
            }
            catch (Exception)
            {
                //si no se puede enviar, agrego a archivo. si el archivo no existe, lo creo.
                File.AppendAllText("..\\Archivo\\ArchivoSinc.txt", jsonAux + "\n");
                //File.AppendAllText(@"\ArchivoSinc.txt", json);
                MessageBox.Show("No se ha podido sincronizar los datos.", "Error sincronización");
            }

            //genArchivo();
        }
コード例 #10
0
 private void GenerarJSON()
 {
     //si el archivo existe, no se sincronizaron otras sesiones:
     if (File.Exists("..\\Archivo\\ArchivoSinc.txt"))
     {
         string[] lines;
         lines = System.IO.File.ReadAllLines(@"..\\Archivo\\ArchivoSinc.txt");
         foreach (string line in lines)
         {
             DatosSesion d = (DatosSesion)JsonConvert.DeserializeObject(line, typeof(DatosSesion));
             listaDatos.Add(d);
         }
     }
 }
コード例 #11
0
 private void cargarHoteles()
 {
     comboHoteles.DisplayMember = "nombre";
     comboHoteles.ValueMember   = "id_hotel";
     if (DatosSesion.esGuest())
     {
         comboHoteles.DataSource = hotelCtrl.getAllHoteles();
     }
     else
     {
         List <Hotel> listHotel = new List <Hotel>();
         listHotel.Add(hotelCtrl.getHotelPorID(DatosSesion.id_hotel));
         comboHoteles.DataSource    = listHotel;
         comboHoteles.Enabled       = false;
         comboHoteles.DropDownStyle = ComboBoxStyle.DropDownList;
     }
 }
コード例 #12
0
    // Use this for initialization
    void Start()
    {
        //GameObject.DontDestroyOnLoad(this.gameObject);
        sesion = new DatosSesion();
        sesion.IniciaReestableceSesion();
        if (PlayerPrefs.GetString("sexoAlumno").Equals("true"))
        {
            alumno_sexo = true;
        }
        else
        {
            alumno_sexo = false;
        }
        fuenteAudio = GetComponent <AudioSource>();
        CambiarAudio(1);

        CambiarEstadoREIM(estadoREIM.vista1);
    }
コード例 #13
0
        public void nuevaPublicacion(int usuarioEmpresa, Double precioBase, string descripcion, string direccion, int id_grado_publicacion, int id_estadoPublicacion, int id_rubro, List <String> horariosSeleccionados, List <String> descripcionesUbicaciones, List <DateTime> fechasSeleccionadas)
        {
            DateTime fecha_publicacion = DatosSesion.getFechaSistema();
            DateTime fecha_vencimiento = fecha_publicacion.AddDays(7);

            foreach (DateTime fechaSeleccionada in fechasSeleccionadas)
            {
                foreach (String horarioSeleccionado in horariosSeleccionados)
                {
                    string resultadoEspectaculo = SQLManager.ejecutarEscalarQuery <string>("LOOPP.SP_NuevaPublicacion",
                                                                                           SQLArgumentosManager.nuevoParametro("@descripcion", descripcion).
                                                                                           add("@direccion", direccion)
                                                                                           .add("@id_grado_publicacion", id_grado_publicacion)
                                                                                           .add("@id_estado", id_estadoPublicacion)
                                                                                           .add("@rubro", id_rubro)
                                                                                           .add("@id_usuario", usuarioEmpresa)
                                                                                           .add("@fecha_publicacion", fecha_publicacion)
                                                                                           .add("@precio_base", precioBase)
                                                                                           .add("@fechaEspec", fechaSeleccionada)
                                                                                           .add("@horaEspec", horarioSeleccionado)
                                                                                           .add("@fechaVenc", fecha_vencimiento));

                    int idNuevoEspectaculo = Int32.Parse(resultadoEspectaculo);
                    if (idNuevoEspectaculo != -1)
                    {
                        foreach (String descripcionUbicacionConID in descripcionesUbicaciones)
                        {
                            int id_ubicacion = Int32.Parse((descripcionUbicacionConID.Split('-').ElementAt(0)));
                            SQLManager.ejecutarNonQuery("LOOPP.SP_NuevaUbicac_X_Espectaculo",
                                                        SQLArgumentosManager.nuevoParametro("@id_espectaculo", idNuevoEspectaculo)
                                                        .add("@id_ubicacion", id_ubicacion)
                                                        .add("@id_grado_publicacion", id_grado_publicacion)
                                                        .add("@precio_base", precioBase));
                        }
                    }
                    else
                    {
                        throw new Exception("Error al crear la publicacion. Intente nuevamente.");
                    }
                }
            }
        }
コード例 #14
0
        public string altaEmpresaYUsuario(string user, string pass, Entidades.Empresa nuevaEmpresa)
        {
            DateTime fechaCreacion = DatosSesion.getFechaSistema();

            return(SQLManager.ejecutarEscalarQuery <string> ("LOOPP.SP_NuevoEmpresa",
                                                             SQLArgumentosManager.nuevoParametro("@razon", nuevaEmpresa.razon_social)
                                                             .add("@cuit", nuevaEmpresa.cuit)
                                                             .add("@email", nuevaEmpresa.mail)
                                                             .add("@tel", nuevaEmpresa.telefono)
                                                             .add("@dir", nuevaEmpresa.direccion_calle)
                                                             .add("@dir_nro", nuevaEmpresa.direccion_nro)
                                                             .add("@dir_piso", nuevaEmpresa.direccion_piso)
                                                             .add("@dir_depto", nuevaEmpresa.direccion_depto)
                                                             .add("@localidad", nuevaEmpresa.direccion_localidad)
                                                             .add("@ciudad", nuevaEmpresa.ciudad)
                                                             .add("@codPostal", nuevaEmpresa.cod_postal)
                                                             .add("@user", user)
                                                             .add("@pass", pass)
                                                             .add("@fec_creacion", fechaCreacion)));
        }
コード例 #15
0
 public EditarPublicacionForm(Espectaculo publicacionSeleccionada)
 {
     InitializeComponent();
     this.publicacionSeleccionada = publicacionSeleccionada;
     this.cargarOpciones();
     descripcionBox.Text = publicacionSeleccionada.descripcion;
     gradosPublicacionBox.SelectedValue = publicacionSeleccionada.id_grado_publicacion;
     rubroBox.SelectedValue             = publicacionSeleccionada.id_rubro;
     estadoBox.SelectedValue            = publicacionSeleccionada.id_estado_publicacion;
     direccionBox.Text            = publicacionSeleccionada.direccion;
     priceBox.Text                = publicacionSeleccionada.precio_base.ToString("0.00");
     horariosListBox.SelectedItem = publicacionSeleccionada.hora_espectaculo;
     this.checkUbicaciones(this.getUbicacionesDeEspectaculo(publicacionSeleccionada.id_espectaculo));
     if (fechaEspectaculoPicker.MinDate.CompareTo(publicacionSeleccionada.fecha_espectaculo) <= 0)
     {
         fechaEspectaculoPicker.Value = publicacionSeleccionada.fecha_espectaculo;
     }
     else
     {
         fechaEspectaculoPicker.Value = DatosSesion.getFechaSistema();
     }
 }
コード例 #16
0
 private void cerrarSesionToolStripMenuItem_Click(object sender, EventArgs e)
 {
     DatosSesion.cerrar_sesion();
     this.Visible = false;
     reiniciar_sesion();
 }
コード例 #17
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            WriteLiteral("\r\n<!DOCTYPE html>\r\n<html lang=\"en\">\r\n");
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("head", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3802733da0382a3a3ee474b58ab41a6668b4675211909", async() => {
                WriteLiteral("\r\n    <meta charset=\"utf-8\" />\r\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\r\n    ");
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("link", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "3802733da0382a3a3ee474b58ab41a6668b4675212290", async() => {
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                WriteLiteral("\r\n    ");
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("link", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "3802733da0382a3a3ee474b58ab41a6668b4675213469", async() => {
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                WriteLiteral("\r\n    ");
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("link", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "3802733da0382a3a3ee474b58ab41a6668b4675214648", async() => {
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_0);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_3);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                WriteLiteral("\r\n    ");
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3802733da0382a3a3ee474b58ab41a6668b4675215827", async() => {
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_4);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                WriteLiteral("\r\n    ");
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3802733da0382a3a3ee474b58ab41a6668b4675216927", async() => {
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_5);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                WriteLiteral("\r\n");
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_HeadTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_HeadTagHelper);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            WriteLiteral("\r\n");
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("body", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3802733da0382a3a3ee474b58ab41a6668b4675218731", async() => {
                WriteLiteral("\r\n    <header>\r\n        <nav class=\"navbar navbar-expand-lg navbar-dark bg-primary\">\r\n            <div class=\"container\">\r\n                ");
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3802733da0382a3a3ee474b58ab41a6668b4675219137", async() => {
                    WriteLiteral("Sistema Registro");
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_6);
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_7.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_7);
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_8.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_8);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                WriteLiteral(@"
                <button class=""navbar-toggler"" type=""button"" data-toggle=""collapse"" data-target=""#navbarColor01"" aria-controls=""navbarColor01"" aria-expanded=""false"" aria-label=""Toggle navigation"">
                    <span class=""navbar-toggler-icon""></span>
                </button>

            
                <div class=""collapse navbar-collapse"" id=""navbarColor01"">
                    <ul class=""navbar-nav mr-auto"">
                        <li class=""nav-item dropdown"">
                            <a href=""#"" class=""nav-link dropdown-toggle text-white"" id=""navbarDropDown"" role=""button"" data-toggle=""dropdown"" aria-haspopup=""true"" aria-expanded=""false"">
                                Contenidos
                            </a>
                            <div class=""dropdown-menu"" aria-labelledby=""navbarDropDown"">
                                ");
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3802733da0382a3a3ee474b58ab41a6668b4675221583", async() => {
                    WriteLiteral("Clientes");
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_9);
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_10.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_10);
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_8.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_8);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                WriteLiteral("\r\n                         \r\n                                    ");
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3802733da0382a3a3ee474b58ab41a6668b4675223173", async() => {
                    WriteLiteral("Usuarios");
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_9);
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Controller = (string)__tagHelperAttribute_11.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_11);
                __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Action = (string)__tagHelperAttribute_8.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_8);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                WriteLiteral("\r\n                                \r\n                            </div>\r\n                        </li>\r\n                    </ul>\r\n                </div>\r\n");
#line 42 "C:\Users\Tavo\Desktop\Proceso Desarrollador\slnSegundoCrud\prjSegundoCrud\Views\Shared\_Layout.cshtml"
                if (User.Identity.IsAuthenticated)
                {
#line default
#line hidden
                    WriteLiteral("                    <ul class=\"navbar-nav mr-auto\">\r\n                        <li class=\"nav-item\">\r\n                            ");
                    __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3802733da0382a3a3ee474b58ab41a6668b4675225248", async() => {
                        WriteLiteral("Hola ");
#line 46 "C:\Users\Tavo\Desktop\Proceso Desarrollador\slnSegundoCrud\prjSegundoCrud\Views\Shared\_Layout.cshtml"
                        Write(DatosSesion.GetName(User));

#line default
#line hidden
                    }
                                                                                );
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper>();
                    __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper);
                    __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_12);
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Area = (string)__tagHelperAttribute_13.Value;
                    __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_13);
                    __Microsoft_AspNetCore_Mvc_TagHelpers_AnchorTagHelper.Page = (string)__tagHelperAttribute_14.Value;
                    __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_14);
                    __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_15);
                    await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                    if (!__tagHelperExecutionContext.Output.IsContentModified)
                    {
                        await __tagHelperExecutionContext.SetOutputContentAsync();
                    }
                    Write(__tagHelperExecutionContext.Output);
                    __tagHelperExecutionContext = __tagHelperScopeManager.End();
                    WriteLiteral("\r\n                        </li>\r\n                        <li class=\"nav-item\">\r\n                            ");
                    __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3802733da0382a3a3ee474b58ab41a6668b4675227264", async() => {
                        WriteLiteral("\r\n                                <button type=\"submit\" class=\"nav-link btn btn-link text-white\">Salir</button>\r\n                            ");
                    }
                                                                                );
                    __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>();
                    __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper);
                    __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>();
                    __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper);
                    __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_16);
                    __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Area = (string)__tagHelperAttribute_13.Value;
                    __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_13);
                    __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Controller = (string)__tagHelperAttribute_17.Value;
                    __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_17);
                    __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Action = (string)__tagHelperAttribute_18.Value;
                    __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_18);
                    await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                    if (!__tagHelperExecutionContext.Output.IsContentModified)
                    {
                        await __tagHelperExecutionContext.SetOutputContentAsync();
                    }
                    Write(__tagHelperExecutionContext.Output);
                    __tagHelperExecutionContext = __tagHelperScopeManager.End();
                    WriteLiteral("\r\n                        </li>\r\n");
                    WriteLiteral("                    </ul>\r\n");
#line 63 "C:\Users\Tavo\Desktop\Proceso Desarrollador\slnSegundoCrud\prjSegundoCrud\Views\Shared\_Layout.cshtml"
                }

#line default
#line hidden
                WriteLiteral("            </div>\r\n        </nav>\r\n    </header>\r\n    <div class=\"container\">\r\n        <main role=\"main\" class=\"pb-3\">\r\n            ");
#line 69 "C:\Users\Tavo\Desktop\Proceso Desarrollador\slnSegundoCrud\prjSegundoCrud\Views\Shared\_Layout.cshtml"
                Write(RenderBody());

#line default
#line hidden
                WriteLiteral("\r\n        </main>\r\n    </div>\r\n    ");
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3802733da0382a3a3ee474b58ab41a6668b4675230120", async() => {
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_19);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                WriteLiteral("\r\n    ");
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3802733da0382a3a3ee474b58ab41a6668b4675231221", async() => {
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_20);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                WriteLiteral("\r\n    ");
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("script", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "3802733da0382a3a3ee474b58ab41a6668b4675232322", async() => {
                }
                                                                            );
                __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper);
                __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper);
                __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper.Src = (string)__tagHelperAttribute_21.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_21);
#line 74 "C:\Users\Tavo\Desktop\Proceso Desarrollador\slnSegundoCrud\prjSegundoCrud\Views\Shared\_Layout.cshtml"
                __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper.AppendVersion = true;

#line default
#line hidden
                __tagHelperExecutionContext.AddTagHelperAttribute("asp-append-version", __Microsoft_AspNetCore_Mvc_TagHelpers_ScriptTagHelper.AppendVersion, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                WriteLiteral("\r\n    ");
#line 75 "C:\Users\Tavo\Desktop\Proceso Desarrollador\slnSegundoCrud\prjSegundoCrud\Views\Shared\_Layout.cshtml"
                Write(RenderSection("Scripts", required: false));

#line default
#line hidden
                WriteLiteral("\r\n");
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            WriteLiteral("\r\n</html>\r\n");
        }
コード例 #18
0
ファイル: Login.cs プロジェクト: Gatrixrd/Portal-TKPM
        /// <summary>
        /// Permite el acceso al Sistema
        /// El proveedor ya debe de haber sido importado de SAP al Portal
        /// Tambien debería estar activado
        /// </summary>
        /// <returns>
        /// Los valores recuperados y almacenados para el sistema (Session) son:
        /// IdUsuario
        /// IdPerfil
        /// TipoUsuario
        /// Usuario
        /// RFC
        /// IdProveedor
        /// Num_Proveedor
        /// NombreProveedor
        /// </returns>
        public string ValidarSesion()
        {
            try
            {
                string quienEntro          = "";
                bool   activado            = false;
                bool   tienePaquete        = false;
                bool   tienePreguntas      = false;
                bool   pregutasRespondidas = false;
                string IdProveedor         = "0";
                bool   existeenSAP         = true;

                string mensaje = "";

                try
                {
                    ds = Valida_Menu(usuario, contraseña);;//bafar.Valida_Menu(usuario, contraseña);
                    var tab = contexto.SP_Cat_Usuario(0, true, usuario, contraseña, "", 0, 0, "Carga_Menu2").ToList();
                    MVC5_full_version.Genericos.Login.Menu m = new MVC5_full_version.Genericos.Login.Menu();
                    miMenu = m.CrearMenu(tab, out mensaje);

                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        bool esUsuarioparaPasar = true;                                                                  //= > 15 Agosto
                        if (ClickFactura_WebServiceCF.Service.Clases.cs_Estaticos.EsAdministradorBafar(usuario) == true) //= > 15 Agosto Reactivar:  Genericos.cs_Estaticos.EsAdministradorBafar(usuario))
                        {
                            #region Es Administrador
                            foreach (System.Data.DataRow r in ds.Tables[0].Rows)
                            {
                                DatosSesion.Add("IdUsuario", r["IdUsuario"].ToString());
                                DatosSesion.Add("IdPerfil", r["IdPerfil"].ToString());
                                DatosSesion.Add("TipoUsuario", tipoUsuario(r["IdPerfil"].ToString()));
                                break;
                            }
                            foreach (System.Data.DataRow r in ds.Tables[1].Rows)
                            {
                                DatosSesion.Add("Usuario", r["Usuario"].ToString());
                                DatosSesion.Add("RFC", r["RFC"].ToString());

                                DatosSesion.Add("IdProveedor", r["IdProveedor"].ToString());
                                DatosSesion.Add("Num_Proveedor", r["Num_Proveedor"].ToString());
                                DatosSesion.Add("Nombre_Proveedor", r["Nombre"].ToString());
                                break;
                            }
                            foreach (System.Data.DataRow r in ds.Tables[2].Rows)
                            {
                                DatosSesion.Add("nombreProveedor", r["Compania"].ToString());
                                DatosSesion.Add("Num_Sociedad", r["Num_Sociedad"].ToString());
                                break;
                            }
                            string miNum_Proveedor = DatosSesion["Num_Proveedor"].ToString();

                            quienEntro = DatosSesion["Usuario"].ToString();
                            DatosSesion.Add("NivelAdministradorBafar", ClickFactura_WebServiceCF.Service.Clases.cs_Estaticos.EsAdministradorBafar(quienEntro).ToString());
                            if (ClickFactura_WebServiceCF.Service.Clases.cs_Estaticos.EsAdministradorBafar(quienEntro) == false)
                            {
                                var q = from s in contexto.view_queSociedadesmeTocan.AsEnumerable() where s.Num_Proveedor.Equals(miNum_Proveedor) == true select s;
                                if (q != null)
                                {
                                    if (q.Count() > 0)
                                    {
                                        foreach (var socie in q)
                                        {
                                            bool   agregar = true;
                                            string soci    = socie.Num_Sociedad;
                                            if (soci.Length > 0)
                                            {
                                                foreach (string s in misSociedades)
                                                {
                                                    if (soci.Equals(s) == true)
                                                    {
                                                        agregar = false;
                                                        break;
                                                    }
                                                }
                                                if (agregar == true)
                                                {
                                                    misSociedades.Add(soci);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                var result = contexto.Relacion_Proveedores.Where(p => p.Num_Sociedad != null).GroupBy(p => p.Num_Sociedad).Select(grp => grp.FirstOrDefault());
                                if (result != null)
                                {
                                    if (result.Count() > 0)
                                    {
                                        foreach (var socie in result)
                                        {
                                            bool   agregar = true;
                                            string soci    = socie.Num_Sociedad;
                                            if (soci.Length > 0)
                                            {
                                                foreach (string s in misSociedades)
                                                {
                                                    if (soci.Equals(s) == true)
                                                    {
                                                        agregar = false;
                                                        break;
                                                    }
                                                }
                                                if (agregar == true)
                                                {
                                                    misSociedades.Add(soci);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            //=> Genericos.cs_Estaticos.creaAcuerdoComercial(DatosSesion["RFC"]);
                            #endregion Es Administrador
                        }
                        else
                        {
                            #region Averigua si ya completo registro
                            //ACCEDIENDO AL SISTEMA!!
                            #region Obteniedo datos y configurando entorno
                            foreach (System.Data.DataRow r in ds.Tables[0].Rows)
                            {
                                DatosSesion.Add("IdUsuario", r["IdUsuario"].ToString());
                                DatosSesion.Add("IdPerfil", r["IdPerfil"].ToString());
                                //Session["IdUsuario"] = r["IdUsuario"].ToString();
                                //Session["IdPerfil"] = r["IdPerfil"].ToString();
                                DatosSesion.Add("TipoUsuario", tipoUsuario(r["IdPerfil"].ToString()));
                                break;
                            }
                            foreach (System.Data.DataRow r in ds.Tables[1].Rows)
                            {
                                DatosSesion.Add("Usuario", r["Usuario"].ToString());
                                DatosSesion.Add("RFC", r["RFC"].ToString());

                                DatosSesion.Add("IdProveedor", r["IdProveedor"].ToString());
                                DatosSesion.Add("Num_Proveedor", r["Num_Proveedor"].ToString());
                                DatosSesion.Add("Nombre_Proveedor", r["Nombre"].ToString());

                                #region       Procesos de actualización 22 Noviembre 2016

                                //ClickFacturaSAP.ClickFacturaSAPClient clienteSAP = new ClickFacturaSAP.ClickFacturaSAPClient();
                                string   fini    = "01.01." + DateTime.Now.Year.ToString();
                                string   ffin    = DateTime.Now.Day.ToString() + "." + DateTime.Now.Month.ToString() + "." + DateTime.Now.Year.ToString();
                                string   numProv = r["Num_Proveedor"].ToString();
                                string[] mensajes;

                                #region        DESCARGA DE NOTAS DE CARGO
                                bool realizado = true;           // clienteSAP.CargaNotasCargo(fini, ffin, numProv, "", "YR", out mensajes);
                                #endregion DESCARGA DE NOTAS DE CARGO

                                #endregion Procesos de actualización 22 de Noviembre 2016

                                break;
                            }
                            foreach (System.Data.DataRow r in ds.Tables[2].Rows)
                            {
                                DatosSesion.Add("nombreProveedor", r["Compania"].ToString());
                                DatosSesion.Add("Num_Sociedad", r["Num_Sociedad"].ToString());
                                break;
                            }
                            string miNum_Proveedor = DatosSesion["Num_Proveedor"].ToString();
                            quienEntro = DatosSesion["Usuario"];

                            checatienePaquete(usuario, ref activado, ref tienePaquete, ref IdProveedor, ref tienePreguntas, ref pregutasRespondidas, ref existeenSAP);
                            if (tienePaquete == false)
                            {
                                //Response.Redirect("~/WebForms/wform_escogePaquetes.aspx?user="******"&pass="******"~/WebForms/wform_peticionActivarPaquete.aspx?user="******"&Proveedor=" + IdProveedor);
                                }
                                else
                                {
                                    if (tienePreguntas == false)
                                    {
                                        //Decirle que se enviara un recordatorio de esta asignacion de preguntas secretas
                                        //string titulo = "Aún esta en proceso de activación";
                                        //mensaje = "Su administrador aún no le ha asignado preguntas de recuperación de password, le será enviado un recordatorio, este mensaje continuara hasta que le sean asignadas estas preguntas.";
                                        //Response.Redirect("~/WebForms/wform_accionRealizada.aspx?titulo=" + titulo + "&mensaje=" + mensaje + "&return=" + "wform_Login.aspx");
                                    }
                                    else
                                    {
                                        if (pregutasRespondidas == false)
                                        {
                                            //Response.Redirect("~/WebForms/wform_respondePreguntas.aspx?user="******"&ssap=" + pass);
                                        }
                                        else
                                        {
                                            if (ClickFactura_WebServiceCF.Service.Clases.cs_Estaticos.EsAdministradorBafar(quienEntro) == false)
                                            {
                                                var q = from s in contexto.view_queSociedadesmeTocan.AsEnumerable() where s.Num_Proveedor.Equals(miNum_Proveedor) == true select s;
                                                if (q != null)
                                                {
                                                    if (q.Count() > 0)
                                                    {
                                                        foreach (var socie in q)
                                                        {
                                                            bool   agregar = true;
                                                            string soci    = socie.Num_Sociedad;
                                                            if (soci.Length > 0)
                                                            {
                                                                foreach (string s in misSociedades)
                                                                {
                                                                    if (soci.Equals(s) == true)
                                                                    {
                                                                        agregar = false;
                                                                        break;
                                                                    }
                                                                }
                                                                if (agregar == true)
                                                                {
                                                                    misSociedades.Add(soci);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                var result = contexto.Relacion_Proveedores.Where(p => p.Num_Sociedad != null).GroupBy(p => p.Num_Sociedad).Select(grp => grp.FirstOrDefault());
                                                if (result != null)
                                                {
                                                    if (result.Count() > 0)
                                                    {
                                                        foreach (var socie in result)
                                                        {
                                                            bool   agregar = true;
                                                            string soci    = socie.Num_Sociedad;
                                                            if (soci.Length > 0)
                                                            {
                                                                foreach (string s in misSociedades)
                                                                {
                                                                    if (soci.Equals(s) == true)
                                                                    {
                                                                        agregar = false;
                                                                        break;
                                                                    }
                                                                }
                                                                if (agregar == true)
                                                                {
                                                                    misSociedades.Add(soci);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            // => Genericos.cs_Estaticos.creaAcuerdoComercial(DatosSesion["RFC"]);
                                        }
                                    }
                                }
                            }
                            #endregion de averiguaciones
                            #endregion Obteniedo datos y configurando entorno
                        }
                        #region Almacenando la variables de sesión con los datos generales de quien se Logeo
                        foreach (KeyValuePair <string, string> datos in DatosSesion)
                        {
                            System.Web.HttpContext.Current.Session[datos.Key] = datos.Value;
                        }
                        #endregion Almacenando la variables de sesión con los datos generales de quien se Logeo

                        return("Acceso correcto");
                    }
                    else
                    {
                        return("No puede iniciar sesión. Verifique su usuario y/o contraseña.");
                    }
                }
                catch (Exception ex)
                {
                    return("Existe un problema de comunicación con la aplicación para validar sus credenciales. Error: " + ex.Message);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
コード例 #19
0
        internal string canjearProducto(int idProducto, int id_usuario)
        {
            string resultado = SQLManager.ejecutarEscalarQuery <string>("LOOPP.SP_CanjearProducto",
                                                                        SQLArgumentosManager.nuevoParametro("@idProducto", idProducto)
                                                                        .add("@idUsuario", id_usuario)
                                                                        .add("@fechaCanje", DatosSesion.getFechaSistema()));

            string[] resultadoArray = resultado.Split(';');
            if (resultadoArray.ElementAt(0).Equals("OK"))
            {
                return(resultadoArray.ElementAt(1));
            }
            else
            {
                throw new Exception(resultadoArray.ElementAt(1));
            }
        }
コード例 #20
0
        public int iniciarLogin(string username, string pass)
        {
            string        passHash   = Encriptacion.getHashSha256(pass);
            SqlConnection connection = new SqlConnection(InfoGlobal.connectionString);
            SqlCommand    spCommand  = new SqlCommand("CUATROGDD2018.SP_login", connection);

            spCommand.CommandType = CommandType.StoredProcedure;
            connection.Open();
            spCommand.Parameters.Clear();
            //agrego parametros al SP_Login
            spCommand.Parameters.Add(new SqlParameter("@usuario", username));
            spCommand.Parameters.Add(new SqlParameter("@contras", passHash));
            spCommand.Parameters.Add("@loginCorrecto", SqlDbType.Bit).Direction  = ParameterDirection.Output;
            spCommand.Parameters.Add("@idUsuario", SqlDbType.Int).Direction      = ParameterDirection.Output;
            spCommand.Parameters.Add("@estaHabilitado", SqlDbType.Bit).Direction = ParameterDirection.Output;
            int idUsuario;

            spCommand.ExecuteNonQuery();
            Boolean loginCorrecto  = Convert.ToBoolean(spCommand.Parameters["@loginCorrecto"].Value);
            Boolean estaHabilitado = Convert.ToBoolean(spCommand.Parameters["@estaHabilitado"].Value);

            if (spCommand.Parameters["@idUsuario"].Value == System.DBNull.Value)
            {
                throw new System.ArgumentException("No existe username ingresado. Comuniquese con el administrador para crear usuario");
            }
            else
            {
                idUsuario = (int)spCommand.Parameters["@idUsuario"].Value;
            }
            if (loginCorrecto)
            {
                //reinicio contador de intentos de login
                DatosSesion.reiniciarIntentosLogin();
            }
            else
            {
                if (estaHabilitado)
                {
                    DatosSesion.incrementarIntentoLogin();
                    if (DatosSesion.seSuperoIntentosLogin())
                    {
                        //Se bloquea el usuario
                        SqlCommand commandBloquear = new SqlCommand("CUATROGDD2018.SP_BloquerUsuario", connection);
                        commandBloquear.CommandType = CommandType.StoredProcedure;
                        commandBloquear.Parameters.Add(new SqlParameter("@idUsuario", idUsuario));
                        commandBloquear.ExecuteNonQuery();
                        connection.Close();
                        MessageBox.Show("Se superaron los intentos para iniciar sesion. Usuario bloqueado. Contacte con su Administrador para desbloquear la cuenta");
                    }
                    else
                    {
                        connection.Close();
                        throw new System.ArgumentException("Contraseña incorrecta. Reingrese contraseña");
                    }
                }
                else
                {
                    connection.Close();
                    throw new System.ArgumentException("Usuario bloqueado. Contacte con su Administrador para desbloquear la cuenta");
                }
            }
            return(idUsuario);
        }
コード例 #21
0
        internal int getPuntosClienteConIdUsuario(int idUsuario)
        {
            DataTable resultTable = SQLManager.ejecutarDataTableStoreProcedure("LOOPP.SP_GetPuntosClienteConIdUsuario",
                                                                               SQLArgumentosManager.nuevoParametro("@idUsuario", idUsuario)
                                                                               .add("@fechaActual", DatosSesion.getFechaSistema()));
            Int32 puntos = 0;

            if (resultTable != null && resultTable.Rows.Count > 0)
            {
                foreach (DataRow row in resultTable.Rows)
                {
                    puntos = Int32.Parse(row["PuntosDisponibles"].ToString());
                }
            }

            return(puntos);
        }
コード例 #22
0
        public void habilitar_func_x_rol()
        {
            if (DatosSesion.esGuest())
            {
                menuStrip1.Visible       = false;
                panelSession.Visible     = false;
                inicioSesionLink.Visible = true;
                inicioSesionLink.Enabled = true;
                closeSessionLink.Visible = false;
                passLinkLabel.Visible    = false;
            }
            else
            {
                closeSessionLink.Enabled = true;
                passLinkLabel.Enabled    = true;
                inicioSesionLink.Visible = false;
            }

            panelReservas.Enabled = true;

            menuStrip1.Enabled = true;
            List <Funcionalidad> f = DatosSesion.funcionalidades;

            newReservaButton.Enabled    = f.Any(func => func.descripcion_funcionalidad == "Generar Reserva");
            updateReservaButton.Enabled = f.Any(func => func.descripcion_funcionalidad == "Generar Reserva");
            cancelReservaButton.Enabled = f.Any(func => func.descripcion_funcionalidad == "Cancelar Reserva");

            ToolStripItemCollection itemsMenu = menuStrip1.Items;


            ToolStripItem menu_usuario = itemsMenu.Find("usuariosToolStripMenuItem", true)[0];

            menu_usuario.Enabled = f.Any(func => func.descripcion_funcionalidad == "ABM Usuario");


            ToolStripItem menu_Hotel = itemsMenu.Find("aBMHotelToolStripMenuItem", true)[0];

            menu_Hotel.Enabled = f.Any(func => func.descripcion_funcionalidad == "ABM Hotel");

            ToolStripItem menu_Habitacion = itemsMenu.Find("aBMHabitacionToolStripMenuItem", true)[0];

            menu_Habitacion.Enabled = f.Any(func => func.descripcion_funcionalidad == "ABM Habitacion");

            ToolStripItem menu_cliente = itemsMenu.Find("clientesToolStripMenuItem", true)[0];

            menu_cliente.Enabled = f.Any(func => func.descripcion_funcionalidad == "ABM Clientes");


            ToolStripItem menu_rol = itemsMenu.Find("rolToolStripMenuItem", true)[0];

            menu_rol.Enabled = f.Any(func => func.descripcion_funcionalidad == "ABM Rol");

            ToolStripItem menu_estadias = itemsMenu.Find("estadíasToolStripMenuItem", true)[0];

            menu_rol.Enabled = f.Any(func => func.descripcion_funcionalidad == "Registrar Estadia");


            ToolStripItem menu_estadisticas = itemsMenu.Find("listaEstadisticasToolStripMenuItem", true)[0];

            menu_estadisticas.Enabled = f.Any(func => func.descripcion_funcionalidad == "Listado Estadistico");
        }