public static void Run(
            [TimerTrigger("*/5 * * * * *")] TimerInfo req, ILogger log,
            [Sql("Products", ConnectionStringSetting = "SqlConnectionString")] ICollector <Product> products)
        {
            int totalUpserts = 1000;

            log.LogInformation($"{DateTime.Now} starting execution #{_executionNumber}. Rows to generate={totalUpserts}.");

            var sw = new Stopwatch();

            sw.Start();

            List <Product> newProducts = ProductUtilities.GetNewProducts(totalUpserts);

            foreach (Product product in newProducts)
            {
                products.Add(product);
            }

            sw.Stop();

            string line = $"{DateTime.Now} finished execution #{_executionNumber}. Total time to create {totalUpserts} rows={sw.ElapsedMilliseconds}.";

            log.LogInformation(line);

            _executionNumber++;
        }
Ejemplo n.º 2
0
        private void btnAddItem_Click(object sender, EventArgs e)
        {
            var item = new Item
            {
                Brand                = (BrandEnum)cbxBrands.SelectedIndex,
                Flavor               = (FlavorEnum)cbxFlavors.SelectedIndex,
                Package              = (PackageEnum)cbxPackages.SelectedIndex,
                ProductionType       = (ProductionType)cbxType.SelectedIndex,
                ProductionDetailType = (ProductionDetail)cbxProductDetail.SelectedIndex,
            };

            item.ItemCode = ProductUtilities.GetItemCodes(item);

            _controller.AddPhuraseProduct(item.ItemCode, (int)nudCount.Value, Convert.ToInt32(tbxSalePrice));


            _displayItems.Add(new OrderDisplayItem
            {
                Brand                = item.Brand,
                Flavor               = item.Flavor,
                Package              = item.Package,
                ProductionType       = item.ProductionType,
                ProductionDetailType = item.ProductionDetailType,
                ItemCode             = item.ItemCode,
                Count                = (int)nudCount.Value,
                Price                = Convert.ToInt32(tbxSalePrice),
            });

            dgvNewOrder.DataSource = _displayItems;
            dgvNewOrder.AutoResizeColumns(
                DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
        }
Ejemplo n.º 3
0
        public static IActionResult Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "addproducts-collector")]
            HttpRequest req,
            [Sql("dbo.Products", ConnectionStringSetting = "SqlConnectionString")] ICollector <Product> products)
        {
            List <Product> newProducts = ProductUtilities.GetNewProducts(5000);

            foreach (Product product in newProducts)
            {
                products.Add(product);
            }
            return(new CreatedResult($"/api/addproducts-collector", "done"));
        }
Ejemplo n.º 4
0
        //TODO: Add Quantity Dropdown to Repeater on Products

        protected void Page_Load(object sender, EventArgs e)
        {
            productUtil   = new ProductUtilities();
            userUtil      = new UserUtilities();
            cartUtilities = new CartUtilities();

            if (IsPostBack)
            {
                return;
            }


            //Displays all cakes
            rptSingleCake.DataSource = productUtil.GetTable();
            rptSingleCake.DataBind();

            ShowRemoveButton();
        }
Ejemplo n.º 5
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "addproducts-asynccollector")]
            HttpRequest req,
            [Sql("dbo.Products", ConnectionStringSetting = "SqlConnectionString")] IAsyncCollector <Product> products)
        {
            List <Product> newProducts = ProductUtilities.GetNewProducts(5000);

            foreach (Product product in newProducts)
            {
                await products.AddAsync(product);
            }
            // Rows are upserted here
            await products.FlushAsync();

            newProducts = ProductUtilities.GetNewProducts(5000);
            foreach (Product product in newProducts)
            {
                await products.AddAsync(product);
            }
            return(new CreatedResult($"/api/addproducts-collector", "done"));
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            orderUtilities   = new OrderUtilities();
            productUtilities = new ProductUtilities();
            userUtilities    = new UserUtilities();

            if (!IsPostBack)
            {
                ddUserList.DataSource = orderUtilities.GetAllUserID();
                ddUserList.DataBind();
            }

            //GridView1.Visible = true;

            if (!(userUtilities.IsLoggedIn() && userUtilities.GetUserRole() == "Admin"))
            {
                Response.Redirect("Default.aspx");
            }

            //Bind(3);
        }
Ejemplo n.º 7
0
        //TODO: Link Category Buttons together

        protected void Page_Load(object sender, EventArgs e)
        {
            cartUtilities    = new CartUtilities();
            productUtilities = new ProductUtilities();
            userUtilities    = new UserUtilities();

            if (IsPostBack)
            {
                return;
            }

            lblTotalPrice.Text = (string)Session["CurrentFormat"] + Convert.ToString(cartUtilities.GetTotal());

            var test = new Dictionary <string, int>();

            foreach (var item in cartUtilities.GetCart())
            {
                var tmp = productUtilities.GetName(item.Key);
                test[tmp] = item.Value;
            }
            Bind();
        }
Ejemplo n.º 8
0
        public static void Run(
            [QueueTrigger("testqueue")] string queueMessage, ILogger log,
            [Sql("[dbo].[Products]", ConnectionStringSetting = "SqlConnectionString")] ICollector <Product> products)
        {
            int totalUpserts = 100;

            log.LogInformation($"[QueueTrigger]: {DateTime.Now} starting execution {queueMessage}. Rows to generate={totalUpserts}.");

            var sw = new Stopwatch();

            sw.Start();

            List <Product> newProducts = ProductUtilities.GetNewProducts(totalUpserts);

            foreach (Product product in newProducts)
            {
                products.Add(product);
            }

            string line = $"[QueueTrigger]: {DateTime.Now} finished execution {queueMessage}. Total time to create {totalUpserts} rows={sw.ElapsedMilliseconds}.";

            log.LogInformation(line);
        }
        public static IActionResult Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "addproducts-nopartialupsert")]
            HttpRequest req,
            [Sql("dbo.ProductsNameNotNull", ConnectionStringSetting = "SqlConnectionString")] ICollector <Product> products)
        {
            List <Product> newProducts = ProductUtilities.GetNewProducts(UpsertBatchSize);

            foreach (Product product in newProducts)
            {
                products.Add(product);
            }

            var invalidProduct = new Product
            {
                Name      = null,
                ProductID = UpsertBatchSize,
                Cost      = 100
            };

            products.Add(invalidProduct);

            return(new CreatedResult($"/api/addproducts-nopartialupsert", "done"));
        }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Create the instance of ProductUtilities class
            productUtil = new ProductUtilities();
            //Create the instance of CartUtilities class
            cartUtil = new CartUtilities();
            //Create the instance of UserUtilities class
            userUtil = new UserUtilities();

            lblCart.Text = Convert.ToString(cartUtil.GetItemCount());
            if (cartUtil.GetItemCount() == 1)
            {
                lblCart.Text = "1 Item";
            }
            else if (cartUtil.GetItemCount() > 1)
            {
                lblCart.Text = cartUtil.GetItemCount() + " Items";
            }

            if (userUtil.IsLoggedIn())
            {
                LogIn();
            }
        }