Exemple #1
0
        protected void login(string user, string pas, string loginTipo)
        {
            try
            {
                if (!checkLicenseVersion2())
                {
                    return;
                }



                if (user.Equals("") || pas.Equals(""))
                {
                    //Response.Write("<script>javascript:alert('Please enter user name and password');</script>");
                    LabelCopyright.Text = "Usuario y clave obligatorios";
                    return;
                }


                UserData myUser = new UserData();

                streamingcpanel.DataAccess.DAUsers muDBUser = new streamingcpanel.DataAccess.DAUsers();
                myUser = muDBUser.ValidUser(user.Trim(), pas.Trim());
                muDBUser.cerrar();



                if (CheckBoxRemember.Checked)
                {
                    HttpCookie myCookie = new HttpCookie("info.usastreams");
                    myCookie.Value   = myUser.User_ID.ToString();
                    myCookie.Expires = DateTime.Now.AddMonths(3);
                    Response.Cookies.Add(myCookie);
                }



                if (myUser.User_UserType == (int)enumUserType.Standar)
                {
                    System.Web.Security.FormsAuthentication.SetAuthCookie(UCTextBoxUser.Text, false);
                    Response.Redirect(Constantes.PORTAL_URL + "dentro/Home.aspx", true);
                }

                //JOSE TO-DO; En un futuro crearemos administradores.
                //if (myUser.User_UserType == (int)enumUserType.Admin)
                //{
                //    System.Web.Security.FormsAuthentication.SetAuthCookie(UCTextBoxUser.Text, false);
                //    Response.Redirect(Constantes.PORTAL_URL + "cmsAdmin/home.aspx", true);
                //}

                return;
            }
            catch (Exception ex)
            {
                this.LabelCopyright.Text = "ERROR: " + ex.Message;
            }
        }
        protected void LinkButtonSaveAccount_Click(object sender, EventArgs e)
        {
            try
            {
                UserData myUser = userPersonalData1.User_SetGetUserData;

                bool isNew = true;
                //decimal id = 0;
                //if (this.Request.QueryString["id"] != null)
                //{
                //    id = decimal.Parse(this.Request.QueryString["id"].ToString());
                //}

                decimal resellerID = 0;

                if (this.Request.QueryString["resellerID"] != null)
                {
                    resellerID = decimal.Parse(this.Request.QueryString["resellerID"].ToString());
                }

                if (resellerID == 0)
                {
                    myUser.User_EsGratis = 0;
                }

                string sPath = Constantes.PORTAL_URL + myUser.User_USerLogin + "\\";
                myUser.User_path = sPath;

                myUser.User_Alert         = "** Usuario Nuevo, Registracion web";
                myUser.User_F_Expired     = "1/1/2025";
                myUser.User_F_NextPayment = "1/1/2025";
                myUser.User_resellerID    = resellerID;
                myUser.User_UserType      = (int)enumUserType.Standar;
                myUser.User_UserState     = 1;
                myUser.User_CRM           = "2";

                streamingcpanel.DataAccess.DAUsers muDBUser = new streamingcpanel.DataAccess.DAUsers();
                myUser = muDBUser.SaveUser(myUser, isNew);
                muDBUser.cerrar();

                //if (resellerID == 0)
                //{
                //    streamingcpanel.Objects.ClassEmailSended.emailNewUser(resellerID.ToString(), myUser.User_USerLogin.Trim(), myUser.User_name.Trim(), myUser.User_USerEmail, myUser.User_UserPassword);
                //}
                //else
                //{
                //    streamingcpanel.Objects.ClassEmailSended.emailNewUser(resellerID.ToString(), myUser.User_USerLogin.Trim(), myUser.User_name.Trim(), "", myUser.User_UserPassword);
                //}

                Response.Redirect("newConfirmacion.aspx", true);
            }
            catch (Exception ex)
            {
            }
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string data = "";


            try
            {
                if (!this.IsPostBack)
                {
                    UserData user = ((BasePage)this.Page).Session_CurrentUserData;
                    if (user == null)
                    {
                        //JOSE TODO;
                        //El usuario no puede venir nulo, pues en default.aspx se carga el invitado si no hay cookie
                        //Se puede volver al login
                        //Response.Redirect(Constantes.PORTAL_URL + "../Default.aspx?logout=1", true);

                        //O bien
                        //Se puede cargar el usuario default agregando el usuario a BasePage
                        streamingcpanel.DataAccess.DAUsers muDBUser = new streamingcpanel.DataAccess.DAUsers();
                        user = muDBUser.GetOneUser(streamingcpanel.Constantes.USERFORDEFAULT);
                        muDBUser.cerrar();
                        ((BasePage)this.Page).Session_CurrentUserData = user;
                    }


                    this.LabelMenu.Text = menus.createMenuBootstrap(user);


                    DAModule daModulo = new DAModule();
                    List <DAModuleEntity> moduloEntityList = daModulo.traerModulosPorUsuarioyDefecto(user.User_ID);
                    daModulo.cerrar();
                    string moduleText = "";
                    if (moduloEntityList != null && moduloEntityList.Any())
                    {
                        for (int i = 0; i < moduloEntityList.Count; i++)
                        {
                            moduleText += PaintModule(moduloEntityList[i].Nombre, moduloEntityList[i].Imagen);
                        }
                    }

                    LabelInfoModule.Text = moduleText;
                }
            }
            catch (Exception ex)
            {
                data = ex.Message;
            }


            LabelDatos.Text = data;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                UserData user = ((BasePage)this.Page).Session_CurrentUserData;
                if (user == null)
                {
                    streamingcpanel.DataAccess.DAUsers muDBUser = new streamingcpanel.DataAccess.DAUsers();
                    user = muDBUser.GetOneUser(streamingcpanel.Constantes.USERFORDEFAULT);
                    muDBUser.cerrar();
                }

                string itemID = "";
                string tipo   = "";
                string nota   = "";
                if (this.Request.QueryString["tipo"] != null)
                {
                    //itemID = this.Request.QueryString["itemID"].ToString();
                    if (this.Request.QueryString["tipo"] != null)
                    {
                        tipo = this.Request.QueryString["tipo"].ToString();
                    }


                    if (tipo.Equals("Alertas"))
                    {
                        streamingcpanel.DataAccess.DAUsers muDBUser = new streamingcpanel.DataAccess.DAUsers();
                        nota = muDBUser.GetUserAlerta("1");
                        muDBUser.cerrar();
                        //this.UCTextBoxNotes.Text = nota;
                    }
                    if (tipo.Equals("Tareas"))
                    {
                        streamingcpanel.DataAccess.DANotas myDBSupp = new streamingcpanel.DataAccess.DANotas();
                        List <string> lstNotes = myDBSupp.traerNotasPorUsuario(user.User_ID);
                        myDBSupp.cerrar();
                        //this.UCTextBoxNotes.Text = nota;
                        if (lstNotes != null && lstNotes.Any())
                        {
                            string html = "<div class='col-sm-12 col-md-12 marginFromBoton row'>";
                            for (int i = 0; i < lstNotes.Count; i++)
                            {
                                html += "<div class='col-sm-6 col-md-5 divBoxNotes'> <span>" + lstNotes[i] + "</span> </div>";
                            }
                            html += "</div>";
                            LabeldinamicLabel.Text = html;
                        }
                    }
                }
            }
        }
        protected void LinkButtonSaveAccount_Click(object sender, EventArgs e)
        {
            try
            {
                UserData myUser = userPersonalData1.User_SetGetUserData;

                bool isNew = true;
                //decimal id = 0;
                //if (this.Request.QueryString["id"] != null)
                //{
                //    id = decimal.Parse(this.Request.QueryString["id"].ToString());
                //}

                decimal resellerID = 0;

                if (this.Request.QueryString["resellerID"] != null)
                {
                    resellerID = decimal.Parse(this.Request.QueryString["resellerID"].ToString());
                }

                if (resellerID == 0)
                {
                    myUser.User_EsGratis = 0;
                }

                string sPath = Constantes.PORTAL_URL + myUser.User_USerLogin + "\\";
                myUser.User_path = sPath;

                myUser.User_Alert         = "** Usuario Nuevo, Registracion web";
                myUser.User_F_Expired     = "1/1/2025";
                myUser.User_F_NextPayment = "1/1/2025";
                myUser.User_resellerID    = resellerID;
                myUser.User_UserType      = (int)enumUserType.Standar;
                myUser.User_UserState     = 1;
                myUser.User_CRM           = "2";

                streamingcpanel.DataAccess.DAUsers muDBUser = new streamingcpanel.DataAccess.DAUsers();
                myUser = muDBUser.SaveUser(myUser, isNew);
                muDBUser.cerrar();


                Response.Redirect("registroFinalizado.aspx?User="******"ERROR: " + ex.Message;
            }
        }
Exemple #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.IsPostBack)
                {
                    this.LabelCopyright.Text = Constantes.COPYRIGHT;
                    System.Web.Security.FormsAuthentication.SignOut();


                    if (this.Request.QueryString["Logout"] == null)
                    {
                        HttpCookie myCookie1 = new HttpCookie("info.usastreams");
                        myCookie1 = Request.Cookies["info.usastreams"];
                        if (myCookie1 != null)
                        {
                            string userID = myCookie1.Value;
                            streamingcpanel.DataAccess.DAUsers muDBUser = new streamingcpanel.DataAccess.DAUsers();
                            UserData myUser = muDBUser.GetOneUser(decimal.Parse(userID));
                            muDBUser.cerrar();
                            string user = myUser.User_USerLogin;
                            string pas  = myUser.User_UserPassword;
                            if (myUser.User_UserState == 1)
                            {
                                login(user, pas, "COOKIE");
                            }
                        }
                        else
                        {
                            //JOSE TERMINADO; Esto significa que no existe la cookie.
                            //Entonces cargamos al usuario default, lo grabamos en basePage y entramos logeados como invitado
                            // Al hacer login con este usuario, aparecera un menu nuevo de registrarse y login.
                            //Si le da registrarse, grabamos la cookie con su usuario y entramos.
                            //si le da login, le permite cambiar de usuario invitado a su usuario.

                            streamingcpanel.DataAccess.DAUsers muDBUser = new streamingcpanel.DataAccess.DAUsers();
                            UserData user = ((BasePage)this.Page).Session_CurrentUserData;
                            user = muDBUser.GetOneUser(streamingcpanel.Constantes.USERFORDEFAULT);
                            muDBUser.cerrar();
                            ((BasePage)this.Page).Session_CurrentUserData = user;
                            System.Web.Security.FormsAuthentication.SetAuthCookie(UCTextBoxUser.Text, false);
                            Response.Redirect(Constantes.PORTAL_URL + "dentro/Home.aspx", true);
                        }
                    }
                    else
                    {
                        //JOSE TERMINADO; Pasamos el parametro default.aspx?logout=1, desde el menu para borrar la cookie
                        if (this.Request.QueryString["DeleteCookie"] != null)
                        {
                            if (Request.Cookies["info.usastreams"] != null)
                            {
                                HttpCookie myCookie = new HttpCookie("info.usastreams");
                                myCookie.Expires = DateTime.Now.AddDays(-2);
                                Response.Cookies.Add(myCookie);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LabelCopyright.Text = ex.Message;
            }
        }