示例#1
0
        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
        private void SaveProductsToDatabase(IEnumerable <Models.Product> products)
        {
            var shopConnection = new ShopConnection();

            foreach (var product in products)
            {
                shopConnection.UpdateProduct(product.Name, Convert.ToDecimal(product.Price), product.Currency, product.Stock);
            }
        }
示例#3
0
        // GET: Home
        public ActionResult Index(int?page, string name = null)
        {
            var products = new ShopConnection().GetProducts().AsQueryable();

            if (!string.IsNullOrEmpty(name))
            {
                products = products.Where(a => a.Name != null && a.Name.ToLower().Contains(name.ToLower()));
            }

            return(View(products.OrderBy(x => x.Name).ToList().ToPagedList(page ?? 1, 20)));
        }
示例#4
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["SHOPOWNER"] == null)
            {
                Response.Redirect("~/Web/Account/tempLogin.aspx?page=Users/Shop/ManageListings.aspx");
            }

            if (!IsPostBack)
            {
                ShopConnection connection = new ShopConnection();
                Qaelo.Models.ShopOwnerModel.ShopOwner owner = (Qaelo.Models.ShopOwnerModel.ShopOwner)Session["SHOPOWNER"];

                //Load the shops
                txtEmail.Text    = owner.Email;
                txtFullname.Text = owner.FullName;
                txtNumber.Text   = owner.Number;
            }
        }
