Exemplo n.º 1
0
        public bool AddUser(Users user)
        {
            CeceliaDataProvider dp = new CeceliaDataProvider();

            user.Password = StaticMethods.EncryptPassword(user.Password);
            return(dp.AddUser(user));
        }
Exemplo n.º 2
0
        public Users Login(string username, string password)
        {
            string encPassword     = StaticMethods.EncryptPassword(password);
            CeceliaDataProvider dp = new CeceliaDataProvider();

            Users user = dp.Login(username);

            if (user.Password == encPassword)
            {
                return(user);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            CeceliaDataProvider dp = new CeceliaDataProvider();
            ApplicationClass    applicationClass = new ApplicationClass();
            Workbook            workBook         = applicationClass.Workbooks.Open("C:\\2012_RX_Final.xls", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            Worksheet           workSheet        = (Worksheet)workBook.Worksheets.get_Item(1);

            range = workSheet.UsedRange;
            List <Product> products    = new List <Product>();
            List <Product> unAddedRows = new List <Product>();
            Product        product;
            int            rCnt = 0;

            Console.WriteLine("Extracting Products");
            for (rCnt = 2; rCnt < range.Rows.Count; rCnt++)
            {
                product             = new Product();
                product.Category    = GetValueFromCell(rCnt, 1);
                product.CompanyName = GetValueFromCell(rCnt, 2);
                product.Type1       = GetValueFromCell(rCnt, 3);
                product.Type2       = GetValueFromCell(rCnt, 4);
                product.Flavor      = GetValueFromCell(rCnt, 5);
                product.LastUpdated = DateTime.Now;
                if (product.CompanyName == string.Empty && product.Type1 == string.Empty && product.Type2 == string.Empty && product.Flavor == string.Empty)
                {
                    product.Id = rCnt;
                    unAddedRows.Add(product);
                    continue;
                }
                products.Add(product);
            }
            Console.WriteLine(products.Count.ToString() + " Products Extracted");
            Console.WriteLine("Saving Products");
            int i = 0;

            foreach (Product p in products)
            {
                try {
                    dp.AddProduct(p);
                    i++;
                } catch { }
            }
            Console.WriteLine(i.ToString() + "Products Saved");
            workBook.Close(true, null, null);
            applicationClass.Quit();
            Console.Read();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            List <Product>      unorderedProducts = new List <Product>();
            CeceliaDataProvider dp   = new CeceliaDataProvider();
            StringBuilder       text = new StringBuilder();

            unorderedProducts = dp.GetAllProducts();

            if (isCfOnly)
            {
                unorderedProducts.RemoveAll(o => o.CF == false);
            }
            if (isSfOnly)
            {
                unorderedProducts.RemoveAll(o => o.SF == false);
            }

            List <Category> Products = LoadProducts(unorderedProducts);

            WriteToTextFile(Products);
        }
Exemplo n.º 5
0
        public string GetTextString(bool isCf, bool isSf)
        {
            List <Product>      unorderedProducts = new List <Product>();
            CeceliaDataProvider dp   = new CeceliaDataProvider();
            StringBuilder       text = new StringBuilder();

            unorderedProducts = dp.GetAllProducts();

            if (isCf)
            {
                unorderedProducts.RemoveAll(o => o.CF == false);
            }
            if (isSf)
            {
                unorderedProducts.RemoveAll(o => o.SF == false);
            }

            List <Category> Products = LoadProducts(unorderedProducts);

            StringBuilder extract = WriteToTextFile(Products);

            return(extract.ToString());
        }
Exemplo n.º 6
0
 public ProductWorker()
 {
     _dp = new CeceliaDataProvider();
 }