예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.TreeView1.Load += TreeView1_Load;
            dbAccess             = new blAccess();

            String strUrl = HttpContext.Current.Request.Url.AbsoluteUri.Replace(HttpContext.Current.Request.Url.PathAndQuery, "/");

            DAL_Library.User connectedUser = Session["ConnectedUser"] as DAL_Library.User;


            if (Session["ConnectedUser"] == null)
            {
                MenuLoader.loadMenu(Menu1, strUrl, UserType.NONE);
            }
            else if (connectedUser.Right == dbAccess.getRight("Admin").Id)
            {
                MenuLoader.loadMenu(Menu1, strUrl, UserType.ADMIN);
            }
            else if (connectedUser.Status == dbAccess.getStatus("Active").Id)
            {
                MenuLoader.loadMenu(Menu1, strUrl, UserType.READER);
            }
            else
            {
                MenuLoader.loadMenu(Menu1, strUrl, UserType.NONE);
            }
        }
예제 #2
0
        void Wizard1_NextStep(object sender, WizardNavigationEventArgs e)
        {
            DAL_Library.User newUser = null;

            //Creation d'un nouveau user dans la session(temporaire)
            if (Session["CUser"] != null)
            {
                newUser = (DAL_Library.User)Session["CUser"];
            }
            else
            {
                Session["CUser"] = new User();
            }

            //3 different etats du Wizard
            if (e.CurrentStepIndex == 0)
            {
                if (Session["CUser.Type"] == null)
                {
                    Session["CUser.Type"] = RadioButtonList1.SelectedValue;
                }
            }
            else if (e.CurrentStepIndex == 1)
            {
                if (TextBoxPassword.Text.Equals(TextBoxPasswordConfirm.Text))
                {
                    newUser.Password = TextBoxPassword.Text;
                }
                newUser.UserName    = TextBoxUsername.Text;
                newUser.MailAddress = TextBoxMail.Text;
            }
            else if (e.CurrentStepIndex == 2 && e.NextStepIndex == 2)
            {
                file = FileUpload1.FileContent;

                if (!Session["CUser.Type"].Equals(String.Empty) &&
                    !newUser.UserName.Equals(String.Empty) &&
                    !newUser.Password.Equals(String.Empty) &&
                    !newUser.MailAddress.Equals(String.Empty) &&
                    file != null)
                {
                    MemoryStream memStream = new MemoryStream();
                    file.CopyTo(memStream);
                    Binary fileRep = new Binary(memStream.ToArray());
                    newUser.File = fileRep;

                    newUser.Right1  = dbAccess.getRight((String)Session["CUser.Type"]);
                    newUser.Status1 = dbAccess.getStatus("Pending");
                    dbAccess.addJournalist(newUser);
                    Session["CUser.Type"] = null;
                    Session["CUser"]      = null;

                    Response.Redirect(strUrl + "default.aspx");
                }
            }
        }