Example #1
0
        public FanteasticFourPromo()
        {
            InitializeComponent();
            this.BackgroundImage = "background.png";
            this.Title           = "Fanteastic Four";

            //----------------------------------------------------------------------------------------------------------------------------

            PromotionQuery pq = new PromotionQuery();

            if (pq.GetNoOfProducts() < 1)
            {
                PromotionQuery newProduct = new PromotionQuery();
                PromotionDB    product5   = new PromotionDB();
                product5.Image       = "breakfast1.jpg";
                product5.Name        = "Poached Eggs on Toasted Brioche";
                product5.Description = "Served with grilled tomatoes, Mushrooms and baked beans ";
                product5.Price       = "495.00";
                product5.Date        = "4/8/216";
                newProduct.InsertDetails(product5);
            }

            listview.ItemsSource = pq.GetProductList();

            DoSomeDataAccess();
            listview.ItemTapped += async(o, e) =>
            {
                var mList = (ListView)o;
                var pro   = (mList.SelectedItem as PromotionDB);
                await Navigation.PushAsync(new Details(pro.Image, pro.Name, pro.Description, pro.Price));

                mList.SelectedItem = null; // de-select the row
            };
        }
Example #2
0
        public ActionResult PromotionList()
        {
            PromotionQuery pQuery = new PromotionQuery();

            pQuery.StartTime       = DateTime.Now;
            pQuery.EndTime         = pQuery.StartTime.AddMonths(1);
            pQuery.PromotionStatus = -1;

            ViewBag.PromotionQuery = pQuery;

            return(View());
        }
        public async Task <IHttpActionResult> Get([FromUri] PromotionQuery data)
        {
            try
            {
                var res = await _uow.Promotion.Search(data);

                return(Ok(new { data = res.Item1, total = res.Item2 }));
            }
            catch (BusinessException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                return(BadRequest(this.General_Err));
            }
        }
Example #4
0
        public PageOf <PromotionListModel> GetPromotionList(int supplierId, PromotionQuery query, PageDTO page)
        {
            var querySql = @" SELECT ROW_NUMBER() OVER(ORDER BY createtime DESC) AS RowNum,Id,PromotionName,PromotionStatus,StartTime,EndTime FROM Promotions(NOLOCK)
                            WHERE SupplierId=@SupplierId AND StartTime >=@StartTime AND StartTime <=@EndTime ";

            var db         = DbSFO2ORead;
            var parameters = db.CreateParameterCollection();

            parameters.Append("SupplierId", supplierId);
            parameters.Append("StartTime", query.StartTime);
            parameters.Append("EndTime", query.EndTime);


            if (!String.IsNullOrWhiteSpace(query.PromotionName))
            {
                querySql += " AND PromotionName LIKE @PromotionName";
                parameters.Append("PromotionName", "%" + query.PromotionName + "%");
            }

            if (query.PromotionStatus >= 0)
            {
                querySql += " AND PromotionStatus=@PromotionStatus";
                parameters.Append("PromotionStatus", query.PromotionStatus);
            }

            var sql = String.Empty;

            sql += "SELECT * FROM (" + querySql + ")a" + " WHERE a.RowNum BETWEEN (@PageIndex-1)* @PageSize+1 AND @PageIndex*@PageSize ORDER BY RowNum";
            parameters.Append("PageIndex", page.PageIndex);
            parameters.Append("PageSize", page.PageSize);

            sql += string.Format(@" SELECT COUNT(1) FROM ({0}) b;", querySql);

            DataSet ds = db.ExecuteSqlDataSet(sql, parameters);

            return(new PageOf <PromotionListModel>()
            {
                PageIndex = page.PageIndex,
                PageSize = page.PageSize,
                Total = Convert.ToInt32(ds.Tables[1].Rows[0][0]),
                RowCount = Convert.ToInt32(ds.Tables[1].Rows[0][0]),
                Items = DataMapHelper.DataSetToList <PromotionListModel>(ds)
            });
        }
