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; } }
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> " + 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; } } }
protected void loginClick(object sender, EventArgs e) { lbllogin.Text = ""; UserContent Ucontent = new UserContent(); var user = Ucontent.GetbyUsername(tbloginname.Text); if (user != null) { if (user.password == tbloginpassword.Text) { if (user.active == true) { lblusername.Text = "Welcome " + user.username; tblogin.Visible = false; Panellogin.Visible = true; tbloginname.Text = ""; Session["alamaat_User"] = user; //billing interface BillInterface bill = new BillInterface(); bill.Billemail = user.email; bill.Billfirstname = user.firstname; bill.Billlastname = user.lastname; bill.Billcompany = user.companyname; bill.BillAddress = user.address; bill.BillCity = user.city; bill.BillPostalcode = user.postalcode; bill.BillProvince = user.province; bill.BillCountry = user.country; bill.BillPhone = user.phone; bill.BillMobilephone = user.mobilephone; bill.Billfax = user.fax; Session["Billing"] = bill; //Shipping interface ShipInterface ship = new ShipInterface(); ship.Shipemail = user.email; ship.Shipfirstname = user.firstname; ship.Shiplastname = user.lastname; ship.ShipAddress = user.address; ship.ShipCity = user.city; ship.ShipPostalcode = user.postalcode; ship.ShipProvince = user.province; ship.ShipCountry = user.country; ship.ShipPhone = user.phone; ship.ShipMobilephone = user.mobilephone; ship.Shipfax = user.fax; Session["Shipping"] = ship; loginInfor.Text = user.email + "<br/>Mr " + user.firstname + " " + user.lastname + "<br/>" + user.address + "<br/>" + user.city + ", " + user.province + "<br/>" + user.country + "<br/>" + user.postalcode + "<br/>" + user.phone; //lblshipaddress.Text = user.email + "<br/>Mr " + user.firstname + " " + user.lastname + "<br/>" + user.city + "<br/>" + user.postalcode + ", " + user.province + "<br/>" + user.country + "<br/>" + user.phone; } else { lbllogin.Text = "User account is invalid."; return; } } else { lbllogin.Text = "Username or password is incorrect."; return; } } else { lbllogin.Text = "Username or password is incorrect."; return; } }