public void AddOrder(String ccode, String cname, String pname, String qty)
        {
            //Select Customer
            SearchCustomer.Click();
            Thread.Sleep(3000);
            SearchCode.SendKeys(ccode);
            SearchName.SendKeys(cname);
            RunSearch.Click();
            Thread.Sleep(3000);
            SelectCustomer.Click();
            Thread.Sleep(5000);

            //Select Product
            SearchProduct.Click();
            Thread.Sleep(3000);
            SearchPName.SendKeys(pname);
            RunPSearch.Click();
            Thread.Sleep(3000);
            SelectProduct.Click();
            Thread.Sleep(3000);

            //Finish the follow flow
            AddQty.SendKeys(qty);
            AddBtn.Click();
            Thread.Sleep(3000);
            CompleteBtn.Click();
        }
Exemplo n.º 2
0
 public void Delete(Guid id)
 {
     using (var connection = context.CreateConnection())
     {
         connection.Execute(SelectProduct.Delete(id));
     }
 }
Exemplo n.º 3
0
 public Product GetById(Guid id)
 {
     using (var connection = context.CreateConnection())
     {
         return(connection.Query <Product>(SelectProduct.ById(id)).SingleOrDefault());
     }
 }
Exemplo n.º 4
0
 public IEnumerable <Product> Get()
 {
     using (var connection = context.CreateConnection())
     {
         return(connection.Query <Product>(SelectProduct.All()));
     }
 }
Exemplo n.º 5
0
        public void SelectAllProductsDto()
        {
            using (IDbConnection dbConnection = new SqliteConnectionFactory().Create())
            {
                var product1 = new ProductDto {
                    Name = "Product #1"
                };
                dbConnection.Execute(new InsertProduct().Query(product1));

                var product2 = new ProductDto {
                    Name = "Product #2"
                };
                dbConnection.Execute(new InsertProduct().Query(product2));

                var product3 = new ProductDto {
                    Name = "Product #3"
                };
                dbConnection.Execute(new InsertProduct().Query(product3));

                QueryObject all = new SelectProduct().All();

                IEnumerable <ProductDto> productDtos = dbConnection.Query <ProductDto>(all);

                Assert.AreEqual(3, productDtos.Count());
            }
        }
Exemplo n.º 6
0
 public Product GetByKey(string key)
 {
     using (var connection = context.CreateConnection())
     {
         return(connection.Query <Product>(SelectProduct.ByKey(key)).SingleOrDefault());
     }
 }
        public void ShouldHaveErrorWhenProductNameIsNotCorrect()
        {
            var model  = new SelectProduct("IncorrectProductName");
            var result = _validator.TestValidate(model);

            Assert.True(result.ShouldHaveValidationErrorFor(product => product.ProductName).Any());
        }
        public void ShouldHaveErrorWhenProductNameIsNull()
        {
            var model  = new SelectProduct(null);
            var result = _validator.TestValidate(model);

            result.ShouldHaveValidationErrorFor(product => product.ProductName);
        }
Exemplo n.º 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ProductSet = new DataSet();
         #region Populating Product List
         try
         {
             connection.Open();
             SqlCommand     command = new SqlCommand("Select DISTINCT tbl_ProductMaster.* From tbl_ProductMaster INNER JOIN tblStock_Detail ON tbl_ProductMaster.ProductID = tblStock_Detail.ProductID Where  tbl_ProductMaster.Status = 1", connection);
             DataSet        ds      = new DataSet();
             SqlDataAdapter sA      = new SqlDataAdapter(command);
             sA.Fill(ds);
             ProductSet = ds;
             ds.Tables[0].Columns.Add("ProductInfo", typeof(string), "Product_Name+ ' '+itemStrength+' '+itemPackSize+' '+itemForm");
             SelectProduct.DataSource     = ds.Tables[0];
             SelectProduct.DataTextField  = "ProductInfo";
             SelectProduct.DataValueField = "ProductID";
             SelectProduct.DataBind();
             if (SelectProduct != null)
             {
                 SelectProduct.Items.Insert(0, "Select Product");
                 SelectProduct.SelectedIndex = 0;
             }
         }
         catch (Exception ex)
         {
         }
         finally
         {
             connection.Close();
         }
         #endregion
     }
 }
