Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["SHOPOWNER"] == null)
            {
                Response.Redirect("~/Web/Account/tempLogin.aspx?page=Users/Shop/ManageListings.aspx");
            }
            //Load manager
            ShopOwner owner = (ShopOwner)Session["SHOPOWNER"];

            Data.ShopData.ShopConnection connection = new Data.ShopData.ShopConnection();

            if (Request.QueryString["delId"] != null)
            {
                if (connection.deleteshop(Convert.ToInt32(Request.QueryString["delId"].ToString()), owner.Id))
                {
                    lblSuccess.Text = "Shop has been deleted successfuly";
                }
                else
                {
                    lblErrorMessage.Text = "An error occurred while deleting, shop please try again";
                }
            }

            if (Request.QueryString["delSpecialId"] != null)
            {
                if (connection.deleteSpecial(Convert.ToInt32(Request.QueryString["delSpecialId"].ToString()), owner.Id))
                {
                    lblSuccess.Text = "Special has been deleted successfuly";
                }
                else
                {
                    lblErrorMessage.Text = "An error occurred while deleting special, please try again";
                }
            }

            if (Request.QueryString["page"] != null)
            {
                if (Request.QueryString["page"].Equals("specials"))
                {
                    lblSuccess.Text = "Special has been added successfuly";
                }
            }
            //Load Shops
            List <Qaelo.Models.ShopOwnerModel.Shop> shops = connection.getAllMyShops(owner.Id);
            string html = "";

            foreach (Qaelo.Models.ShopOwnerModel.Shop shop in shops)
            {
                html += string.Format(@"<div class='col-sm-3'>
                <div class='thumbnail'>
                  <div class='w3-card-12'>
                      <figure >
                      <img src='../../../Images/Shops/{0}' class='' style='height:220px;width:100%'/>
                          <figcaption style = 'background-image: url('')'>
                               </figcaption>
                           </figure>
                    <div class='w3-container' style='margin:10px'>
                        <h6><b>{2} - <small>{3}</small></b></h6>
                        <strong>Shop No:<small>{4}</small></strong><br />
                       <strong> Open: <small>{5}</small></strong><br />
                        <strong>Call:<small>{6}</small>
                        </strong><br /><br />
                            <a href='ManageListings.aspx?delId={7}' class='btn btn-danger pull-lef'>Delete</a>
                            <a href='EditShop.aspx?editId={7}' class='btn btn-info pull-right'>Edit</a>
                    </div>
                  </div>
                </div>
            </div>", shop.Image, shop.Description, shop.Name, shop.University, shop.ShopNo, shop.TradingHours, owner.Number, shop.Id);
            }

            lblShops.Text = html;

            /**List Of Specials **/
            List <Qaelo.Models.ShopOwnerModel.ShopAds> specials = connection.getAllSpecialsByManagerId(owner.Id);
            string htmlSpecials = "";

            foreach (Qaelo.Models.ShopOwnerModel.ShopAds shop in specials)
            {
                htmlSpecials += string.Format(@"<div class='col-sm-3'>
                <div class='thumbnail'>
                  <div class='w3-card-12'>
                      <figure >
                      <img src='../../../Images/Shops/Specials/{0}' class='' style='height:220px;width:100%'/>
                          <figcaption style = 'background-image: url('')'>
                               </figcaption>
                           </figure>
                    <div class='w3-container' style='margin:10px'>
                        <h6><b>{2} - <small>{3}</small></b></h6>
                        <strong>Shop No:<small>{4}</small></strong><br />
                       <strong> Open: <small>{5}</small></strong><br />
                        <strong>Call:<small>{6}</small>
                        </strong><br /><br />
                            <a href='ManageListings.aspx?delSpecialId={7}' class='btn btn-danger pull-lef'>Delete</a>
                            <a href='EditSpecial.aspx?editId={7}' class='btn btn-info pull-right'>Edit now</a>
                    </div>
                  </div>
                </div>
            </div>", shop.Image, shop.Description, shop.Name, shop.University, shop.ShopNo, shop.TradingHours, owner.Number, shop.Id);
            }

            lblSpecials.Text = htmlSpecials;
        }
Exemplo n.º 2
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            //Load manager
            Data.ShopData.ShopConnection connection = new Data.ShopData.ShopConnection();
            //Load Shops
            List <Qaelo.Models.ShopOwnerModel.Shop> shops = connection.getAllShopsByUniversity(txtText.Text);


            string html = "";

            foreach (Qaelo.Models.ShopOwnerModel.Shop shop in shops)
            {
                html += string.Format(@"<div class='col-sm-4'>
                    <div class='thumbnail'>
                      <div class='w3-card-12'>
                          <figure class=''>
                          <img src='../../../Images/Shops/{0}' class='' style='height:220px;width:100%'/>
                              <figcaption style = 'background-image: url('')'>{1}
                                   </figcaption>
                               </figure>
                        <div class='w3-container' style='margin:10px'>
                            <h6><b>{2} - <small>{3}</small></b></h6>
                            <strong>Shop No:<small>{4}</small></strong><br />
                           <strong> Open: <small>{5}</small></strong><br />
                            <strong>Call:<small>{6}</small>
                                <a href='#shop{7}' data-toggle='modal' class='btn btn-default pull-right'>View Shop</a>
                            </strong><br />
                        </div><br />
                      </div>
                    </div>
                </div>", shop.Image, "", shop.Name, shop.University, shop.ShopNo, shop.TradingHours, connection.getShopOwner(shop.ShopOwnerId).Number, shop.Id);

                //Display Pop up

                lblSingleShops.Text += string.Format(@"<div class='modal fade' id='shop{0}' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>
        <div class='modal-dialog modal-lg'>
                        <div class='modal-content'>
                                    <div class='modal-body'>
                                        <div class='container'>
                                            <div class='col-sm-10'>
                                                <div class='col-sm-5'>
                                                    <h2>About Shop</h2>
                                                    <hr />
                                                <strong>Shop Name: </strong>{1}<br/>           
                                                <strong>University: </strong>{2}<br/><br/>                       
                                                <strong>Description:</strong><br/>{4}           

                                                </div>
                                                <div class='col-sm-5'>
                                                    <h2>Operating Info</h2>
                                                   <hr /> 
                                                <strong>Shop No: </strong>{5}<br/>       {3}    
                                                <strong>Operating Hours: </strong>{6}<br/>   <br/>         

                                                </div>
                                             </div>
                                        </div>
                                    <div class='modal-footer'>
                                        <button  class='btn btn-default pull-left' data-dismiss='modal'>Cancel</button>
                                    </div>
                                    </div>
                                </div>
                            </div>
                            </div>", shop.Id, shop.Name, shop.University, "", shop.Description.Replace(char.ConvertFromUtf32(13), "<br/>"), shop.ShopNo, shop.TradingHours);
            }

            lblShops.Text = html;
        }