Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         alamaat_User user = (alamaat_User)Session["alamaat_User"];
         if (user != null)
         {
             UserName.Text       = user.username; UserName.Enabled = false;
             tbfirstname.Text    = user.firstname;
             tblastname.Text     = user.lastname;
             tbmiddlename.Text   = user.middlename;
             Email.Text          = user.email;
             tbaddress.Text      = user.address;
             tbcity.Text         = user.city;
             tbpCode.Text        = user.postalcode;
             tbcountry.Text      = user.country;
             tbprovince.Text     = user.province;
             tbphone.Text        = user.phone;
             tbMobilephone.Text  = user.mobilephone;
             tbfax.Text          = user.fax;
             btnregister.Visible = false;
             btnupdate.Visible   = true;
         }
     }
 }
Пример #2
0
    protected void UpdateClick(object sender, EventArgs e)
    {
        alamaat_User user = (alamaat_User)Session["alamaat_user"];

        if (user != null)
        {
            user.firstname  = tbfirstname.Text;
            user.middlename = tbmiddlename.Text;
            user.lastname   = tblastname.Text;
            //user.UserName = UserName.Text;
            user.password    = Password.Text;
            user.email       = Email.Text;
            user.address     = tbaddress.Text;
            user.city        = tbcity.Text;
            user.province    = tbprovince.Text;
            user.country     = tbcountry.Text;
            user.postalcode  = tbpCode.Text;
            user.phone       = tbphone.Text;
            user.mobilephone = tbMobilephone.Text;
            user.fax         = tbfax.Text;
            // user. = tbbirth.Text;
            UserContent ucontent = new UserContent();
            if (ucontent.UpdateUser(user))
            {
                lbloutput.Text = "Profile updated successfully.";
            }
        }
    }
Пример #3
0
    protected void LoginClick(object sender, EventArgs e)
    {
        lblError.Text = string.Empty;
        UserContent  ucontent = new UserContent();
        alamaat_User user     = ucontent.GetbyUsername(UserName.Text);

        if (user != null)
        {
            if (user.password == Password.Text)
            {
                Session["alamaat_User"] = user;
                Response.Redirect("~/registration.aspx");
            }
            else
            {
                lblError.Text = "Username or Password is incorrect.";
                return;
            }
        }
        else
        {
            lblError.Text = "Username or Password is incorrect.";
            return;
        }
    }
Пример #4
0
    protected void SaveClick(object sender, EventArgs e)
    {
        lblError.Text = ""; lbloutput.Text = "";
        UserContent   uContent = new UserContent();
        UserInterface user     = new UserInterface();
        alamaat_User  _user    = uContent.GetbyUsername(UserName.Text);

        if (null != _user)
        {
            lblError.Text = "Username is not available.";
            UserName.Focus();
            return;
        }
        alamaat_User useremail = uContent.GetuserByEmail(Email.Text);

        if (null != useremail)
        {
            lblError.Text = "A user is already registered with this email address. Please try another email address.";
            Email.Focus();
            return;
        }
        user.ID          = Guid.NewGuid();
        user.FirstName   = tbfirstname.Text;
        user.MiddleName  = tbmiddlename.Text;
        user.LastName    = tblastname.Text;
        user.UserName    = UserName.Text;
        user.Password    = Password.Text;
        user.Email       = Email.Text;
        user.Address     = tbaddress.Text;
        user.City        = tbcity.Text;
        user.Province    = tbprovince.Text;
        user.Country     = tbcountry.Text;
        user.PCode       = tbpCode.Text;
        user.Phone       = tbphone.Text;
        user.MobilePhone = tbMobilephone.Text;
        user.Fax         = tbfax.Text;
        user.BirthDate   = tbbirth.Text;
        if (uContent.InsertUser(user))
        {
            regpanel.Visible  = false;
            lbloutput.Visible = true;
            string emailcontent = "Hello " + user.UserName + ","
                                  + "<br/><br/><b>Username:</b>&nbsp;&nbsp;&nbsp;" + user.UserName
                                  + "<br/><br/>Thank you for registering at Alamaat. Your account is created and must be activated before you can use it."
                                  + "<br/>To activate the account click on the following link or copy-paste it in your browser:"
                                  + "<br/>www.alamaat.biz/activation.aspx?id=" + user.ID
                                  + "<br/>After activation you may login to http://www.alamaat.biz/ using the following username and the password you entered during registration:";
            if (SendEmail(user.Email, "Alamaat Account Details for " + user.UserName, emailcontent))
            {
                lbloutput.Text = "An email has been sent to you to activate your account.";
                return;
            }
            else
            {
                lbloutput.Text = "Failed to send activation email. please contact admin at [email protected] or (+92)-333-5113213211.";
                return;
            }
        }
    }