Exemplo n.º 10
0
 public Product Update(Product product)
 {
     using (var connection = context.CreateConnection())
     {
         connection.Execute(SelectProduct.Update(product));
         return(product);
     }
 }
        public void ShouldNotHaveErrorWhenProductNameIsCorrect()
        {
            var model  = new SelectProduct(nameof(Product.ChickenSoup));
            var result = _validator.TestValidate(model);

            result.ShouldNotHaveValidationErrorFor(product => product.ProductName);
            Assert.False(result.Errors.Any());
        }
        public void MakeSelectionTest2()
        {
            VendingMachine machine = new VendingMachine();
            SelectProduct  test    = new SelectProduct();

            test.MakeSelection("B3", 10.00, machine.VendingDictionary["B3"], 0.00);

            Assert.AreEqual(1.50, test.TotalSale);
        }
        public void VendingMachineTestQuantity()
        {
            VendingMachine dictionary = new VendingMachine();

            Assert.AreEqual(5, dictionary.VendingDictionary["A1"].Quantity);

            SelectProduct test = new SelectProduct();

            test.MakeSelection("B3", 10.00, dictionary.VendingDictionary["B3"], 0.00);

            Assert.AreEqual(4, dictionary.VendingDictionary["B3"].Quantity);
        }
Exemplo n.º 14
0
        public Product Create(Product product)
        {
            if (product.Id == Guid.Empty)
            {
                product.Id = Guid.NewGuid();
            }

            using (var connection = context.CreateConnection())
            {
                connection.Execute(SelectProduct.Insert(product));
                return(product);
            }
        }
        public void FindProduct()
        {
            IJavaScriptExecutor js = Properties.driver as IJavaScriptExecutor; // Javascript'e etki edecek referans.

            js.ExecuteScript("window.scrollBy(0,500)");                        // Kaydırma çubuğu Y ekseninde 1300 birim aşağı hareket eder.
            SelectProduct.Click();                                             // İlgili ürüne tıklanır.
            System.Threading.Thread.Sleep(4000);                               // İçerik aktif olana kadar bekler.
            js.ExecuteScript("window.scrollBy(0,200)");                        // Kaydırma çubuğu Y ekseninde 1300 birim aşağı hareket eder.
            Ask.Click();                                                       // Mağazaya soru sor butonuna tıklanır ve otomatik olarak kaydırma çubuğu aşağı iner.
            System.Threading.Thread.Sleep(2000);                               // İçerik aktif olana kadar bekler.
            AskSeller.Click();                                                 // Tekrardan mağazaya soru sor butonuna tıklanır.
            System.Threading.Thread.Sleep(2000);                               // İçerik aktif olana kadar bekler.
        }
Exemplo n.º 16
0
        public void SelectProductDtoById()
        {
            using (IDbConnection dbConnection = new SqliteConnectionFactory().Create())
            {
                var product1 = new ProductDto {Name = "Product #1"};
                dbConnection.Execute(new InsertProduct().Query(product1));

                QueryObject byId = new SelectProduct().ById(1);
                ProductDto productDto = dbConnection.Query<ProductDto>(byId).SingleOrDefault();

                Assert.AreEqual(1, productDto.Id);
                Assert.AreEqual("Product #1", productDto.Name);
            }
        }
