예제 #1
0
        public ManagerLogin_Form()
        {
            InitialLoadSuccess = false;
            InitializeComponent();

            //load the Config XML file.
            try
            {
                ConfigurationSettings = new AppConfig(XML_CONFIG_FILE);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error loading App Config:" + XML_CONFIG_FILE, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Initislize the NSADatabase object
            try
            {
                nsadb = new NSADatabase(ConfigurationSettings.DatabaseServer, ConfigurationSettings.DatabaseName,
                                        ConfigurationSettings.DatabaseUserName, ConfigurationSettings.DatabasePassword,
                                        ConfigurationSettings.StoreNumber);
                InitialLoadSuccess = nsadb.Connected();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error loading Database: " + XML_CONFIG_FILE, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
예제 #2
0
        public PriceChange(string menuitemid, string price)
        {
            InitializeComponent();
            InitialLoadSuccess = false;

            //load the Config XML file.
            try
            {
                ConfigurationSettings = new AppConfig(XML_CONFIG_FILE);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error loading App Config:" + XML_CONFIG_FILE, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Initislize the NSADatabase object
            try
            {
                nsadb = new NSADatabase(ConfigurationSettings.DatabaseServer, ConfigurationSettings.DatabaseName,
                                        ConfigurationSettings.DatabaseUserName, ConfigurationSettings.DatabasePassword,
                                        ConfigurationSettings.StoreNumber);
                InitialLoadSuccess = nsadb.Connected();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error loading Database: " + XML_CONFIG_FILE, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Load Passed in Information
            curitem          = menuitemid;
            oldPrice         = price;
            Price_Label.Text = "$" + oldPrice;
        }
예제 #3
0
        //Constructor for Manager Kiosk
        public ManagerKiosk(int isassistant)
        {
            InitialLoadSuccess = false;
            InitializeComponent();

            //load the Config XML file.
            try
            {
                ConfigurationSettings = new AppConfig(XML_CONFIG_FILE);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error loading App Config:" + XML_CONFIG_FILE, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Initislize the NSADatabase object
            try
            {
                nsadb = new NSADatabase(ConfigurationSettings.DatabaseServer, ConfigurationSettings.DatabaseName,
                                        ConfigurationSettings.DatabaseUserName, ConfigurationSettings.DatabasePassword,
                                        ConfigurationSettings.StoreNumber);
                InitialLoadSuccess = nsadb.Connected();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error loading Database: " + XML_CONFIG_FILE, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Intial Load of all Lists
            LoadOrders();
            LoadKidsMealDays();
            LoadManagerAccountList();
            LoadManagerInventoryList();
            LoadManagerComponentList();
            LoadManagerMenuItemList();
            LoadReports();

            // Event Handler Definitions
            RefreshOrders_Button.Click          += new EventHandler(this.RefreshOrders_Click);
            RefundItem_Button.Click             += new EventHandler(this.RefundItem_Click);
            LoyaltyAccountSearch_Button.Click   += new EventHandler(this.LoyaltyAccountSearch_Button_Click);
            SaveLoyaltyAccount_Button.Click     += new EventHandler(this.SaveLoyaltyAccount_Button_Click);
            ClearPickupWindow_Button.Click      += new EventHandler(this.ClearOrderScreen_Button_Click);
            DeleteLoyaltyAccount_Button.Click   += new EventHandler(this.DeleteLoyaltyAccount_Click);
            DeleteAssistantManager_Button.Click += new EventHandler(this.DeleteManagerAccount_Click);
            AssistantManagerSave_Button.Click   += new EventHandler(this.SaveManagerAccount_Button_Click);
            InventoryUpdate_Button.Click        += new EventHandler(this.UpdateInventory_Click);
            ComponentDelete_Button.Click        += new EventHandler(this.DeleteComponent_Click);
            ComponentSave_Button.Click          += new EventHandler(this.SaveComponent_Click);
            MenuItemDelete_Button.Click         += new EventHandler(this.DeleteMenuItem_Click);
            MenuItemSave_Button.Click           += new EventHandler(this.SaveMenuItem_Click);
            PrintReport_Button.Click            += new EventHandler(this.PrintReport_Button_Click);

            if (isassistant == 1)
            {
                ManagerKiosk_TabPage.TabPages.Remove(AssistantManagers);
            }
        }
예제 #4
0
        //Sales by week will generate a HTML formatted report int the form of a string.
        // We will use the NSADatabase Class to retrieve the Data.
        // The Table will be in the following format
        // ┌───────────────────────────┐
        // |      Sales By Day         |
        // ├───────────────────────────┤
        // |Store - #                  |
        // ├───────────────────────────|
        // │Day  │Date│Num Orders│Sales│
        // ├─────┼────┼──────────┼─────┤
        // └─────┴────┴──────────┴─────┘
        private string SalesByDay()
        {
            //Stringbuilder for creating the Query to use to get the sales data.
            StringBuilder ByDayQuery = new StringBuilder();

            //for readability the query is built via multiple appends rather than a single one.
            ByDayQuery.Append("SELECT storeid, month(O.timeplaced) as Month, day(O.timeplaced) as Day, ");
            ByDayQuery.Append("WEEKDAY(O.timeplaced) as DayOfWeek, DATE_FORMAT(O.timeplaced, '%m/%d/%Y') as Date, ");
            ByDayQuery.Append("sum(O.total) as Sales, count(orderid) as Orders, refunded ");
            ByDayQuery.Append("FROM Orders O WHERE O.refunded = 0 AND storeid IN (");

            //loop over all the stations in the list execpt for the last one adding them
            //to the set of numbers for the in clause
            for (int i = 0; i < (Stores.Count - 1); i++) // Loop through List with for
            {
                ByDayQuery.Append(Stores[i].ToString());
                ByDayQuery.Append(",");
            }

            //adding the last store to the In clause
            ByDayQuery.Append(Stores[(Stores.Count - 1)].ToString());

            //add the end of the query
            ByDayQuery.Append(") GROUP BY storeid , Day;");

            //StringBuilder object.
            StringBuilder ByDayReport = new StringBuilder();

            //Create and Open the Database Connection.
            NSADatabase DBConnection = new NSADatabase("localhost", "nsa-database", "root", "", 1);

            //Create Data reader object using the built query with the database object.
            MySqlDataReader ByDayData = DBConnection.CustomQuery(ByDayQuery.ToString());

            //Append the top portion of the report again done in multiple appends for readability.
            ByDayReport.Append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html><head><title>NSASALES - By Day</title></head>");
            ByDayReport.Append("<body><table width=\"100%\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" summary=\"Sales By Day\" w>");
            ByDayReport.Append("<thead><th align=\"center\" colspan=\"4\">Sales By Day</th></thead>");

            //There is not a store it < 0
            int storeid = -1;

            //Read the data and Build the HTML File.
            while (ByDayData.Read())
            {
                //if we hit a new store we need to enter the store Id and header lines.
                if (storeid != (int)ByDayData["storeid"])
                {
                    storeid = (int)ByDayData["storeid"];
                    ByDayReport.Append("<tr><th align=\"left\" colspan=\"4\">Store: ");
                    ByDayReport.Append(storeid.ToString());
                    ByDayReport.Append("</th></tr>");
                    ByDayReport.Append("<tr><th>Date</th><th>Day</th><th>Orders per Day</th><th>Sales in Dollars per Day</th></tr>");
                }

                //Add the weeks data row to the report.
                ByDayReport.Append("<tr><td align=\"center\">");
                ByDayReport.Append(string.Format("{0:MM/dd/yyyy}", ByDayData["Date"]));
                ByDayReport.Append("</td><td align=\"center\">");
                ByDayReport.Append(DayofWeek((int)ByDayData["DayOfWeek"]));
                ByDayReport.Append("</td><td align=\"center\">");
                ByDayReport.Append(ByDayData["Orders"]);
                ByDayReport.Append("</td><td align=\"center\">");
                ByDayReport.Append(String.Format("{0:C}", ByDayData["Sales"]));
                ByDayReport.Append("</td></tr>");
            }

            //add the closing tags for the report.
            ByDayReport.Append("</table></body></html>");

            //must remember to close the reader
            ByDayData.Close();

            //Close the connection
            DBConnection.CloseConnection();

            //return the built report to the calling function.
            return(ByDayReport.ToString());
        }
예제 #5
0
 //Constructor that specifies the connection other than the default
 //Will attempt to open the connection.
 public Reports(string server, string dbname, string dbuser, string password)
 {
     Stores = new List <int>();
     nsadb  = new NSADatabase(server, dbname, dbuser, password);
 }