Example #5
0
        public ActionResult GetPromotionList(PromotionQuery query)
        {
            var promotionList = new PageOf <PromotionListModel>();

            try
            {
                var page = new PageDTO()
                {
                    PageIndex = this.PageNo,
                    PageSize  = this.PageSize
                };

                promotionList = _bll.GetPromotionList(this.CurrentUser.SupplierID, query, page);
            }
            catch (Exception ext)
            {
                LogHelper.Error(ext);
            }

            return(View(promotionList));
        }
Example #6
0
 public PageOf <PromotionListModel> GetPromotionList(int supplierId, PromotionQuery query, PageDTO page)
 {
     return(_dal.GetPromotionList(supplierId, query, page));
 }
 public async Task <Tuple <List <PromotionSearchViewModel>, int> > Search(PromotionQuery req)
 {
     return(await(_dbContext as Model.PunnelContext).msp_Promotion_Search(req));
 }
        public PromotionsPagexaml()
        {
            InitializeComponent();
            this.BackgroundImage = "background.png";
            this.Title           = "Promotions";
            ObservableCollection <data> myList = new ObservableCollection <data>();



            //----------------------------------------------------------------------------------------------------------------------------

            PromotionQuery pq = new PromotionQuery();

            if (pq.GetNoOfProducts() < 1)
            {
                PromotionQuery newProduct = new PromotionQuery();
                PromotionDB    product    = new PromotionDB();
                product.Image       = "breakfast1.jpg";
                product.Name        = "Poached Eggs on Toasted Brioche";
                product.Description = "Breakfast01-Served with grilled tomatoes, Mushrooms and baked beans ";
                product.Price       = "4";
                product.Date        = "4/8/216";
                newProduct.InsertDetails(product);

                PromotionDB product1 = new PromotionDB();
                product1.Image       = "breakfast2.jpg";
                product1.Name        = "Breakfast02-Baked egg with chicken bacon and onion tart";
                product1.Description = "Served with grilled tomatoes, Mushrooms and baked beans ";
                product1.Price       = "5";
                product1.Date        = "4/8/216";
                newProduct.InsertDetails(product1);

                PromotionDB product2 = new PromotionDB();
                product2.Image       = "breakfast3.jpg";
                product2.Name        = "Breakfast omelette";
                product2.Description = "Breakfast03-Chicken Ham and Cheese/Cheese Mushrooms and cheese/Mushrooms/Sri Lankan style/Served with grilled tomatoes/Mushrooms and baked beans";
                product2.Price       = "5";
                product2.Date        = "4/8/216";
                newProduct.InsertDetails(product2);


                PromotionDB product3 = new PromotionDB();
                product3.Image       = "Iceimage1.jpg";
                product3.Name        = "Christmas Ice Cream";
                product3.Description = "The artisan Christmas Ice Cream is a combination of raisins, sultanas, citrus peel, candy peel, ginger preserve and fresh milk inspired by the taste and fragrance of a beloved holiday.";
                product3.Price       = "5";
                product3.Date        = "4/8/2016";
                newProduct.InsertDetails(product3);

                PromotionDB product4 = new PromotionDB();
                product4.Image       = "Iceimage2.jpg";
                product4.Name        = "Earl Grey Dark Chocolate Ice Cream";
                product4.Description = "Our Earl Grey Dark Chocolate Ice Cream finds a richly delicious cocoa blended with our strong Earl Gery tea enhanced with oil of Bergamot in a wonderfully creamy dessert.";
                product4.Price       = "5";
                product4.Date        = "4/8/2016";
                newProduct.InsertDetails(product4);
            }

            listview.ItemsSource = pq.GetProductList();

            DoSomeDataAccess();
            listview.ItemTapped += async(o, e) => {
                var mList = (ListView)o;
                var pro   = (mList.SelectedItem as PromotionDB);
                await Navigation.PushAsync(new Details(pro.Image, pro.Name, pro.Description, pro.Price));

                mList.SelectedItem = null; // de-select the row
            };
        }