コード例 #1
0
ファイル: Home.aspx.cs プロジェクト: ThabangSirrve/Qaelo
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["SHOPOWNER"] == null)
            {
                Response.Redirect("~/Web/Account/tempLogin.aspx?page=Users/Shop/Home.aspx");
            }

            if (Request.QueryString["page"] == "editprofile")
            {
                lblSuccess.Text = "Successfully updated your profile";
            }

            ShopConnection connection = new ShopConnection();

            Qaelo.Models.ShopOwnerModel.ShopOwner owner = (Qaelo.Models.ShopOwnerModel.ShopOwner)Session["SHOPOWNER"];

            //Load all the id's of the students who liked an event
            string html = "";

            //Load all the Students


            //Get all shops by owner
            List <Qaelo.Models.ShopOwnerModel.Shop> shops = connection.getAllMyShops(owner.Id);

            foreach (Qaelo.Models.ShopOwnerModel.Shop shop in shops)
            {
                List <int> userIds = connection.getAllLikedUsers(shop.Id, owner.Id);

                html += string.Format(@"<h4 align='center'><a href='ManageListings.aspx'>List of users who Joined shop No:{0} specials </a></h3>
                                <table class='table responsive table-striped table-bordered' cellspacing='0' width='100%'>
                               <thead>
                              <tr>
                                <th>Profile</th>
                                <th>Name</th>
                                <th>Email</th>
                                <th>Number</th>
                              </tr>
                            </thead><tbody>", shop.ShopNo);
                foreach (int userId in userIds)
                {
                    Qaelo.Models.StudentModel.Student s = new Data.Accounts.AccountConnection().getStudent(userId);
                    html += string.Format(@"
                                            <tr>
                                            <td><img src='../../../Images/Users/Students/{0}' class='img-thumbnail' width='50' height='50' /></td>
                                            <td>{1}</td>
                                            <td>{2}</td>
                                            <td>{3}</td>
                                          </tr>", s.ProfileImage, s.FirstName + " " + s.LastName, s.Email, s.Number);
                }


                html += "</tbody></table><br/>";
            }

            //if (html == "") html = "<div class='alert alert-info'><h3>I'ts Empty here, Data will soon be available as soon as your posts get interaction</div></h3>";

            lblListOfUsers.Text = html;
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["PROPERTYMANAGER"] == null)
            {
                Response.Redirect("~/Web/Account/tempLogin.aspx");
            }

            AccommodationConnection connection = new AccommodationConnection();

            Qaelo.Models.AccommodationModel.Manager manager = (Qaelo.Models.AccommodationModel.Manager)Session["PROPERTYMANAGER"];
            if (!manager.verified)
            {
                lblVerified.Text = "<div class='alert alert-danger'><h3>Your profile and Posts  Will only be public once your account has been verified by Admin</div></h3>";
            }

            //Load all the id's of the students who liked an event
            string html = "";

            //Get all rooms by manager
            List <Qaelo.Models.AccommodationModel.Accommodation> rooms = connection.getAllMyRooms(manager.id);

            foreach (Qaelo.Models.AccommodationModel.Accommodation room in rooms)
            {
                List <int> userIds = connection.getAllJoinedUsers(room.id, manager.id);

                html += string.Format(@"<h3 align='center'><a href='landlord-my-rooms.aspx'>List of users who Joined R{0} {1} room </a></h3>
                                <table class='table responsive table-striped table-bordered' cellspacing='0' width='100%'>
                               <thead>
                              <tr>
                                <th>Profile</th>
                                <th>Name</th>
                                <th>Email</th>
                                <th>Number</th>
                              </tr>
                            </thead><tbody>", room.price, room.arrangement);

                foreach (int userId in userIds)
                {
                    Qaelo.Models.StudentModel.Student s = new Data.Accounts.AccountConnection().getStudent(userId);
                    html += string.Format(@"
                                            <tr>
                                            <td><img src='../../../Images/Users/Students/{0}' class='img-thumbnail' width='50' height='50' /></td>
                                            <td>{1}</td>
                                            <td>{2}</td>
                                            <td>{3}</td>
                                          </tr>", s.ProfileImage, s.FirstName + " " + s.LastName, s.Email, s.Number);
                }

                html += "</tbody></table><br/>";
            }

            //if (html == "") html = "<div class='alert alert-info'><h3>I'ts Empty here, Data will soon be available as soon as your rooms get interaction</div></h3>";

            lblListOfUsers.Text = html;
        }
コード例 #3
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            Data.Accounts.AccountConnection connection = new Data.Accounts.AccountConnection();
            //Check if user Exist
            if (!connection.isValidUser(txtEmail.Text))
            {
                //User doesnot exist
                lblErrorMessage.Text = "Email does not exist";
                lblSuccess.Text      = "";
                return;
            }
            //Encrypt
            string encrypt = new CryptoService().HashText(txtEmail.Text, DateTime.Now.ToShortDateString());

            //Encode the encrypted string
            string encoded = Server.UrlEncode(Server.HtmlEncode(encrypt));

            //Check whether its an unconfirmed account
            bool isUserUnconfirmed = connection.unconfirmedAccount(txtEmail.Text);

            isUserUnconfirmed = connection.unconfirmedAccountCompany(txtEmail.Text);
            isUserUnconfirmed = connection.unconfirmedAccountEventPoster(txtEmail.Text);
            isUserUnconfirmed = connection.unconfirmedAccountPropertyManager(txtEmail.Text);
            isUserUnconfirmed = connection.unconfirmedAccountShopOwner(txtEmail.Text);
            isUserUnconfirmed = connection.unconfirmedAccountSociety(txtEmail.Text);

            if (isUserUnconfirmed)
            {
                //Cannot reset your Password , you must confirm your account first
                lblErrorMessage.Text = "Sorry user Does not exist, Please confirm your account";
                lblSuccess.Text      = "";
                return;
            }

            if (connection.sendForgotPasswordLink(txtEmail.Text, encrypt))
            {
                sendRegistrationEmail(txtEmail.Text, encoded);
                lblSuccess.Text      = "Successfully Sent password recovery options to " + txtEmail.Text;
                lblErrorMessage.Text = "";
            }
            else
            {
                lblErrorMessage.Text = "Could not send email, Please try again later";
                lblSuccess.Text      = "";
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["COMPANY"] == null)
            {
                Response.Redirect("~/Web/Account/tempLogin.aspx");
            }
            string            html       = "";
            CompanyConnection connection = new CompanyConnection();

            Qaelo.Models.CompanyModel.Company    company = (Qaelo.Models.CompanyModel.Company)Session["COMPANY"];
            List <Qaelo.Models.CompanyModel.Job> jobs    = connection.getAllPostByCompanyId(company.Id);

            foreach (Qaelo.Models.CompanyModel.Job item in jobs)
            {
                List <int> userIds = connection.getAllLikedUsers(item.Id, company.Id);

                html += string.Format(@"<h3 align='center'><a href='landlord-my-rooms.aspx'>List of users who like:{0} Post</a></h3>
                                <table class='table responsive table-striped table-bordered' cellspacing='0' width='100%'>
                               <thead>
                              <tr>
                                <th>Profile</th>
                                <th>Name</th>
                                <th>Email</th>
                                <th>Number</th>
                              </tr>
                            </thead><tbody>", item.Title);
                foreach (int userId in userIds)
                {
                    Qaelo.Models.StudentModel.Student s = new Data.Accounts.AccountConnection().getStudent(userId);
                    html += string.Format(@"
                                            <tr>
                                            <td><img src='../../../Images/Users/Students/{0}' class='img-thumbnail' width='50' height='50' /></td>
                                            <td>{1}</td>
                                            <td>{2}</td>
                                            <td>{3}</td>
                                          </tr>", s.ProfileImage, s.FirstName + " " + s.LastName, s.Email, s.Number);
                }

                html += "</tbody></table><br/>";
            }

            //if (html == "") html = "<div class='alert alert-info'><h3>I'ts Empty here, Data will soon be available as soon as your posts get interaction</div></h3>";

            lblListOfUsers.Text = html;
        }
コード例 #5
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            if (txtEmail.Text == "" || txtFirstName.Text == "" || txtPassword.Text == "")
            {
                lblErrorMessage.Text = "All Felds are required";
                return;
            }
            if (ddlUser.SelectedItem.Value == "Student")
            {
                if (txtLastName.Text == "")
                {
                    lblErrorMessage.Text = "Last Name is required";
                    return;
                }
                //Check if the user exist
                if (new Data.Accounts.AccountConnection().validStudent(txtEmail.Text) && new Data.Accounts.AccountConnection().validEventPoster(txtEmail.Text) && new Data.Accounts.AccountConnection().validShopOwner(txtEmail.Text) && new Data.Accounts.AccountConnection().validCompany(txtEmail.Text) && new Data.Accounts.AccountConnection().validSociety(txtEmail.Text) && new Data.Accounts.AccountConnection().validPropertyManager(txtEmail.Text) && new Data.Accounts.AccountConnection().validStudent(txtEmail.Text))
                {
                    new Data.Accounts.AccountConnection().registerStudent(new Models.StudentModel.Student("", "", txtEmail.Text, txtFirstName.Text, "", txtLastName.Text, "", Secrecy.HashPassword(txtPassword.Text), "defaultProfilePic.jpg", "", DateTime.Now, "Student", ""));

                    //Get student Id
                    int studentId = new Data.Accounts.AccountConnection().getStudentId(txtEmail.Text);

                    //Add freelancing account
                    new Data.StudentData.StudentConnection().postWork(new Models.StudentModel.Freelancer(studentId, "", ";;;", "", ";;;"));
                    //Encrypt
                    string encrypt = new CryptoService().HashText(txtEmail.Text, DateTime.Now.ToShortDateString());

                    //Encode the encrypted string
                    string encoded = Server.UrlEncode(Server.HtmlEncode(encrypt));

                    //Save
                    new Data.Accounts.AccountConnection().studentCreation(txtEmail.Text, encrypt);

                    //Send Email
                    if (sendRegistrationEmailTest(txtEmail.Text, txtFirstName.Text, encoded))
                    {
                        Response.Redirect("tempLogin.aspx?page=registration");//Redrect the user
                    }
                }
                else
                {
                    lblErrorMessage.Text = "Email Already Exists";
                }
            }
            else if (ddlUser.SelectedItem.Value == "Shop")
            {
                if (txtLastName.Text == "")
                {
                    lblErrorMessage.Text = "Last Name is required";
                    return;
                }
                if (new Data.Accounts.AccountConnection().validStudent(txtEmail.Text) && new Data.Accounts.AccountConnection().validEventPoster(txtEmail.Text) && new Data.Accounts.AccountConnection().validShopOwner(txtEmail.Text) && new Data.Accounts.AccountConnection().validCompany(txtEmail.Text) && new Data.Accounts.AccountConnection().validSociety(txtEmail.Text) && new Data.Accounts.AccountConnection().validPropertyManager(txtEmail.Text) && new Data.Accounts.AccountConnection().validStudent(txtEmail.Text))
                {
                    new Data.Accounts.AccountConnection().registerShopOwner(new Models.ShopOwnerModel.ShopOwner(txtEmail.Text, (txtFirstName.Text + txtLastName.Text), "", Secrecy.HashPassword(txtPassword.Text), DateTime.Now, "ShopOwner", true));

                    //Encrypt
                    string encrypt = new CryptoService().HashText(txtEmail.Text, DateTime.Now.ToShortDateString());

                    //Encode the encrypted string
                    string encoded = Server.UrlEncode(Server.HtmlEncode(encrypt));

                    //Save
                    new Data.Accounts.AccountConnection().ShopOwnerCreation(txtEmail.Text, encrypt);

                    //Send Email
                    if (sendRegistrationEmail(txtEmail.Text, txtPassword.Text, encoded))
                    {
                        Response.Redirect("tempLogin.aspx?page=registration");//Redrect the user
                    }
                }
                else
                {
                    lblErrorMessage.Text = "Email Already Exists";
                }
            }
            else if (ddlUser.SelectedItem.Value == "Event")
            {
                if (txtLastName.Text == "")
                {
                    lblErrorMessage.Text = "Last Name is required";
                    return;
                }
                if (new Data.Accounts.AccountConnection().validStudent(txtEmail.Text) && new Data.Accounts.AccountConnection().validEventPoster(txtEmail.Text) && new Data.Accounts.AccountConnection().validShopOwner(txtEmail.Text) && new Data.Accounts.AccountConnection().validCompany(txtEmail.Text) && new Data.Accounts.AccountConnection().validSociety(txtEmail.Text) && new Data.Accounts.AccountConnection().validPropertyManager(txtEmail.Text) && new Data.Accounts.AccountConnection().validStudent(txtEmail.Text))
                {
                    new Data.Accounts.AccountConnection().registerEventPoster(new Models.EventPosterModel.EventPoster(txtEmail.Text, (txtFirstName.Text + txtLastName.Text), "", Secrecy.HashPassword(txtPassword.Text), "defaultProfilePic.jpg", DateTime.Now, "EventPoster", true));

                    //Encrypt
                    string encrypt = new CryptoService().HashText(txtEmail.Text, DateTime.Now.ToShortDateString());

                    //Encode the encrypted string
                    string encoded = Server.UrlEncode(Server.HtmlEncode(encrypt));

                    //Save
                    new Data.Accounts.AccountConnection().EventPosterCreation(txtEmail.Text, encrypt);

                    //Send Email
                    if (sendRegistrationEmail(txtEmail.Text, txtPassword.Text, encoded))
                    {
                        Response.Redirect("tempLogin.aspx?page=registration");//Redrect the user
                    }
                }
                else
                {
                    lblErrorMessage.Text = "Email Already Exists";
                }
            }
            else if (ddlUser.SelectedItem.Value == "Society")
            {
                if (new Data.Accounts.AccountConnection().validStudent(txtEmail.Text) && new Data.Accounts.AccountConnection().validEventPoster(txtEmail.Text) && new Data.Accounts.AccountConnection().validShopOwner(txtEmail.Text) && new Data.Accounts.AccountConnection().validCompany(txtEmail.Text) && new Data.Accounts.AccountConnection().validSociety(txtEmail.Text) && new Data.Accounts.AccountConnection().validPropertyManager(txtEmail.Text) && new Data.Accounts.AccountConnection().validStudent(txtEmail.Text))
                {
                    new Data.Accounts.AccountConnection().registerSociety(new Models.SocietyModel.Society("", "", txtEmail.Text, "", "", "", txtFirstName.Text, "", Secrecy.HashPassword(txtPassword.Text), "defaultProfilePic.jpg", DateTime.Now, "", "", "", "", true));

                    //Encrypt
                    string encrypt = new CryptoService().HashText(txtEmail.Text, DateTime.Now.ToShortDateString());

                    //Encode the encrypted string
                    string encoded = Server.UrlEncode(Server.HtmlEncode(encrypt));

                    //Save
                    new Data.Accounts.AccountConnection().SocietyCreation(txtEmail.Text, encrypt);

                    //Send Email
                    if (sendRegistrationEmail(txtEmail.Text, txtPassword.Text, encoded))
                    {
                        Response.Redirect("tempLogin.aspx?page=registration");//Redrect the user
                    }
                }
                else
                {
                    lblErrorMessage.Text = "Email Already Exists";
                }
            }
            else if (ddlUser.SelectedItem.Value == "Company")
            {
                if (new Data.Accounts.AccountConnection().validStudent(txtEmail.Text) && new Data.Accounts.AccountConnection().validEventPoster(txtEmail.Text) && new Data.Accounts.AccountConnection().validShopOwner(txtEmail.Text) && new Data.Accounts.AccountConnection().validCompany(txtEmail.Text) && new Data.Accounts.AccountConnection().validSociety(txtEmail.Text) && new Data.Accounts.AccountConnection().validPropertyManager(txtEmail.Text) && new Data.Accounts.AccountConnection().validStudent(txtEmail.Text))
                {
                    new Data.Accounts.AccountConnection().registerCompany(new Models.CompanyModel.Company("", "", txtEmail.Text, "", txtFirstName.Text, "", Secrecy.HashPassword(txtPassword.Text), "defaultProfilePic.jpg", DateTime.Now, "Company", true));

                    //Encrypt
                    string encrypt = new CryptoService().HashText(txtEmail.Text, DateTime.Now.ToShortDateString());

                    //Encode the encrypted string
                    string encoded = Server.UrlEncode(Server.HtmlEncode(encrypt));

                    //Save
                    new Data.Accounts.AccountConnection().CompanyCreation(txtEmail.Text, encrypt);

                    //Send Email
                    if (sendRegistrationEmail(txtEmail.Text, txtPassword.Text, encoded))
                    {
                        Response.Redirect("tempLogin.aspx?page=registration");//Redrect the user
                    }
                }
                else
                {
                    lblErrorMessage.Text = "Email Already Exists";
                }
            }
            else if (ddlUser.SelectedItem.Value == "Property")
            {
                if (txtLastName.Text == "")
                {
                    lblErrorMessage.Text = "Last Name is required";
                    return;
                }
                if (new Data.Accounts.AccountConnection().validStudent(txtEmail.Text) && new Data.Accounts.AccountConnection().validEventPoster(txtEmail.Text) && new Data.Accounts.AccountConnection().validShopOwner(txtEmail.Text) && new Data.Accounts.AccountConnection().validCompany(txtEmail.Text) && new Data.Accounts.AccountConnection().validSociety(txtEmail.Text) && new Data.Accounts.AccountConnection().validPropertyManager(txtEmail.Text) && new Data.Accounts.AccountConnection().validStudent(txtEmail.Text))
                {
                    new Data.Accounts.AccountConnection().registerPropertyManager(new Models.AccommodationModel.Manager(false, "", txtEmail.Text, "", txtFirstName.Text, txtLastName.Text, "", Secrecy.HashPassword(txtPassword.Text), "defaultProfilePic.jpg", "", DateTime.Now, "PropertyManager", true));

                    //Encrypt
                    string encrypt = new CryptoService().HashText(txtEmail.Text, DateTime.Now.ToShortDateString());

                    //Encode the encrypted string
                    string encoded = Server.UrlEncode(Server.HtmlEncode(encrypt));

                    //Save
                    new Data.Accounts.AccountConnection().PropertyManagerCreation(txtEmail.Text, encrypt);

                    //Send Email
                    if (sendRegistrationEmail(txtEmail.Text, txtPassword.Text, encoded))
                    {
                        Response.Redirect("tempLogin.aspx?page=registration");//Redrect the user
                    }
                }
                else
                {
                    lblErrorMessage.Text = "Email Already Exists";
                }
            }
            else
            {
                if (ddlUser.SelectedItem.Value == "NONE")
                {
                    lblErrorMessage.Text = "Please select Account type";
                    return;
                }
            }
        }