示例#6
0
        protected void btnFinish_Click(object sender, EventArgs e)
        {
            ShopOwner owner        = (ShopOwner)Session["SHOPOWNER"];
            bool      uploadStatus = true;
            string    filename1    = "";
            int       shopId       = Convert.ToInt32(Request.QueryString["editId"]);

            //Check if the files have something
            if (fu1.HasFile)
            {
                try
                {
                    filename1 = Path.GetFileName(fu1.FileName);
                    fu1.SaveAs(Server.MapPath("~/Images/Shops/") + filename1);
                }
                catch (Exception ex)
                {
                    lblErrorMessage.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
                    uploadStatus         = false;
                }
            }
            else
            {
                filename1 = new ShopConnection().getShopById(shopId).Image;
            }

            if (uploadStatus)
            {
                //Upload shop
                if (new ShopConnection().updateShop(new Models.ShopOwnerModel.Shop(shopId, owner.Id, "", txtDescription.Text, filename1, txtShopName.Text, txtOpenHours.Text, Convert.ToInt32(txtShoNo.Text), txtText.Text), owner.Id))
                {
                    lblSuccess.Text = "You have successfully Edit " + txtShopName.Text + " a Special";
                    Response.Redirect("ManageListings.aspx");
                }
                else
                {
                    lblErrorMessage.Text = "Sorry an error occured while listing your Special, please try again";
                }
            }
            else
            {
                lblErrorMessage.Text = "Sorry an error occured while listing your Special, please upload image again";
            }
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["editId"] == null)
            {
                Response.Redirect("ManageListings.aspx");
            }

            //Poplate all fields
            int     Id      = Convert.ToInt32(Request.QueryString["editId"].ToString());
            ShopAds special = new ShopConnection().getSpecialsById(Id);

            txtDescription.Text = special.Description;
            txtName.Text        = special.Name;
            txtOpenHours.Text   = special.TradingHours;
            txtPrice.Text       = special.Campus; //using campus field as price field
            txtShoNo.Text       = special.ShopNo.ToString();
            txtShopName.Text    = special.Name;   //chnage this to shop name
            txtText.Text        = special.University;
            file = special.Image;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["ADMIN"] == null)
            {
                Response.Redirect("~/Web/Account/tempLogin.aspx?");
            }

            #region Shop Owner

            ShopConnection shopConnection = new ShopConnection();
            //Check if Shopowner is to be confirmed
            if (Request.QueryString["ShopId"] != null)
            {
                int id = Convert.ToInt32(Request.QueryString["ShopId"]);
                //Confirm user

                /***ADMIN ***/
                if (shopConnection.unVerifyShopowner(id))
                {
                    lblSuccess.Text      = "You have successfully Deactivated the Account";
                    lblErrorMessage.Text = "";
                }
                else
                {
                    lblSuccess.Text      = "";
                    lblErrorMessage.Text = "Could not Deactivate Account, please try again";
                }
            }
            List <Qaelo.Models.ShopOwnerModel.ShopOwner> shops = shopConnection.getAllShopOwners();

            foreach (Qaelo.Models.ShopOwnerModel.ShopOwner item in shops)
            {
                if (item.Verified)
                {
                    lblShopOwner.Text += string.Format(@"<tr>
                                                <td>{0}</td>
                                                <td>{1}</td>
                                                <td>{2}</td>
                                                <td>{3}</td>
                                                <td><a href='unConfirmAccount.aspx?ShopId={4}' class='btn btn-danger'>Deactivate</a></td>", item.FullName, item.Email, item.Number, General.getDateString(item.RegistrationDate), item.Id);
                }
            }
            #endregion

            #region Posters
            Data.EventsData.EventConnection posterConnection = new Data.EventsData.EventConnection();

            //Check if eventPoster is to be confirmed
            if (Request.QueryString["posterId"] != null)
            {
                int id = Convert.ToInt32(Request.QueryString["posterId"]);
                //Confirm user

                /***ADMIN ***/
                if (posterConnection.unverify(id))
                {
                    lblSuccess.Text      = "You have successfully Deactivated the Account";
                    lblErrorMessage.Text = "";
                }
                else
                {
                    lblSuccess.Text      = "";
                    lblErrorMessage.Text = "Could not Deactivate Account, please try again";
                }
            }
            List <Qaelo.Models.EventPosterModel.EventPoster> posters = posterConnection.getAllPosters();

            foreach (Qaelo.Models.EventPosterModel.EventPoster item in posters)
            {
                if (item.Verified)
                {
                    lblEventPoster.Text += string.Format(@"<tr>
                                                <td>{0}</td>
                                                <td>{1}</td>
                                                <td>{2}</td>
                                                <td>{3}</td>
                                                <td><a href='unConfirmAccount.aspx?posterId={4}' class='btn btn-danger'>Deactivate</a></td>", item.FullName, item.Email, item.Number, General.getDateString(item.RegistrationDate), item.Id);
                }
            }
            #endregion

            #region Property Owner
            Data.AccommodationData.ManagerConnection managerConnection = new Data.AccommodationData.ManagerConnection();

            //Check if eventPoster is to be confirmed
            if (Request.QueryString["managerId"] != null)
            {
                int id = Convert.ToInt32(Request.QueryString["managerId"]);
                //Confirm user

                /***ADMIN ***/
                if (managerConnection.unverify(id))
                {
                    lblSuccess.Text      = "You have successfully Deactivate the Account";
                    lblErrorMessage.Text = "";
                }
                else
                {
                    lblSuccess.Text      = "";
                    lblErrorMessage.Text = "Could not Deactivate Account, please try again";
                }
            }
            List <Qaelo.Models.AccommodationModel.Manager> managers = managerConnection.getAllManagers();

            foreach (Qaelo.Models.AccommodationModel.Manager item in managers)
            {
                if (item.verified)
                {
                    lblManagers.Text += string.Format(@"<tr>
                                                <td>{0}</td>
                                                <td>{1}</td>
                                                <td>{2}</td>
                                                <td>{3}</td>
                                                <td><a href='unConfirmAccount.aspx?managerId={4}' class='btn btn-danger'>Deactivate</a></td>", item.firstName + item.lastName, item.email, item.number, General.getDateString(item.registrationDate), item.id);
                }
            }
            #endregion

            #region Societies
            Data.SocietyData.SocietyConnection societyConnection = new Data.SocietyData.SocietyConnection();

            //Check if eventPoster is to be confirmed
            if (Request.QueryString["societyId"] != null)
            {
                int id = Convert.ToInt32(Request.QueryString["societyId"]);
                //Confirm user

                /***ADMIN ***/
                if (societyConnection.unverify(id))
                {
                    lblSuccess.Text      = "You have successfully Deactivated the Account";
                    lblErrorMessage.Text = "";
                }
                else
                {
                    lblSuccess.Text      = "";
                    lblErrorMessage.Text = "Could not Deactivate Account, please try again";
                }
            }
            List <Qaelo.Models.SocietyModel.Society> societies = societyConnection.getAllSocieties();

            foreach (Qaelo.Models.SocietyModel.Society item in societies)
            {
                if (item.Verified)
                {
                    lblSocieties.Text += string.Format(@"<tr>
                                                <td>{0}</td>
                                                <td>{1}</td>
                                                <td>{2}</td>
                                                <td>{3}</td>
                                                <td><a href='unConfirmAccount.aspx?societyId={4}' class='btn btn-danger'>Deactivate</a></td>", item.Name, item.Email, item.Number, General.getDateString(item.RegistrationDate), item.Id);
                }
            }
            #endregion
        }
示例#9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["ADMIN"] == null)
            {
                Response.Redirect("~/Web/Account/tempLogin.aspx?");
            }

            //Remove users from the system
            if (Request.QueryString["student"] != null)
            {
                new StudentConnection().deleteStudent(Convert.ToInt32(Request.QueryString["student"]));
            }
            else if (Request.QueryString["shop"] != null)
            {
                new ShopConnection().deleteShoProfile(Convert.ToInt32(Request.QueryString["shop"]));
            }
            else if (Request.QueryString["accommodation"] != null)
            {
                new ManagerConnection().deletedManager(Convert.ToInt32(Request.QueryString["accommodation"]));
            }
            else if (Request.QueryString["society"] != null)
            {
                new SocietyConnection().deleteProfile(Convert.ToInt32(Request.QueryString["society"]));
            }
            else if (Request.QueryString["event"] != null)
            {
                new EventConnection().deleteEventPoster(Convert.ToInt32(Request.QueryString["event"]));
            }

            /** Students **/

            List <Qaelo.Models.StudentModel.Student> students = new StudentConnection().getAllStudents();

            lblNumOfStudents.Text = students.Count.ToString();
            //Load students
            foreach (Qaelo.Models.StudentModel.Student item in students)
            {
                if (item != null)
                {
                    lblStudents.Text += string.Format(@"<tr>
                                                    <td>{0}</td>
                                                    <td>{1}</td>
                                                    <td>{2}</td>
                                                    <td>{3}</td>
                                                    <td>{4}</td>
                                                    <td><a href='ListOfUsers.aspx?student={5}' class='btn btn-danger'>Remove</a></td>
                                                    ", item.FirstName + " " + item.LastName, item.Email, item.Number, item.Institution, General.getDateString(item.RegistrationDate), item.Id);
                }
            }

            /** Shop Owners **/

            List <Qaelo.Models.ShopOwnerModel.ShopOwner> shops = new ShopConnection().getAllShopOwners();

            lblNumOfShopOwner.Text = shops.Count.ToString();

            foreach (Qaelo.Models.ShopOwnerModel.ShopOwner item in shops)
            {
                if (item == null)
                {
                    lblShops.Text += string.Format(@"<tr>
                                                    <td>{0}</td>
                                                    <td>{1}</td>
                                                    <td>{2}</td>
                                                    <td>{3}</td>
                                                    <td><a href='ListOfUsers.aspx?shop={4}' class='btn btn-danger'>Remove</a></td>
                                                    ", item.FullName, item.Email, item.Number, General.getDateString(item.RegistrationDate), item.Id);
                }
            }

            /**Event Posters **/
            List <Qaelo.Models.EventPosterModel.EventPoster> posters = new EventConnection().getAllPosters();

            lblNumOfEventPosters.Text = posters.Count.ToString();

            foreach (Qaelo.Models.EventPosterModel.EventPoster item in posters)
            {
                if (item != null)
                {
                    lblEventPosters.Text += string.Format(@"<tr>
                                                    <td>{0}</td>
                                                    <td>{1}</td>
                                                    <td>{2}</td>
                                                    <td>{3}</td>
                                                    <td><a href='ListOfUsers.aspx?event={4}' class='btn btn-danger'>Remove</a></td>
                                                    ", item.FullName, item.Email, item.Number, General.getDateString(item.RegistrationDate), item.Id);
                }
            }

            /*** Porperty Owner **/
            List <Qaelo.Models.AccommodationModel.Manager> managers = new ManagerConnection().getAllManagers();

            lblNumOfPorpertyOwners.Text = managers.Count.ToString();



            foreach (Qaelo.Models.AccommodationModel.Manager item in managers)
            {
                if (item != null)
                {
                    lblAccommodations.Text += string.Format(@"<tr>
                                                    <td>{0}</td>
                                                    <td>{1}</td>
                                                    <td>{2}</td>
                                                    <td>{3}</td>
                                                    <td><a href='ListOfUsers.aspx?accommodation={4}' class='btn btn-danger'>Remove</a></td>
                                                     ", item.firstName + " " + item.lastName, item.email, item.number, General.getDateString(item.registrationDate), item.id);
                }
            }
        }