protected void logout_Click(object sender, EventArgs e) { if (AuthRequire.CheckIfUserLoggedIn()) { AuthRequire.Logout(); } }
protected void Page_Load(object sender, EventArgs e) { if (!AuthRequire.CheckIfUserLoggedIn()) { AuthRequire.Logout(); Response.Redirect("/CustomerLogin"); return; } if (Request.Params["business"] == null) { Response.Redirect("~/BDBusinesses.aspx"); return; } Service1Client client = new Service1Client(); Business bo = client.GetSingleBusinessByBusinessId(Request.Params["business"].Trim()); if (bo == null) { Response.Redirect("~/BDBusinesses.aspx"); return; } tb_businessName.Text = bo.Name; tb_businessRegNum.Text = bo.RegistrationNumber; tb_businessType.Text = bo.Type; tb_businessUrl.Text = bo.Url; }
protected void Page_Load(object sender, EventArgs e) { if (!AuthRequire.CheckIfUserLoggedIn()) { Response.Redirect("~/CustomerLogin"); AuthRequire.Logout(); return; } }
protected void UpdateDelete_Click(object sender, EventArgs e) { Service1Client client = new Service1Client(); CustomerClass cust = client.SelectOneCustomer(Session["ae"].ToString()); if (cust != null) { client.UpdateCustomerStatus(cust.ID, cust.Email, "deleteStatus", true); AuthRequire.Logout(); } }
protected void Page_Load(object sender, EventArgs e) { if (!AuthRequire.CheckIfUserLoggedIn()) { AuthRequire.Logout(); Response.Redirect("/CustomerLogin"); return; } if (!IsPostBack) { RefreshGridView(); } }
protected void Page_Load(object sender, EventArgs e) { if (!AuthRequire.CheckIfUserLoggedIn()) { AuthRequire.Logout(); Response.Redirect("/CustomerLogin"); return; } ServiceReference1.IService1 client = new ServiceReference1.Service1Client(); List <BusinessEmployeeAccess> invites = client.GetAllInvitationsByUserId(Session["userId"].ToString()).ToList(); lv_invitations.DataSource = invites; lv_invitations.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!AuthRequire.CheckIfUserLoggedIn()) { AuthRequire.Logout(); Response.Redirect("/CustomerLogin"); return; } Service1Client client = new ServiceReference1.Service1Client(); BusinessUser bu = client.GetBusinessUserByUserId(Session["userId"].ToString()); tb_name.Text = bu.Name; tb_email.Text = bu.Email; tb_phone.Text = bu.Phone; }
protected void Page_Load(object sender, EventArgs e) { if (AuthRequire.CheckIfUserLoggedIn() && AuthRequire.RetrieveUserRole() == "Admin") { } else { if (AuthRequire.RetrieveUserRole() == "Customer") { Response.Redirect("~/CustomerProfile"); } else if (AuthRequire.RetrieveUserRole() == "Business") { Response.Redirect("~/BusinessProfile"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!AuthRequire.CheckIfUserLoggedIn()) { AuthRequire.Logout(); Response.Redirect("/CustomerLogin"); return; } if (Request.Params["business"] != null) { ServiceReference1.IService1 client = new ServiceReference1.Service1Client(); client.DeleteBusiness(Request.Params["business"].Trim()); } Response.Redirect("~/BDBusinesses.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (!AuthRequire.CheckIfUserLoggedIn()) { AuthRequire.Logout(); Response.Redirect("~/CustomerLogin"); return; } Service1Client client = new Service1Client(); lv_businesses.DataSource = client.GetAllBusinessByUserId(Session["userId"].ToString()); lv_businesses.DataBind(); lv_sharedBusinesses.DataSource = client.GetAcceptedBusinessInviteByUserId(Session["userId"].ToString()); lv_sharedBusinesses.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!AuthRequire.CheckIfUserLoggedIn()) { AuthRequire.Logout(); Response.Redirect("~/CustomerLogin"); return; } try { businessId = Guid.Parse(Request.Params["business"]); } catch (Exception ex) { Response.Redirect("/business/my-businesses"); } hl_branch.NavigateUrl = "/business/branches?business=" + businessId.ToString(); }
protected void UpdatePassword_Click(object sender, EventArgs e) { Service1Client client = new Service1Client(); String oldPassword = (String)tbOldPassword.Text.Trim(); String password = (String)tbPassword.Text.Trim(); String cfmPassword = (String)tbPasswordCfm.Text.Trim(); Boolean resultValidation = PasswordValidation(oldPassword, password, cfmPassword); if (resultValidation) { lbOldPasswordError.Visible = false; lbPasswordError.Visible = false; lbCfmPasswordError.Visible = false; CustomerClass cust = client.SelectOneCustomer(Session["ae"].ToString()); if (cust != null) { client.UpdateCustomerPassword(cust.ID, cust.Email, password); AuthRequire.Logout(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!AuthRequire.CheckIfUserLoggedIn()) { AuthRequire.Logout(); Response.Redirect("/CustomerLogin"); return; } if (Request.Params["business"] != null) { string businessId = Request.Params["business"].Trim(); Service1Client client = new ServiceReference1.Service1Client(); Business business = client.GetSingleBusinessByBusinessId(businessId); if (business == null) { Response.Redirect("~/BDBusinesses.aspx"); return; } // business name lbl_businessName.Text = business.Name; // bind the data from wcf List <BusinessEmployeeAccess> employees = client.GetAllEmployeeByBusinessId(businessId).ToList(); if (employees.Count == 0) { lbl_feedback.Text = "You currently don't have any employees, add one?"; return; } lv_employees.DataSource = client.GetAllEmployeeByBusinessId(businessId); lv_employees.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!AuthRequire.CheckIfUserLoggedIn()) { AuthRequire.Logout(); Response.Redirect("/CustomerLogin"); return; } Guid beaId, businessId; BusinessEmployeeAccess bea = null; try { beaId = Guid.Parse(Request.Params["id"]); ServiceReference1.IService1 client = new ServiceReference1.Service1Client(); bea = client.GetOneEmployeeAccess(beaId.ToString()); client.DeleteEmployeeAccess(bea.UserId, bea.BusinessId); } catch (Exception ex) { Console.WriteLine(ex.ToString() + "\n" + ex.Message); // log? } finally { if (bea != null) { Response.Redirect("~/business/employees?business=" + bea.BusinessId); } else { Response.Redirect("~/business/employees?business"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (AuthRequire.CheckIfUserLoggedIn()) { Service1Client client = new Service1Client(); CustomerClass cust = client.SelectOneCustomer(Session["ae"].ToString()); if (cust != null) { tbFirstName.Text = cust.FirstName; tbLastName.Text = cust.LastName; tbEmail.Text = cust.Email; tbPhoneNumber.Text = cust.PhoneNumber; tbBirthDate.Text = cust.DateOfBirth.ToString("yyyy-MM-dd"); } } else { Response.Redirect("~/CustomerLogin"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!AuthRequire.CheckIfUserLoggedIn()) { AuthRequire.Logout(); Response.Redirect("/CustomerLogin"); return; } if (string.IsNullOrEmpty(Request.Params["business"])) { Response.Redirect("/business/my-businesses"); } try { Guid businessId = Guid.Parse(Request.Params["business"]); LoadBusinessBranches(businessId); } catch (Exception ex) { Console.WriteLine("Error in BDBranches.aspx Page_Load " + ex + " message: " + ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (!AuthRequire.CheckIfUserLoggedIn()) { AuthRequire.Logout(); Response.Redirect("/CustomerLogin"); return; } try { businessId = Guid.Parse(Request.Params["business"]); } catch (Exception ex) { Response.Redirect("/business/my-businesses"); } Service1Client client = new Service1Client(); lv_roles.DataSource = client.GetBusinessRoles(businessId.ToString()); lv_roles.DataBind(); lv_roles.Visible = true; }
protected void Page_Load(object sender, EventArgs e) { AuthRequire.Logout(); Response.Redirect("~/CustomerLogin"); }
protected void submit_Click(object sender, EventArgs e) { String username = (String)tbUsername.Text.Trim().ToLower(); String password = (String)tbPassword.Text.Trim(); String role = (String)Submit_Role_Value.Text.Trim(); Service1Client client = new Service1Client(); if (role == "0") { CustomerClass cust = client.VerifyCustomer(username); if (cust.ID != Guid.Empty) { if (client.VerifyPassword(cust.Email, password, "Customer")) { Boolean setSession = true; if (cust.blackListed) { List <BlackListClass> resultOne = client.SelectAllBlacklist(username).ToList(); for (int i = 0; i < resultOne.Count; i++) { if (resultOne[i].Deleted == false) { Int16 rtmpesult = client.UpdateBlacklistDeleted(resultOne[i].ID, resultOne[i].CustomerID, true); if (rtmpesult == -4) { divErrorMsg.Visible = true; lbErrorMsg.Text = "You have been blacklisted. Reason: " + HttpUtility.HtmlEncode(resultOne[i].Reason); setSession = false; } else if (rtmpesult > 0) { client.UpdateCustomerStatus(cust.ID, cust.Email, "blackListedStatus", false); } else if (rtmpesult != 1) { setSession = false; } } } } if (!cust.emailVerified) { divErrorMsg.Visible = true; lbErrorMsg.Text = "You have changed your email, please verify before proceeding"; setSession = false; } if (cust.delete) { Int16 resultOne = client.DeleteCustomer(cust.ID, cust.Email, cust.deleteDate.AddDays(30)); if (resultOne != 1) { Int16 rtmpesult = client.UpdateCustomerStatus(cust.ID, cust.Email, "deleteStatus", false); if (rtmpesult != 1) { setSession = false; } } } if (setSession) { Boolean result = AuthRequire.SetUserSession(cust.ID, cust.Email, "Customer"); if (result == true) { Response.Redirect("~/CustomerProfile"); } } } else { divErrorMsg.Visible = true; lbErrorMsg.Text = "Invalid email or password"; } } else { Response.Redirect("~/CustomerRegistration"); } } else if (role == "1") { BusinessUser business = client.GetBusinessUserByEmail(username); if (business != null) { if (client.VerifyPassword(business.Email, password, "Business")) { Boolean setSession = true; if (business.blackListed) { List <BlackListClass> resultOne = client.SelectAllBlacklist(username).ToList(); for (int i = 0; i < resultOne.Count; i++) { if (resultOne[i].Deleted == false) { Int16 rtmpesult = client.UpdateBlacklistDeleted(resultOne[i].ID, resultOne[i].CustomerID, true); if (rtmpesult == -4) { divErrorMsg.Visible = true; lbErrorMsg.Text = "You have been blacklisted. Reason: " + HttpUtility.HtmlEncode(resultOne[i].Reason); setSession = false; } else if (rtmpesult > 0) { client.UpdateBusinessStatus(business.Email, "blackListedStatus", false); } else if (rtmpesult != 1) { setSession = false; } } } } if (!business.emailVerified) { divErrorMsg.Visible = true; lbErrorMsg.Text = "You have changed your email, please verify before proceeding"; setSession = false; } if (business.delete) { Int16 resultOne = client.DeleteBusinessUser(business.Email, business.deleteDate.AddDays(30)); if (resultOne != 1) { Int16 rtmpesult = client.UpdateBusinessStatus(business.Email, "deleteStatus", false); if (rtmpesult != 1) { setSession = false; } } } if (setSession) { Boolean result = AuthRequire.SetUserSession(Guid.Parse(business.Id), business.Email, "Customer"); if (result == true) { Response.Redirect("/BDHome.aspx", false); } } } else { divErrorMsg.Visible = true; lbErrorMsg.Text = "Invalid email or password"; } } } else if (role == "2") { AdminClass admin = client.SelectOneAdmin(username); if (admin != null) { if (client.VerifyPassword(admin.UserName, password, "Admin")) { Boolean result = AuthRequire.SetUserSession(admin.ID, admin.UserName, "Admin"); if (result == true) { Response.Redirect("~/AdminHome"); } } else { divErrorMsg.Visible = true; lbErrorMsg.Text = "Invalid email or password"; } } } else { } }
protected void Page_Load(object sender, EventArgs e) { if (AuthRequire.CheckIfUserLoggedIn() && AuthRequire.RetrieveUserRole() == "Customer") { } }