Exemple #1
0
        /// <summary>
        /// Insertar registros de Auditoría en la Base de Datos.
        /// </summary>
        private void fncInsertAuditoría()
        {
            Sesion_Users su = new Sesion_Users();
            //string HostName =System.Net.Dns.GetHostByAddress(Request.UserHostAddress).HostName;
            //string RemoteHost = HttpContext.Current.Request.UserHostAddress;
            //string RemoteHost = HttpContext.Current.Request.ServerVariables["HTTP_USER_ADDR"];
            string RemoteHost = Request.ServerVariables["REMOTE_ADDR"];

            try{
                su.Registrar_Auditoria(
                    this.Session["sUser"].ToString(),
                    Convert.ToInt32(this.Session["companyid"]),
                    RemoteHost,
                    DateTime.Now);
            }
            catch (Exception ex) {
                messages = "Error: " + ex.Message.ToString();
            }
            //ObtenerDatosEnvioMail();
        }
Exemple #2
0
        //public void llenacanales()
        //{
        //    TablaInformes.Style.Value = "display:none;";

        //    iframeExcel.Attributes["src"] = "";
        //    gvLink_informes.DataBind();
        //    DataTable dtcanales = oCoon.ejecutarDataTable("UP_WEBSIGE_CLIENTE_OBTENERCNALXSERVICIO", this.Session["Cod_ServicioSel"].ToString().Trim(), Convert.ToInt32(this.Session["companyid"]));

        //    MenuCanales.Items.Clear();
        //    if (dtcanales != null)
        //    {
        //        if (dtcanales.Rows.Count > 0)
        //        {
        //            for (int i = 0; i <= dtcanales.Rows.Count - 1; i++)
        //            {
        //                MenuItem item = new MenuItem();
        //                item.Text = dtcanales.Rows[i]["nombre_canal"].ToString().Trim();
        //                item.Value = dtcanales.Rows[i]["codigo_canal"].ToString().Trim();
        //                MenuCanales.Items.Add(item);
        //            }
        //        }
        //        else
        //        {
        //            this.Session["encabemensa"] = "Señor Usuario";
        //            this.Session["cssclass"] = "MensajesSupervisor";

        //            this.Session["mensaje"] = "No existe información disponible para este servicio";
        //            Mensajes_Usuario();
        //        }
        //    }
        //}

        //protected void BtnAnfitrionaje_Click(object sender, ImageClickEventArgs e)
        //{
        //    PanelCorreos.Style.Value = "display:none;";
        //    DataTable dt = oCoon.ejecutarDataTable("UP_WEBSIGE_CLIENTE_OBTENER_CODSTRATEGY", BtnAnfitrionaje.ImageUrl, this.Session["scountry"].ToString());
        //    if (dt != null)
        //    {
        //        if (dt.Rows.Count > 0)
        //        {
        //            this.Session["Cod_ServicioSel"] = dt.Rows[0][0].ToString().Trim();
        //            llenacanales();
        //        }
        //        else
        //        {
        //            this.Session["encabemensa"] = "Señor Usuario";
        //            this.Session["cssclass"] = "MensajesSupervisor";

        //            this.Session["mensaje"] = "No existe información disponible para este servicio";
        //            Mensajes_Usuario();
        //        }
        //    }
        //}

        //protected void BtnBlitz_Click(object sender, ImageClickEventArgs e)
        //{
        //    PanelCorreos.Style.Value = "display:none;";
        //    DataTable dt = oCoon.ejecutarDataTable("UP_WEBSIGE_CLIENTE_OBTENER_CODSTRATEGY", BtnBlitz.ImageUrl, this.Session["scountry"].ToString());
        //    if (dt != null)
        //    {
        //        if (dt.Rows.Count > 0)
        //        {
        //            this.Session["Cod_ServicioSel"] = dt.Rows[0][0].ToString().Trim();
        //            llenacanales();
        //        }
        //        else
        //        {
        //            this.Session["encabemensa"] = "Señor Usuario";
        //            this.Session["cssclass"] = "MensajesSupervisor";

        //            this.Session["mensaje"] = "No existe información disponible para este servicio";
        //            Mensajes_Usuario();
        //        }
        //    }
        //}

        //protected void BtnBtl_Click(object sender, ImageClickEventArgs e)
        //{
        //    PanelCorreos.Style.Value = "display:none;";
        //    DataTable dt = oCoon.ejecutarDataTable("UP_WEBSIGE_CLIENTE_OBTENER_CODSTRATEGY", BtnBtl.ImageUrl, this.Session["scountry"].ToString());
        //    if (dt != null)
        //    {
        //        if (dt.Rows.Count > 0)
        //        {
        //            this.Session["Cod_ServicioSel"] = dt.Rows[0][0].ToString().Trim();
        //            llenacanales();
        //        }
        //        else
        //        {
        //            this.Session["encabemensa"] = "Señor Usuario";
        //            this.Session["cssclass"] = "MensajesSupervisor";

        //            this.Session["mensaje"] = "No existe información disponible para este servicio";
        //            Mensajes_Usuario();
        //        }
        //    }


        //}

        //protected void BtnCanje_Click(object sender, ImageClickEventArgs e)
        //{
        //    PanelCorreos.Style.Value = "display:none;";
        //    DataTable dt = oCoon.ejecutarDataTable("UP_WEBSIGE_CLIENTE_OBTENER_CODSTRATEGY", BtnCanje.ImageUrl, this.Session["scountry"].ToString());
        //    if (dt != null)
        //    {
        //        if (dt.Rows.Count > 0)
        //        {
        //            this.Session["Cod_ServicioSel"] = dt.Rows[0][0].ToString().Trim();
        //            llenacanales();
        //        }
        //        else
        //        {
        //            this.Session["encabemensa"] = "Señor Usuario";
        //            this.Session["cssclass"] = "MensajesSupervisor";

        //            this.Session["mensaje"] = "No existe información disponible para este servicio";
        //            Mensajes_Usuario();
        //        }
        //    }
        //}

        //protected void BtnDegustacion_Click(object sender, ImageClickEventArgs e)
        //{
        //    PanelCorreos.Style.Value = "display:none;";
        //    DataTable dt = oCoon.ejecutarDataTable("UP_WEBSIGE_CLIENTE_OBTENER_CODSTRATEGY", BtnDegustacion.ImageUrl, this.Session["scountry"].ToString());
        //    if (dt != null)
        //    {
        //        if (dt.Rows.Count > 0)
        //        {
        //            this.Session["Cod_ServicioSel"] = dt.Rows[0][0].ToString().Trim();
        //            llenacanales();
        //        }
        //        else
        //        {
        //            this.Session["encabemensa"] = "Señor Usuario";
        //            this.Session["cssclass"] = "MensajesSupervisor";

        //            this.Session["mensaje"] = "No existe información disponible para este servicio";
        //            Mensajes_Usuario();
        //        }
        //    }
        //}

        //protected void BtnImpulso_Click(object sender, ImageClickEventArgs e)
        //{
        //    PanelCorreos.Style.Value = "display:none;";
        //    DataTable dt = oCoon.ejecutarDataTable("UP_WEBSIGE_CLIENTE_OBTENER_CODSTRATEGY", BtnImpulso.ImageUrl, this.Session["scountry"].ToString());
        //    if (dt != null)
        //    {
        //        if (dt.Rows.Count > 0)
        //        {
        //            this.Session["Cod_ServicioSel"] = dt.Rows[0][0].ToString().Trim();
        //            llenacanales();
        //        }

        //        else
        //        {
        //            this.Session["encabemensa"] = "Señor Usuario";
        //            this.Session["cssclass"] = "MensajesSupervisor";

        //            this.Session["mensaje"] = "No existe información disponible para este servicio";
        //            Mensajes_Usuario();
        //        }
        //    }
        //}

        //protected void BtnMercadersimo_Click(object sender, ImageClickEventArgs e)
        //{
        //    PanelCorreos.Style.Value = "display:none;";
        //    DataTable dt = oCoon.ejecutarDataTable("UP_WEBSIGE_CLIENTE_OBTENER_CODSTRATEGY", BtnMercadersimo.ImageUrl, this.Session["scountry"].ToString());
        //    if (dt != null)
        //    {
        //        if (dt.Rows.Count > 0)
        //        {
        //            this.Session["Cod_ServicioSel"] = dt.Rows[0][0].ToString().Trim();
        //            llenacanales();
        //        }

        //        else
        //        {
        //            this.Session["encabemensa"] = "Señor Usuario";
        //            this.Session["cssclass"] = "MensajesSupervisor";

        //            this.Session["mensaje"] = "No existe información disponible para este servicio";
        //            Mensajes_Usuario();
        //        }
        //    }
        //}

        //protected void BtnSampling_Click(object sender, ImageClickEventArgs e)
        //{
        //    PanelCorreos.Style.Value = "display:none;";
        //    DataTable dt = oCoon.ejecutarDataTable("UP_WEBSIGE_CLIENTE_OBTENER_CODSTRATEGY", BtnSampling.ImageUrl, this.Session["scountry"].ToString());
        //    if (dt != null)
        //    {
        //        if (dt.Rows.Count > 0)
        //        {
        //            this.Session["Cod_ServicioSel"] = dt.Rows[0][0].ToString().Trim();
        //            llenacanales();
        //        }

        //        else
        //        {
        //            this.Session["encabemensa"] = "Señor Usuario";
        //            this.Session["cssclass"] = "MensajesSupervisor";

        //            this.Session["mensaje"] = "No existe información disponible para este servicio";
        //            Mensajes_Usuario();
        //        }
        //    }
        //}

        //protected void BtnSellSampling_Click(object sender, ImageClickEventArgs e)
        //{
        //    PanelCorreos.Style.Value = "display:none;";
        //    DataTable dt = oCoon.ejecutarDataTable("UP_WEBSIGE_CLIENTE_OBTENER_CODSTRATEGY", BtnSellSampling.ImageUrl, this.Session["scountry"].ToString());
        //    if (dt != null)
        //    {
        //        if (dt.Rows.Count > 0)
        //        {
        //            this.Session["Cod_ServicioSel"] = dt.Rows[0][0].ToString().Trim();
        //            llenacanales();
        //        }

        //        else
        //        {
        //            this.Session["encabemensa"] = "Señor Usuario";
        //            this.Session["cssclass"] = "MensajesSupervisor";

        //            this.Session["mensaje"] = "No existe información disponible para este servicio";
        //            Mensajes_Usuario();
        //        }
        //    }
        //}

        //protected void NtnVisibilidad_Click(object sender, ImageClickEventArgs e)
        //{
        //    PanelCorreos.Style.Value = "display:none;";
        //    DataTable dt = oCoon.ejecutarDataTable("UP_WEBSIGE_CLIENTE_OBTENER_CODSTRATEGY", NtnVisibilidad.ImageUrl, this.Session["scountry"].ToString());
        //    if (dt != null)
        //    {
        //        if (dt.Rows.Count > 0)
        //        {
        //            this.Session["Cod_ServicioSel"] = dt.Rows[0][0].ToString().Trim();
        //            llenacanales();
        //        }

        //        else
        //        {
        //            this.Session["encabemensa"] = "Señor Usuario";
        //            this.Session["cssclass"] = "MensajesSupervisor";

        //            this.Session["mensaje"] = "No existe información disponible para este servicio";
        //            Mensajes_Usuario();
        //        }
        //    }
        //}

        //protected void MenuCanales_MenuItemClick(object sender, MenuEventArgs e)
        //{
        //    TablaInformes.Style.Value = "display:block;";
        //    PanelCorreos.Style.Value = "display:none;";
        //    iframeExcel.Attributes["src"] = "";
        //    gvLink_informes.DataBind();
        //    DataTable dturl = oCoon.ejecutarDataTable("UP_WEBSIGE_CLIENTE_OBTENER_URLINFORMES", this.Session["scountry"].ToString(), Convert.ToInt32(this.Session["companyid"]), Convert.ToInt32(this.Session["Cod_ServicioSel"].ToString().Trim()), MenuCanales.SelectedItem.Value);
        //    gvLink_informes.DataSource = dturl;
        //    gvLink_informes.DataBind();

        //    gvLink_informes_invisible.DataSource = dturl;
        //    gvLink_informes_invisible.DataBind();

        //    gvLink_informes.SelectedIndex = -1;
        //}

        protected void gvLink_informes_SelectedIndexChanged(object sender, EventArgs e)
        {
            string RemoteHost = Request.ServerVariables["REMOTE_ADDR"];


            iframeExcel.Attributes["src"] = "";
            string fn = System.IO.Path.GetFileName(gvLink_informes_invisible.Rows[gvLink_informes.SelectedRow.DataItemIndex].Cells[1].Text.ToString().Trim());

            iframeExcel.Attributes["src"] = "Informes/" + fn;

            Sesion_Users su = new Sesion_Users();

            DataTable dtDuplicado = su.Duplicado_Auditoria_Download(this.Session["sUser"].ToString(), Convert.ToInt32(this.Session["companyid"]), this.Session["Canal"].ToString().Trim(), Convert.ToInt32(this.Session["Reporte"]), RemoteHost, fn, DateTime.Now.Hour.ToString().Trim() + ":" + DateTime.Now.Minute.ToString().Trim());

            if (dtDuplicado != null)
            {
                if (dtDuplicado.Rows.Count == 0)
                {
                    su.Registrar_Auditoria_Download(this.Session["sUser"].ToString(), Convert.ToInt32(this.Session["companyid"]), this.Session["Canal"].ToString().Trim(), Convert.ToInt32(this.Session["Reporte"]), RemoteHost, fn, DateTime.Now, DateTime.Now.Hour.ToString().Trim() + ":" + DateTime.Now.Minute.ToString().Trim());
                }
            }
        }
        protected void btningreso_Click(object sender, EventArgs e)
        {
            string sPagina = "~/";

            try
            {
                UpdateProg1.Visible    = true;
                PProgresso.Style.Value = "Display:block;";

                DateTime fFecha = Convert.ToDateTime(Session["fFecha"]);


                sUser = txtuser.Text.ToLower();

                sPassw = txtpassw.Text;
                //Se deshabilita la verificacion de sesion
                //DataTable dtsesionuser = null;
                //dtsesionuser = ProcesoAdmin.Get_User_Sesion_Conteo(sUser);

                //if (dtsesionuser.Rows.Count > 0)
                //{
                //    this.Session["encabemensa"] = "Error de Autenticacion";
                //    this.Session["mensaje"] = "El Usuario" + " " + sUser + " " + "ya tiene" + "<br>" + "una sesion SIGE Activa";
                //    this.Session["cssclass"] = "MensajesSupervisor";
                //    Mensajes_Usuario();
                //    return;


                //}


                //ProcesoAdmin.Get_Obtener_User_Sesion(sUser);

                //Guardar las variables de sesión

                this.Session["sUser"]  = sUser;
                this.Session["sPassw"] = sPassw;

                this.Session["fFecha"] = fFecha;
                //Session["Service"] = 254;
                //Session["Canal"]="1000";


                EUsuario oeUsuario = oUsuario.obtener(sUser, sPassw);


                sCoutry                    = oeUsuario.codCountry;
                sDepartament               = oeUsuario.coddepartam;
                scity                      = oeUsuario.codcity;
                smail                      = oeUsuario.PersonEmail;
                this.Session["smail"]      = smail;
                this.Session["companyid"]  = oeUsuario.companyid;
                this.Session["fotocomany"] = oeUsuario.fotocompany;

                sNombre = oeUsuario.companyName;



                this.Session["sNombre"] = sNombre;

                snameuser = oeUsuario.PersonFirtsname + " " + oeUsuario.PersonSurname;
                this.Session["nameuser"] = snameuser;

                smodul = oeUsuario.Moduloid;
                this.Session["scountry"] = sCoutry;
                this.Session["scity"]    = scity;
                this.Session["personid"] = oeUsuario.Personid;
                this.Session["smodul"]   = smodul;
                idnivel = oeUsuario.idlevel;
                this.Session["idnivel"] = idnivel;

                snamenivel = oeUsuario.leveldescription;
                this.Session["namenivel"]  = snamenivel;
                this.Session["Perfilid"]   = oeUsuario.Perfilid;
                this.Session["nameperfil"] = oeUsuario.NamePerfil;
                this.Session["Service"]    = 254;
                this.Session["Canal"]      = "0";
                this.Session["Nivel"]      = 0;

                Sesion_Users su = new Sesion_Users();
                //string HostName =System.Net.Dns.GetHostByAddress(Request.UserHostAddress).HostName;
                //string RemoteHost = HttpContext.Current.Request.UserHostAddress;
                //string RemoteHost = HttpContext.Current.Request.ServerVariables["HTTP_USER_ADDR"];


                string RemoteHost = Request.ServerVariables["REMOTE_ADDR"];



                su.Registrar_Auditoria(this.Session["sUser"].ToString(), Convert.ToInt32(this.Session["companyid"]), RemoteHost, DateTime.Now);


                ObtenerDatosEnvioMail();

                if (oeUsuario != null)
                {
                    UsuarioAcceso  oUsuarioAcceso  = new UsuarioAcceso();
                    EUsuarioAcceso oeUsuarioAcceso = new EUsuarioAcceso();
                    oeUsuarioAcceso = oUsuarioAcceso.obtenerAleatorioxUsuario(sUser, sPassw);
                    UniqueLogin(sUser);
                    AplicacionWeb  oAplicacionWeb  = new AplicacionWeb();
                    EAplicacionWeb oeAplicacionWeb = oAplicacionWeb.obtenerAplicacion(sCoutry, smodul);
                    this.Session["oeAplicacionWeb"] = oeAplicacionWeb;
                    this.Session["cod_applucky"]    = oeAplicacionWeb.codapplucky;
                    this.Session["abr_app"]         = oeAplicacionWeb.abrapp;
                    this.Session["app_url"]         = oeAplicacionWeb.appurl;
                    sPagina         = oeAplicacionWeb.HomePage;
                    oeUsuarioAcceso = null;
                    oeAplicacionWeb = null;
                    oAplicacionWeb  = null;
                }
                //PProgresso.Style.Value = "Display:none";
                //PProgresso_ModalPopupExtender.Hide();
            }



            catch (Exception ex)
            {
                Lucky.CFG.Exceptions.Exceptions exs = new Lucky.CFG.Exceptions.Exceptions(ex);
                string errMessage = "";
                if (ex.Message.Substring(0, 20) == "Error en la Autenticación de Usuario" ||
                    ex.Message.Substring(0, 20) == "La Clave es Errrada o Usuario no Existe")
                {
                    //errMessage = new Lucky.CFG.Util.Functions().preparaMsgError(ex.Message);


                    //this.Response.Redirect("~/err_mensaje.aspx?msg=" + errMessage, true);
                    this.Session["encabemensa"] = "Error de Autenticación";
                    this.Session["mensaje"]     = "Usuario y/o Clave Erradas";
                    this.Session["cssclass"]    = "MensajesSupervisor";
                    Mensajes_Usuario();
                    return;
                }
                else
                {
                    //Enviar error a fin de evitar que este se pierda con el redirect de página.

                    exs.Country = "SIGE(" + ConfigurationManager.AppSettings["COUNTRY"] + ") - Usuario " + this.Session["sUser"].ToString();
                    string sCountry = ConfigurationManager.AppSettings["COUNTRY"];
                    //exs.errorWebsite(sCountry);
                    //errMessage += new Lucky.CFG.Util.Functions().preparaMsgError(ex.Message);
                    errMessage = "Error de Autenticacion para " + ' ' + sUser + ' ' + "Clave errada o Usuario Inactivo";
                    this.Session["errMessage"] = errMessage;
                    //this.Response.Redirect("~/err_mensaje.aspx?msg=" + errMessage, true);
                    this.Session["encabemensa"] = "Error de Autenticacion";
                    this.Session["mensaje"]     = "Usuario y/o Clave Erradas";
                    this.Session["cssclass"]    = "MensajesSupervisor";
                    ProcesoAdmin.Get_Delete_Sesion_User(sUser);
                    Mensajes_Usuario();
                    return;
                }
            }

            EEntrySeccion oeSeccion = oSeccion.PrimerAcceso(sUser);

            if (oeSeccion.seccionname == "1")
            {
                Response.Redirect("Cambio_pswd.aspx", true);
            }
            //if (Request.Cookies["SIGE_URLRedirect"] == null)
            //{


            //    this.Response.Redirect("~/" + sPagina, true);



            //}
            else
            {
                //HttpCookie hcURLRedirect = Request.Cookies["SIGE_URLRedirect"];
                this.Response.Redirect("~/" + sPagina, true);
            }
        }