protected void btnSave_Click(object sender, EventArgs e)
    {
        AppUserLogic appl = new AppUserLogic();
        AppUser      s    = new AppUser();

        s.Name           = txtName.Text;
        s.Address        = txtAddress.Text;
        s.Phone          = Convert.ToInt32(txtPhone.Text);
        s.Email          = txtEmail.Text;
        s.City           = txtCity.Text;
        s.Country        = txtCountry.Text;
        s.RegisteredDate = DateTime.Now;
        s.Username       = txtUsername.Text;
        s.Password       = txtPassword.Text;


        if (photoupload.HasFile)
        {
            string rpath = "profilepic/" + DateTime.Now.Ticks.ToString() + "_" + photoupload.FileName;//Server.MapPath("images") + "/";
            photoupload.SaveAs(Server.MapPath(rpath));
            s.PhotoPath = rpath;
        }
        else
        {
            s.PhotoPath = "";
        }

        appl.Insert(s);

        Response.Redirect("ViewRegistration.aspx");
    }
Пример #2
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        AppUserLogic al = new AppUserLogic();

        if (txtusername.Text == "" && txtpassword.Text == "")
        {
            lblerror.Text = "Please Enter Username and Password";
        }

        else if (txtusername.Text != "" && txtpassword.Text == "")
        {
            lblerror.Text = "Please Enter Password";
        }

        else if (txtusername.Text == "" && txtpassword.Text != "")
        {
            lblerror.Text = "Please Enter Username";
        }

        else if (al.IsValid(txtusername.Text, txtpassword.Text))
        {
            Session["Username"] = txtusername.Text;

            Response.Redirect("Home.aspx");
        }
        else
        {
            lblerror.Text = "Username and Password not matching";
        }
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AppUserLogic appl = new AppUserLogic();
        DataTable    dt   = appl.SelectAll();

        Repeater1.DataSource = dt;
        Repeater1.DataBind();
    }
Пример #4
0
        public static bool CanLogin(string login, byte[] password)
        {
            AppUserLogic userlogic = new AppUserLogic();
            AppRoleLogic rolelogic = new AppRoleLogic();
            var          user      = userlogic.Get(login);
            var          invader   = new AppUserDTO(login, password);

            if (user.Password.SequenceEqual(invader.Password))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #5
0
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        int          id   = Convert.ToInt32(e.CommandArgument);
        AppUserLogic appl = new AppUserLogic();
        AppUser      s    = appl.SelectByID(id);

        lblRegName.Text     = s.Name;
        lblRegAddress.Text  = s.Address;
        lblRegCity.Text     = s.City;
        lblRegCountry.Text  = s.Country;
        lblRegEmail.Text    = s.Email;
        lblRegPhone.Text    = s.Phone.ToString();
        lblRegUsername.Text = s.Username;
        //lblRegPass.Text = s.Password;
        Image1.ImageUrl = s.PhotoPath;
    }