Exemplo n.º 17
0
        public void SelectProductDtoById()
        {
            using (IDbConnection dbConnection = new SqliteConnectionFactory().Create())
            {
                var product1 = new ProductDto {
                    Name = "Product #1"
                };
                dbConnection.Execute(new InsertProduct().Query(product1));

                QueryObject byId       = new SelectProduct().ById(1);
                ProductDto  productDto = dbConnection.Query <ProductDto>(byId).SingleOrDefault();

                Assert.AreEqual(1, productDto.Id);
                Assert.AreEqual("Product #1", productDto.Name);
            }
        }
Exemplo n.º 18
0
        public void UpdateProductName()
        {
            using (IDbConnection dbConnection = new SqliteConnectionFactory().Create())
            {
                var insertProduct = new InsertProduct();
                var product = new ProductDto {Name = "Product Name"};
                product.Id = (int) dbConnection.Query<Int64>(insertProduct.Query(product)).Single();

                var updateProduct = new UpdateProduct();
                dbConnection.Execute(updateProduct.NameForAllProducts("new name"));

                var selectProduct = new SelectProduct();
                ProductDto result = dbConnection.Query<ProductDto>(selectProduct.ById(product.Id)).Single();

                StringAssert.AreEqualIgnoringCase("new name", result.Name);
            }
        }
        //Sp_FillPO_Details
        public void PopulateDropDown(String Text)
        {
            #region Populating Product Name Dropdown

            try
            {
                connection.Open();

                Text = Text + "%";
                SqlCommand     command = new SqlCommand("SELECT Distinct * From tbl_ProductMaster INNER JOIN tblStock_Detail ON tbl_ProductMaster.ProductID = tblStock_Detail.ProductID Where tbl_ProductMaster.Product_Name LIKE '" + Text + "' AND tbl_ProductMaster.Status = 1", connection);
                DataSet        ds      = new DataSet();
                SqlDataAdapter sA      = new SqlDataAdapter(command);
                sA.Fill(ds);
                if (ds.Tables[0].Rows.Count.Equals(0))
                {
                    WebMessageBoxUtil.Show("There is no stock for the selected product");
                }
                if (SelectProduct.DataSource != null)
                {
                    SelectProduct.DataSource = null;
                }

                ProductSet = null;
                ProductSet = ds;
                //ds.Tables[0].Columns.Add("ProductInfo", typeof(string), "Product_Name+ ' '+itemStrength+' '+itemPackSize+' '+itemForm");

                SelectProduct.DataSource     = ds.Tables[0];
                SelectProduct.DataTextField  = "Description";
                SelectProduct.DataValueField = "ProductID";
                SelectProduct.DataBind();
                if (SelectProduct != null)
                {
                    SelectProduct.Items.Insert(0, "Select Product");
                    SelectProduct.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                connection.Close();
            }
            #endregion
        }
Exemplo n.º 20
0
        public void UpdateProductName()
        {
            using (IDbConnection dbConnection = new SqliteConnectionFactory().Create())
            {
                var insertProduct = new InsertProduct();
                var product       = new ProductDto {
                    Name = "Product Name"
                };
                product.Id = (int)dbConnection.Query <Int64>(insertProduct.Query(product)).Single();

                var updateProduct = new UpdateProduct();
                dbConnection.Execute(updateProduct.NameForAllProducts("new name"));

                var        selectProduct = new SelectProduct();
                ProductDto result        = dbConnection.Query <ProductDto>(selectProduct.ById(product.Id)).Single();

                StringAssert.AreEqualIgnoringCase("new name", result.Name);
            }
        }
Exemplo n.º 21
0
        public void PopulateDropDown(String Text)
        {
            #region Populating Product Name Dropdown

            try
            {
                connection.Open();

                Text = Text + "%";
                SqlCommand     command = new SqlCommand("SELECT * From tbl_ProductMaster Where tbl_ProductMaster.Product_Name LIKE '" + Text + "' AND Status = 1", connection);
                DataSet        ds      = new DataSet();
                SqlDataAdapter sA      = new SqlDataAdapter(command);
                sA.Fill(ds);
                if (SelectProduct.DataSource != null)
                {
                    SelectProduct.DataSource = null;
                }

                ProductSet = null;
                ProductSet = ds;

                StockDisplayGrid.DataSource = ds;
                StockDisplayGrid.DataBind();

                SelectProduct.DataSource     = ds.Tables[0];
                SelectProduct.DataTextField  = "Product_Name";
                SelectProduct.DataValueField = "ProductID";
                SelectProduct.DataBind();
                if (SelectProduct != null)
                {
                    SelectProduct.Items.Insert(0, "Select Product");
                    SelectProduct.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                connection.Close();
            }
            #endregion
        }
Exemplo n.º 22
0
        public void SelectAllProductsDto()
        {
            using (IDbConnection dbConnection = new SqliteConnectionFactory().Create())
            {
                var product1 = new ProductDto {Name = "Product #1"};
                dbConnection.Execute(new InsertProduct().Query(product1));

                var product2 = new ProductDto {Name = "Product #2"};
                dbConnection.Execute(new InsertProduct().Query(product2));

                var product3 = new ProductDto {Name = "Product #3"};
                dbConnection.Execute(new InsertProduct().Query(product3));

                QueryObject all = new SelectProduct().All();

                IEnumerable<ProductDto> productDtos = dbConnection.Query<ProductDto>(all);

                Assert.AreEqual(3, productDtos.Count());
            }
        }
Exemplo n.º 23
0
        //Sp_FillPO_Details
        public void PopulateDropDown(String Text)
        {
            #region Populating Product Name Dropdown

            try
            {
                connection.Open();

                Text = Text + "%";
                SqlCommand     command = new SqlCommand("SELECT * From tbl_ProductMaster Where tbl_ProductMaster.Product_Name LIKE '" + Text + "' AND Status = 1", connection);
                DataSet        ds      = new DataSet();
                SqlDataAdapter sA      = new SqlDataAdapter(command);
                sA.Fill(ds);
                if (SelectProduct.DataSource != null)
                {
                    SelectProduct.DataSource = null;
                }

                ProductSet = null;
                ProductSet = ds;
                // ds.Tables[0].Columns.Add("ProductInfo", typeof(string), "Product_Name+ ' '+itemStrength+' '+itemPackSize+' '+itemForm");

                SelectProduct.DataSource     = ds.Tables[0];
                SelectProduct.DataTextField  = "Description";
                SelectProduct.DataValueField = "ProductID";
                SelectProduct.DataBind();
                if (SelectProduct != null)
                {
                    SelectProduct.Items.Insert(0, "Select Product");
                    SelectProduct.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                connection.Close();
            }
            #endregion
        }
Exemplo n.º 24
0
        internal void SearchingProduct()
        {
            EnterProductName.SendKeys("Villa Maria");
            Thread.Sleep(2000);

            SelectProduct.Click();
            Thread.Sleep(5000);


            if (Product.Displayed)
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Test PASS, User can search the wine successfullyusing the search bar");
            }
            else
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test FAIL,User can't serarch the wine using search bar");
            }

            TastingNotes.Click();
            Thread.Sleep(2000);

            if (CriticReviews.Displayed)
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Test Pass,Critic Reviews Visible");
            }
            else
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Fail,Critic Revies Not Visible");
            }

            if (UserReviews.Displayed)
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Test Pass,User Reviews Visible");
            }
            else
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Fail,User Reviews Not Visible");
            }
        }
        private void BuildProductList()
        {
            var productList = new List <SelectProduct>();

            if (_vm.SelectGroupPropertyValue.Count == 1)
            {
                _vm.SelectGroupPropertyValue[0].SelectedPropertyValueList
                .Where(p => p.IsChecked).ToList().ForEach(p =>
                {
                    var selectProduct = new SelectProduct
                    {
                        PropertyValueList = new List <PropertyValueVM>
                        {
                            new PropertyValueVM
                            {
                                PropertySysNo    = _vm.SelectGroupPropertyValue[0].Property.SysNo,
                                SysNo            = p.PropertyValue.SysNo,
                                ValueDescription = p.PropertyValue.ValueDescription
                            }
                        },
                        ProductTitle = _vm.MainPageVM.BasicInfoVM.ProductGroupName + " " + p.PropertyValue.ValueDescription,
                        ProductModel = _vm.MainPageVM.BasicInfoVM.ProductGroupModel + " " + p.PropertyValue.ValueDescription,
                    };
                    selectProduct.CountryList = this.CountryList;
                    productList.Add(selectProduct);
                });
            }
            if (_vm.SelectGroupPropertyValue.Count == 2)
            {
                _vm.SelectGroupPropertyValue[0].SelectedPropertyValueList
                .Where(p => p.IsChecked).ToList()
                .SelectMany(p1 => _vm.SelectGroupPropertyValue[1].SelectedPropertyValueList
                            .Where(p => p.IsChecked).ToList(), (p1, p2) => new { p1, p2 }).ToList().ForEach(p =>
                {
                    var selectProduct = new SelectProduct
                    {
                        PropertyValueList = new List <PropertyValueVM>
                        {
                            new PropertyValueVM
                            {
                                PropertySysNo    = _vm.SelectGroupPropertyValue[0].Property.SysNo,
                                SysNo            = p.p1.PropertyValue.SysNo,
                                ValueDescription = p.p1.PropertyValue.ValueDescription
                            },
                            new PropertyValueVM
                            {
                                PropertySysNo    = _vm.SelectGroupPropertyValue[1].Property.SysNo,
                                SysNo            = p.p2.PropertyValue.SysNo,
                                ValueDescription = p.p2.PropertyValue.ValueDescription
                            }
                        },
                        ProductTitle = _vm.MainPageVM.BasicInfoVM.ProductGroupName
                                       + " " + p.p1.PropertyValue.ValueDescription
                                       + " " + p.p2.PropertyValue.ValueDescription,
                        ProductModel = _vm.MainPageVM.BasicInfoVM.ProductGroupModel
                                       + " " + p.p1.PropertyValue.ValueDescription
                                       + " " + p.p2.PropertyValue.ValueDescription,
                    };
                    selectProduct.CountryList = this.CountryList;
                    productList.Add(selectProduct);
                });
            }

            var existProductList = new List <SelectProduct>();

            _vm.GroupProductList.ForEach(p =>
            {
                var product = new SelectProduct
                {
                    ProductTitle = p.ProductBasicInfo.ProductTitle.Content,
                    ProductModel = p.ProductBasicInfo.ProductModel.Content
                };
                product.CountryList = this.CountryList;

                p.ProductBasicInfo.ProductProperties.ToList().ForEach(property =>
                {
                    if (_vm.MainPageVM.PropertyVM.ProductGroupSettings
                        .Any(setting => setting.ProductGroupProperty.SysNo == property.Property.PropertyInfo.SysNo))
                    {
                        if (property.Property.SysNo.HasValue && property.Property.PropertyInfo.SysNo.HasValue)
                        {
                            product.PropertyValueList.Add(new PropertyValueVM
                            {
                                PropertySysNo    = property.Property.PropertyInfo.SysNo.Value,
                                PropertyName     = property.Property.PropertyInfo.PropertyName.Content,
                                SysNo            = property.Property.SysNo.Value,
                                ValueDescription = property.Property.ValueDescription.Content
                            });
                        }
                    }
                });
                existProductList.Add(product);
            });

            var result = new List <SelectProduct>();

            productList.ForEach(p =>
            {
                if (!existProductList.Contains(p))
                {
                    result.Add(p);
                }
            });
            _vm.SelectedProduct = result;
        }
Exemplo n.º 26
0
 public void AddProductInCart()
 {
     SelectProduct.Click();
     SeeDetails.Click();
     AddToCart.Click();
 }