Example #1
0
        static void Main()
        {
            int         pid;
            string      pname;
            double      price;
            int         qty;
            ProductDemo p = new ProductDemo();

            Console.Write("Enter the product ID: ");
            pid         = int.Parse(Console.ReadLine());
            p.ProductId = pid;
            Console.Write("Enter the product Name: ");
            pname          = (string)Console.ReadLine();
            p.Product_Name = pname;
            Console.Write("Enter the price: ");
            price   = double.Parse(Console.ReadLine());
            p.Price = price;
            Console.Write("Enter the quantity: ");
            qty        = int.Parse(Console.ReadLine());
            p.Quantity = qty;
            p.Amt      = price * qty;
            Console.WriteLine();
            Console.WriteLine($"Product ID:{ (int)p.ProductId}\nProduct Name:{ (string)p.Product_Name}\nPrice:{ (double)p.Price}\nQuantity:{ (int)p.Quantity}\nAmount Payabl{ (double)p.Amt} ");
            Console.ReadKey();
        }
Example #2
0
        static void Main(string[] args)
        {
            ProductDemo productDemo = new ProductDemo();
            var         product     = productDemo.createProductTest(10, "test", 1);

            productDemo.printProductTest(product);
            DatabaseDemo dbDemo = new DatabaseDemo();

            dbDemo.initDatabase();
            dbDemo.insertTableTest(Database.PRODUCT, product);
            dbDemo.printDatabaseTest(Database.PRODUCT);
            Console.ReadKey();
        }
Example #3
0
        public static void LoadDemoVersions(ApplicationProduct product, string cultureId)
        {
            try
            {
                // Load product screenshots
                if (!string.IsNullOrWhiteSpace(product.Catalog.UrlName))
                {
                    // Product resource directory is base dir + UrlName
                    string demoDir =
                        Configurations.ProductResDirBase +
                        product.Catalog.UrlName +
                        DemoDirName;

                    // Find Common demo file
                    string             dirPath = demoDir + CommonDemoDirName;
                    System.IO.FileInfo fi      = GetLatestDemoFile(dirPath);
                    string             fileUrl = string.Format("{0}{1}", dirPath, fi.Name);

                    if (!string.IsNullOrWhiteSpace(fileUrl))
                    {
                        product.Demo.CommonVersion      = new ProductDemo();
                        product.Demo.CommonVersion.Url  = fileUrl;
                        product.Demo.CommonVersion.Size = FormatFileSize(fi.Length);
                    }

                    // Find latest in culture file
                    dirPath = demoDir + cultureId + "/";
                    fi      = GetLatestDemoFile(dirPath);
                    fileUrl = string.Format("{0}{1}", dirPath, fi.Name);
                    if (!string.IsNullOrWhiteSpace(fileUrl))
                    {
                        ProductDemo demo = product.Demo[cultureId];
                        if (demo == null)
                        {
                            demo = new ProductDemo();
                            product.Demo.Add(demo);
                        }

                        demo.Url      = fileUrl;
                        demo.Size     = FormatFileSize(fi.Length);
                        demo.Language = Repository.Memory.Languages.Instance.Items[cultureId];
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(string.Format("Exception:{0}", ex));
            }
        }
Example #4
0
        static void Main(string[] args)
        {
            DatabaseDemo dataDemo = new DatabaseDemo();
            Database     data     = new Database();

            /*            dataDemo.initDatabase();
             *          dataDemo.printTableTest("productTable");
             *          Console.WriteLine("---------------------------------------------------");
             *          var arrL = dataDemo.selectTableTest("productTable");
             *          for (int i = 0; i < arrL.Count; i++)
             *          {
             *              Product product = (Product)Convert.ChangeType(arrL[i], typeof(Product));
             *              Console.WriteLine("id: " + product.getId());
             *              Console.WriteLine("name: " + product.getName());
             *              Console.WriteLine("categoryId: " + product.getCategory());
             *          }*/
            ProductDemo proDemo = new ProductDemo();

            proDemo.createProductTest(2, "data", 3);
            dataDemo.printTableTest(Database.PRODUCT);
        }