Пример #5
0
    public alamaat_User GetuserById(string id)
    {
        alamaat_User user = objMyLq.alamaat_Users.Where(ku => ku.id.Equals(id)).FirstOrDefault();

        if (user != null)
        {
            return(user);
        }
        else
        {
            return(null);
        }
    }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string id  = Request.QueryString["id"];
        string sid = Request.QueryString["sid"];

        if (id != null)
        {
            UserContent  usercontent = new UserContent();
            alamaat_User currentuser = usercontent.GetuserById(id);
            if (currentuser != null)
            {
                if (currentuser.block == false)
                {
                    currentuser.active = true;
                    if (usercontent.UpdateUser(currentuser))
                    {
                        lblactivation.Text = "You have successfully activated your account.";
                    }
                }
                else
                {
                    lblactivation.Text = "User account is already activated.";
                }
            }
        }
        else if (sid != null)
        {
            SubscriberContent  usercontent = new SubscriberContent();
            alamaat_subscriber user        = usercontent.Getuserbyid(sid);
            if (user != null)
            {
                if (user.active == false)
                {
                    user.active = true;
                    if (usercontent.UpdateSubscriber(user))
                    {
                        lblactivation.Text = "You have successfully verified your email.";
                    }
                }
                else
                {
                    lblactivation.Text = "Email is already verified.";
                }
            }
        }
        else
        {
            Response.Redirect("~/Default.aspx");
        }
    }
Пример #7
0
    public UserInterface GetuserById(Guid id)
    {
        alamaat_User user = objMyLq.alamaat_Users.Where(ku => ku.id.Equals(id)).FirstOrDefault();

        if (user != null)
        {
            UserInterface finduser = new UserInterface();
            finduser.FirstName   = user.firstname;
            finduser.LastName    = user.lastname;
            finduser.CompanyName = user.companyname;
            finduser.Email       = user.email;

            return(finduser);
        }
        else
        {
            return(null);
        }
    }
Пример #8
0
    public alamaat_User GetbyUsername(string name)
    {
        alamaat_User user = objMyLq.alamaat_Users.Where(ku => ku.username.Equals(name)).FirstOrDefault();

        //if (user != null)
        //{
        //    UserInterface finduser = new UserInterface();

        //    finduser.ID = user.User_ID;
        //    finduser.Firstname = user.FirstName;
        //    finduser.LastName = user.LastName;
        //    finduser.CompanyID = user.CompanyID;
        //    finduser.Rights = user.UserRights;
        //    finduser.Email = user.Email;
        //    finduser.ManufactuerType = user.ManufactuerType;
        //    finduser.ManufacturerAdmin = Convert.ToBoolean(user.ManufacturerAdmin);
        //    return finduser;
        //}
        //else
        return(user);
    }
Пример #9
0
 public bool UpdateUser(alamaat_User user)
 {
     using (objMyLq = new alamaatDBDataContext())
     {
         try
         {
             var objcontent = objMyLq.alamaat_Users.Single(p => p.id == user.id);
             if (null != objcontent)
             {
                 objcontent.active     = true;
                 objcontent.activation = DateTime.Now;
                 objMyLq.SubmitChanges();
                 return(true);
             }
             return(false);
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }
Пример #10
0
 public bool InsertUser(UserInterface user)
 {
     using (objMyLq = new alamaatDBDataContext())
     {
         try
         {
             alamaat_User objNewcontent = new alamaat_User();
             objNewcontent.id           = user.ID;
             objNewcontent.title        = user.Title;
             objNewcontent.firstname    = user.FirstName;
             objNewcontent.lastname     = user.LastName;
             objNewcontent.username     = user.UserName;
             objNewcontent.password     = user.Password;
             objNewcontent.middlename   = user.MiddleName;
             objNewcontent.email        = user.Email;
             objNewcontent.registerDate = DateTime.Now;
             objNewcontent.block        = false;
             objNewcontent.active       = false;
             objNewcontent.address      = user.Address;
             objNewcontent.city         = user.City;
             objNewcontent.province     = user.Province;
             objNewcontent.country      = user.Country;
             objNewcontent.postalcode   = user.PCode;
             objNewcontent.phone        = user.Phone;
             objNewcontent.mobilephone  = user.MobilePhone;
             objNewcontent.fax          = user.Fax;
             objMyLq.alamaat_Users.InsertOnSubmit(objNewcontent);
             objMyLq.SubmitChanges();
             return(true);
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }