예제 #1
0
        /// <summary>
        /// First Updates the company list from the database to scrape changes, then exports to a csv.
        /// </summary>
        public static void ExportCompanies()
        {
            CompanyList.UpdateCompanies();
            Dictionary <string, string> companyDetails = new Dictionary <string, string>()
            {
                { "Name", "" },
                { "Address", "" },
                { "Tel", "" }
            };

            foreach (Company c in CompanyList.companies)
            {
                if (!companiesToCSV.ContainsKey(c.CompanyID))
                {
                    string company = c.CompanyID;
                    companiesToCSV.Add(c.CompanyID, new Dictionary <string, string>(companyDetails));
                    companiesToCSV[company]["Name"]      = c.CompanyName;
                    companiesToCSV[company]["Address"]   = c.Address;
                    companiesToCSV[company]["Telephone"] = c.Tel;
                }
            }

            string file = "Company_List_as_of_" + DateTime.Today.Date.Year + "-" + DateTime.Today.Date.Month + "-" + DateTime.Today.Date.Day + ".csv";

            WriteCSV(file, companiesToCSV);
        }
예제 #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            DBConnect.Session.Open(); // open the connection with the database

            // Populate the internal product and companies listings
            ProductList.UpdateProducts();
            CompanyList.UpdateCompanies();

            Application.Run(new Form1()); // run the main program form.

            #region Testing Single Forms

            //Application.Run(new frmPointOfSales()); // run the main program form.

            //Application.Run(new SalesForACategory());

            #endregion

            DBConnect.Session.Close(); // safely close the connection to the database.
        }