예제 #1
0
        protected void btnCreateUpdateLogTables_Click(object sender, EventArgs e)
        {
            TrackerTools _TT = new TrackerTools();

            _TT.ClearTrackerSessionErrorString();
            TrackerDb _TDB = new TrackerDb();

            // create LogTbl if it does not exist

            _TDB.CreateIfDoesNotExists(TrackerDb.SQLTABLENAME_LOGTBL);
            ltrlStatus.Visible = true;
            ltrlStatus.Text    = "Log table checked";
            if (_TT.IsTrackerSessionErrorString())
            {
                ltrlStatus.Text += " - Error: " + _TT.GetTrackerSessionErrorString();
                _TT.ClearTrackerSessionErrorString();
            }

            // list all the users that are not added
            PersonsTbl    _PersonsTbl = new PersonsTbl();
            List <string> _SecurityUsersNotInPeopleTbl = _PersonsTbl.SecurityUsersNotInPeopleTbl();

            pnlSetClinetType.Visible = true;
            gvCustomerTypes.Visible  = false;
            gvResults.DataSource     = _SecurityUsersNotInPeopleTbl;
            ResultsTitleLabel.Text   = "Security Users not in People Table ";
            if (_TT.IsTrackerSessionErrorString())
            {
                ltrlStatus.Text += " - Error: " + _TT.GetTrackerSessionErrorString();
                _TT.ClearTrackerSessionErrorString();
            }

            gvResults.DataBind();

            // create SectionTypesTbl if it does not exist
            if (_TDB.CreateIfDoesNotExists(TrackerDb.SQLTABLENAME_SECTIONTYPESTBL))
            {
                ltrlStatus.Text += "; Section Types table checked";
                if (_TT.IsTrackerSessionErrorString())
                {
                    ltrlStatus.Text += " - Error: " + _TT.GetTrackerSessionErrorString();
                    _TT.ClearTrackerSessionErrorString();
                }
                // add sections that do
                SectionTypesTbl _SectionTypeTbl = new SectionTypesTbl();
                if (_SectionTypeTbl.InsertDefaultSections())
                {
                    ltrlStatus.Text += " - default sections added.";
                }
                if (_TT.IsTrackerSessionErrorString())
                {
                    ltrlStatus.Text += " - Error: " + _TT.GetTrackerSessionErrorString();
                    _TT.ClearTrackerSessionErrorString();
                }
            }
            // create TransactionTypesTbl if it does not exists
            if (_TDB.CreateIfDoesNotExists(TrackerDb.SQLTABLENAME_TRANSACTIONTYPESTBL))
            {
                ltrlStatus.Text += "; Transaction Types table checked";
                if (_TT.IsTrackerSessionErrorString())
                {
                    ltrlStatus.Text += " - Error: " + _TT.GetTrackerSessionErrorString();
                    _TT.ClearTrackerSessionErrorString();
                }
                // add Transactions that do
                TransactionTypesTbl _TransactionTypeTbl = new TransactionTypesTbl();
                if (_TransactionTypeTbl.InsertDefaultTransactions())
                {
                    ltrlStatus.Text += " - default Transactions added.";
                }
                if (_TT.IsTrackerSessionErrorString())
                {
                    ltrlStatus.Text += " - Error: " + _TT.GetTrackerSessionErrorString();
                    _TT.ClearTrackerSessionErrorString();
                }
            }

            _TDB.Close();
        }
예제 #2
0
        protected void btnSetClientType_Click(object sender, EventArgs e)
        {
            pnlSetClinetType.Visible = true;
            gvCustomerTypes.Visible  = true;

            List <ContactsUpdated> _ContactsUpdated = new List <ContactsUpdated>();

            ClientUsageLinesTbl _ClientUsageLines = new ClientUsageLinesTbl();
            ItemUsageTbl        _ItemUsageTbl     = new ItemUsageTbl();
            ContactType         _Customer         = new ContactType();

            string _fName = "c:\\temp\\" + String.Format("SetClientType_{0:ddMMyyyy hh mm}.txt", DateTime.Now);

            _ColsStream = new StreamWriter(_fName, false); // create new file
            _ColsStream.WriteLine("Task, Company Name, origType, newType, PredDisabled");
            List <ContactType> _Customers = null;
            int i = 0;

            try
            {
                _Customers = _Customer.GetAllContacts("CompanyName"); // get all client sort by Company name
//        _Customers.RemoveAll(x => !x.IsEnabled);   // delete all the disabled clients

                List <int> _CoffeeClients     = GetAllCoffeeClientTypes();
                List <int> _ServiceOnlyClient = GetAllServiceOnlyClientTypes();

                // for each client check if they have ordered stuff and if so then set them as a particular client

                while (i < _Customers.Count)
                {
                    ContactsUpdated _Contact = new ContactsUpdated();
                    // only if they are enabled and not set to info only
                    if (_Customers[i].CustomerTypeID != CustomerTypeTbl.CONST_INFO_ONLY)
                    {
                        _Contact.ContactName        = _Customers[i].CompanyName;
                        _Contact.ContactTypeID      = _Customers[i].CustomerTypeID;
                        _Contact.origContactTypeID  = _Customers[i].CustomerTypeID;
                        _Contact.PredictionDisabled = _Customers[i].PredictionDisabled;

                        if (_Contact.ContactTypeID == 0) // type not set then assume coffee client.
                        {
                            _Contact.ContactTypeID = CustomerTypeTbl.CONST_COFFEE_ONLY;
                        }
                        // if they are currently marked as coffee client then check if they have ordered since their install date and with in the last year
                        if (_CoffeeClients.Contains(_Contact.ContactTypeID))
                        {
                            _Contact = CheckCoffeeCustomerIsOne(_Customers[i], _Contact);
                        }
                        else // customer is set to only be info or something so lets check if that is true
                        {
                            _Contact = CheckNoneCoffeeCustomer(_Customers[i], _Contact);
                        }
                        /// Has it changed? is fo update
                        if (!_Contact.ContactTypeID.Equals(_Contact.origContactTypeID))
                        {
                            // copy the values that could have change across since C cannot clone with out a class def so we use the temp class instead
                            _Customers[i].CustomerTypeID     = _Contact.ContactTypeID;
                            _Customers[i].PredictionDisabled = _Contact.PredictionDisabled;
                            string _Result = _Customers[i].UpdateContact(_Customers[i]);
                            _ContactsUpdated.Add(_Contact);
                            if (String.IsNullOrEmpty(_Result))
                            {
                                _ColsStream.WriteLine("Added {0}-{1}: {2}, {3}, {4}, {5}", i, _ContactsUpdated.Count, _Contact.ContactName, _Contact.origContactTypeID, _Contact.ContactTypeID, _Contact.PredictionDisabled);
                            }
                            else
                            {
                                _ColsStream.WriteLine("Error {0} Adding: {1}, {2}, {3}, {4}, {5}", _Result, i, _Result, _Contact.ContactName, _Contact.origContactTypeID, _Contact.ContactTypeID, _Contact.PredictionDisabled);
                            }
                        }
                    }
                    i++;
                }
            }
            catch (Exception _ex)
            {
                string _errStr = _ex.Message;

                TrackerTools _TT    = new TrackerTools();
                string       _TTErr = _TT.GetTrackerSessionErrorString();
                if (!String.IsNullOrWhiteSpace(_TTErr))
                {
                    _errStr += " TTError: " + _TTErr;
                }

                showMessageBox _exMsg = new showMessageBox(this.Page, "Error", _errStr);
                if (_Customers != null)
                {
                    _ColsStream.WriteLine("ERROR AT: {0}, Name: {1}, ID: {2}, Pred: {3}", i, _Customers[i].CompanyName, _Customers[i].CustomerTypeID, _Customers[i].PredictionDisabled);
                }
                else
                {
                    _ColsStream.WriteLine("null customers");
                }
                _ColsStream.WriteLine("Error:" + _errStr);
                throw;
            }
            finally
            {
                _ColsStream.Close();
            }

            showMessageBox _sMsg = new showMessageBox(this.Page, "Info", String.Format("A Total of {0}, contacts were updated", _ContactsUpdated.Count));

            ltrlStatus.Text        = String.Format("A Total of {0}, contacts were updated", _ContactsUpdated.Count);
            ltrlStatus.Visible     = true;
            ResultsTitleLabel.Text = "Set client type results";
            gvResults.DataSource   = _ContactsUpdated;
            gvResults.DataBind();
            // upnlSystemToolsButtons.Update();
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                long     _BoundCustomerId   = 1;
                DateTime _BoundDeliveryDate = DateTime.Now.Date;
                String   _BoundNotes        = String.Empty;

                if (Request.QueryString[CONST_QRYSTR_CUSTOMERID] != null)
                {
                    _BoundCustomerId = Convert.ToInt32(Request.QueryString[CONST_QRYSTR_CUSTOMERID].ToString());
                }
                if (Request.QueryString[CONST_QRYSTR_DELIVERYDATE] != null)
                {
                    _BoundDeliveryDate = Convert.ToDateTime(Request.QueryString[CONST_QRYSTR_DELIVERYDATE]).Date;
                }
                if (Request.QueryString[CONST_QRYSTR_NOTES] != null)
                {
                    _BoundNotes = Request.QueryString[CONST_QRYSTR_NOTES].ToString();
                }

                Session[OrderHeaderData.CONST_BOUNDCUSTOMERID]   = _BoundCustomerId;
                Session[OrderHeaderData.CONST_BOUNDDELIVERYDATE] = _BoundDeliveryDate.Date;
                Session[OrderHeaderData.CONST_BOUNDNOTES]        = _BoundNotes;
                Session[CONST_ORDERHEADERVALUES] = null;

                OrderItemTbl mine_ = new OrderItemTbl();

                // set the permissions
                MembershipUser _currMember = Membership.GetUser();
                btnOrderCancelled.Enabled = (_currMember.UserName.ToLower() == "warren");

                bool _EnableNew = User.IsInRole("Administrators") || User.IsInRole("AgentManager") || User.IsInRole("Agents");

                btnNewItem.Enabled = _EnableNew;
                TrackerTools _TT = new TrackerTools();

                _TT.SetTrackerSessionErrorString(string.Empty);
                if (Request.QueryString[CONST_QRYSTR_INVOICED] != null)
                {
                    if (Request.QueryString[CONST_QRYSTR_INVOICED].Equals("Y"))
                    {
                        MarkItemAsInvoiced();
                    }
                }
                else if (Request.QueryString[CONST_QRYSTR_DELIVERED] != null)
                {
                    if (Request.QueryString[CONST_QRYSTR_DELIVERED].Equals("Y"))
                    {
                        btnOrderDelivered_Click(sender, e);
                    }
                }
            }
            else
            {
                TrackerTools _TT       = new TrackerTools();
                string       _ErrorStr = _TT.GetTrackerSessionErrorString();
                if (!string.IsNullOrEmpty(_ErrorStr))
                {
                    showMessageBox _MsgBox = new showMessageBox(this.Page, "Tracker Error", "ERROR: " + _ErrorStr);
                    _TT.SetTrackerSessionErrorString(string.Empty);
                }
            }
        }
예제 #4
0
        //protected void MarkTempOrdersItemsAsDone(long pCustomerID)
        //{
        //  string _SQLUpdate = "UPDATE OrdersTbl SET OrdersTbl.Done = True WHERE CustomderId = " + pCustomerID.ToString() +
        //                         "AND EXISTS (SELECT RequiredByDate FROM TempOrdersHeaderTbl " +
        //                         "            WHERE (RequiredByDate = OrdersTbl.RequiredByDate))";

        //  TrackerDb _TrackerDb = new TrackerDb();
        //  _TrackerDb.ExecuteNonQuerySQL(_SQLUpdate);

        //  // ResetCustomerReminderCount(pCustomerId);
        //  //'''''''''''''
        //  //' mark orders as done - should do this last
        //  //'''
        //  //lblStatus.Caption = "Marking orders as done"
        //  //dbs.Execute ("UPDATE OrdersTbl SET OrdersTbl.Done = True " + _
        //  //             "WHERE (((Exists (Select TempOrdersTbl.OrderId from TempOrdersTbl where  " + _
        //  //                       "TempOrdersTbl.OrderId = OrdersTbl.OrderId))<>False))")
        //  //'''''''
        //  //'  Resetting count and enable, only if coffee item
        //  //'
        //  //dbs.Execute ("UPDATE DISTINCTROW CustomersTbl SET ReminderCount = 0, enabled = True WHERE CustomerID=" + lblCustomerID.Caption)
        //}

        // Logic for processing order as done:
        // 1. move items consumed from temp aable to the items consumed for the contact
        // 2. using the summary of the data on the form do calculations around predictions
        //    on when the contact needs items again.
        // 3. Notify client of items deliverred (add option to contacts table)
        // 4. return to the previous page.
        protected void btnDone_Click(object sender, EventArgs e)
        {
            const long MAXQTYINSTOCK = 50;

            TrackerTools _TrackerTools = new TrackerTools();

            _TrackerTools.SetTrackerSessionErrorString(string.Empty);

            Label    _CustomerIDLabel   = (Label)(fvOrderDone.FindControl("CustomerIDLabel"));
            Label    _CustomerNameLabel = (Label)(fvOrderDone.FindControl("CompanyNameLabel"));
            long     _CustomerID        = Convert.ToInt64(_CustomerIDLabel.Text);
            TextBox  _OrderDateLabel    = (TextBox)(fvOrderDone.FindControl("ByDateTextBox"));
            DateTime _OrderDate         = Convert.ToDateTime(_OrderDateLabel.Text);
            double   _CoffeeStock       = 0;
            // store the current data for display later:
            ClientUsageTbl _OriginalUsageDAL  = new ClientUsageTbl();
            ClientUsageTbl _OriginalUsageData = _OriginalUsageDAL.GetUsageData(_CustomerID);

            if (!string.IsNullOrEmpty(_TrackerTools.GetTrackerSessionErrorString()))
            {
                Response.Write(_TrackerTools.GetTrackerSessionErrorString());
            }

            TempOrdersDAL _TempOrdersDAL        = new TempOrdersDAL(); //
            bool          _HasCoffeeInTempOrder = _TempOrdersDAL.HasCoffeeInTempOrder();

            if (!string.IsNullOrEmpty(_TrackerTools.GetTrackerSessionErrorString()))
            {
                Response.Write(_TrackerTools.GetTrackerSessionErrorString());
            }

            /* NEED TO ADD Code to check for zzname */

            // check cup count not in wrong place
            if ((tbxStock.Text.Length > 0) && (Convert.ToInt64(tbxStock.Text) > MAXQTYINSTOCK))
            {
                ltrlStatus.Text = "<b>The stock quantity appears very high please check that you have enterred the correct value in kilograms.</b>";
            }
            else
            {
                _CoffeeStock = String.IsNullOrEmpty(tbxStock.Text) ? 0 : Convert.ToDouble(tbxStock.Text);

                // First we must get the latest cup count
                ltrlStatus.Text = "Calculating the latest cup count";
                GeneralTrackerDbTools _GeneralTrackerDb = new GeneralTrackerDbTools();

                GeneralTrackerDbTools.LineUsageData _LatestCustomerData = _GeneralTrackerDb.GetLatestUsageData(_CustomerID, TrackerTools.CONST_SERVTYPECOFFEE);
                if (!string.IsNullOrEmpty(_TrackerTools.GetTrackerSessionErrorString()))
                {
                    Response.Write(_TrackerTools.GetTrackerSessionErrorString());
                }

                bool _bIsActual = (tbxCount.MaxLength > 0); // if there is a cup count
                long _lCupCount = 0;
                if (tbxCount.MaxLength > 0)
                {
                    _lCupCount = Convert.ToInt64(tbxCount.Text);
                }

                // Calculate the cup count if we do not have it on the form or they entered a value that makes no sense
                if ((_lCupCount < 1) || (_lCupCount < _LatestCustomerData.LastCount))
                {
                    ltrlStatus.Text = "Calculating the latest est cup count";
                    _lCupCount      = _GeneralTrackerDb.CalcEstCupCount(_CustomerID, _LatestCustomerData, _HasCoffeeInTempOrder);
                    _bIsActual      = false;
                }

                //' add items to consumption log
                _lCupCount = AddItemsToClientUsageTbl(_CustomerID, _bIsActual, _lCupCount, _CoffeeStock, _OrderDate);

                // update the last cup count for the client
                if (!_OriginalUsageDAL.UpdateUsageCupCount(_CustomerID, _lCupCount))
                {
                    ltrlStatus.Text = "error updating last count";
                }

                // now update the predictions
                _GeneralTrackerDb.UpdatePredictions(_CustomerID, _lCupCount);

                // update all items in the order table as done that are done
                _TempOrdersDAL.MarkTempOrdersItemsAsDone();

                // reset count and enable client
                _GeneralTrackerDb.ResetCustomerReminderCount(_CustomerID, _HasCoffeeInTempOrder);
                // destroy the temp table that we used to create this temp orders
                _TempOrdersDAL.KillTempOrdersData();

                ShowResults(_CustomerNameLabel.Text, _CustomerID, _OriginalUsageData);
            }
        }
예제 #5
0
        protected void GoButton_Click(object sender, EventArgs e)
        {
            List <SQLCommand> _SQLCommands = new List <SQLCommand>();
            string            _FileName    = FileNameTextBox.Text;

            _FileName = _FileName.Replace(@"\", @"\\");

            XmlReader _XmlReader = XmlReader.Create(_FileName);

            try
            {
                while (_XmlReader.Read())
                {
                    if ((_XmlReader.NodeType == XmlNodeType.Element) && (_XmlReader.Name == "command"))
                    {
                        SQLCommand _SQLCommand = new SQLCommand();

                        _SQLCommand.type = _XmlReader.GetAttribute("type");
                        _XmlReader.Read();                                    // next should be value
                        _SQLCommand.sql = _XmlReader.Value.Replace("\n", ""); // remove new line characters

                        _SQLCommands.Add(_SQLCommand);
                    }
                }
                _XmlReader.Close();

                for (int i = 0; i < _SQLCommands.Count; i++)
                {
                    if (_SQLCommands[i].type == "select")
                    {
                        GridView            _gvSelectResult = new GridView();
                        System.Data.DataSet _ds             = RunSelect(_SQLCommands[i].sql);

                        _SQLCommands[i].result = (_ds != null);

                        _gvSelectResult.DataSource = _ds;

                        _gvSelectResult.DataBind();
                        pnlSQLResults.Controls.Add(_gvSelectResult);
                    }
                    else if (_SQLCommands[i].type != "disabled")
                    {
                        _SQLCommands[i].errString = RunCommand(_SQLCommands[i].sql);
                        _SQLCommands[i].result    = String.IsNullOrWhiteSpace(_SQLCommands[i].errString);
                    }

                    TrackerTools _TT  = new TrackerTools();
                    string       _err = _TT.GetTrackerSessionErrorString();
                    if (!string.IsNullOrEmpty(_err))
                    {
                        showMessageBox _msg = new showMessageBox(this.Page, "err", _err);
                        _TT.SetTrackerSessionErrorString("");
                    }
                }
                // assign resutls to result panel
                gvSQLResults.DataSource = _SQLCommands;
                gvSQLResults.DataBind();
            }
            catch (Exception _ex)
            {
                showMessageBox _showMsg = new showMessageBox(this.Page, "Error", "File access error: \n" + _ex.Message);
            }
            finally
            {
                _XmlReader.Close();
            }
        }
예제 #6
0
        //protected void MarkTempOrdersItemsAsDone(long pCustomerID)
        //{
        //  string _SQLUpdate = "UPDATE OrdersTbl SET OrdersTbl.Done = True WHERE CustomderId = " + pCustomerID.ToString() +
        //                         "AND EXISTS (SELECT RequiredByDate FROM TempOrdersHeaderTbl " +
        //                         "            WHERE (RequiredByDate = OrdersTbl.RequiredByDate))";

        //  TrackerDb _TrackerDb = new TrackerDb();
        //  _TrackerDb.ExecuteNonQuerySQL(_SQLUpdate);

        //  // ResetCustomerReminderCount(pCustomerId);
        //  //'''''''''''''
        //  //' mark orders as done - should do this last
        //  //'''
        //  //lblStatus.Caption = "Marking orders as done"
        //  //dbs.Execute ("UPDATE OrdersTbl SET OrdersTbl.Done = True " + _
        //  //             "WHERE (((Exists (Select TempOrdersTbl.OrderId from TempOrdersTbl where  " + _
        //  //                       "TempOrdersTbl.OrderId = OrdersTbl.OrderId))<>False))")
        //  //'''''''
        //  //'  Resetting count and enable, only if coffee item
        //  //'
        //  //dbs.Execute ("UPDATE DISTINCTROW CustomersTbl SET ReminderCount = 0, enabled = True WHERE CustomerID=" + lblCustomerID.Caption)
        //}

        // Logic for processing order as done:
        // 1. move items consumed from temp aable to the items consumed for the contact
        // 2. using the summary of the data on the form do calculations around predictions
        //    on when the contact needs items again.
        // 3. Notify client of items deliverred (add option to contacts table)
        // 4. return to the previous page.
        protected void btnDone_Click(object sender, EventArgs e)
        {
            const long MAXQTYINSTOCK = 50;

            TrackerTools _TrackerTools = new TrackerTools();

            _TrackerTools.SetTrackerSessionErrorString(string.Empty);

            Label    _CustomerIDLabel   = (Label)(fvOrderDone.FindControl("CustomerIDLabel"));
            Label    _CustomerNameLabel = (Label)(fvOrderDone.FindControl("CompanyNameLabel"));
            long     _CustomerID        = Convert.ToInt64(_CustomerIDLabel.Text);
            TextBox  _OrderDateLabel    = (TextBox)(fvOrderDone.FindControl("ByDateTextBox"));
            DateTime _OrderDate         = Convert.ToDateTime(_OrderDateLabel.Text);
            double   _CoffeeStock       = 0;
            // store the current data for display later:
            ClientUsageTbl _OriginalUsageDAL  = new ClientUsageTbl();
            ClientUsageTbl _OriginalUsageData = _OriginalUsageDAL.GetUsageData(_CustomerID);

            if (!string.IsNullOrEmpty(_TrackerTools.GetTrackerSessionErrorString()))
            {
                Response.Write(_TrackerTools.GetTrackerSessionErrorString());
            }

            TempOrdersDAL _TempOrdersDAL        = new TempOrdersDAL(); //
            bool          _HasCoffeeInTempOrder = _TempOrdersDAL.HasCoffeeInTempOrder();

            if (!string.IsNullOrEmpty(_TrackerTools.GetTrackerSessionErrorString()))
            {
                Response.Write(_TrackerTools.GetTrackerSessionErrorString());
            }

            /* NEED TO ADD Code to check for zzname */

            // check cup count not in wrong place
            if ((tbxStock.Text.Length > 0) && (Convert.ToDouble(tbxStock.Text) > MAXQTYINSTOCK))
            {
                showMessageBox _MsgBox = new showMessageBox(this.Page, "Stock seems high",
                                                            "The stock quantity appears very high please check that you have enterred the correct value in kilograms.</b>");
            }
            else
            {
                _CoffeeStock = String.IsNullOrEmpty(tbxStock.Text) ? 0 : Math.Round(Convert.ToDouble(tbxStock.Text), 2);

                // First we must get the latest cup count
                ltrlStatus.Text = "Calculating the latest cup count";
                GeneralTrackerDbTools _GeneralTrackerDb = new GeneralTrackerDbTools();

                GeneralTrackerDbTools.LineUsageData _LatestCustomerData = _GeneralTrackerDb.GetLatestUsageData(_CustomerID, TrackerTools.CONST_SERVTYPECOFFEE);
                if (!string.IsNullOrEmpty(_TrackerTools.GetTrackerSessionErrorString()))
                {
                    showMessageBox _smb = new showMessageBox(this.Page, "Tracker Session Error", _TrackerTools.GetTrackerSessionErrorString());
                }
                bool _bIsActual = (tbxCount.MaxLength > 0); // if there is a cup count
                long _lCupCount = 0;
                if (tbxCount.MaxLength > 0)
                {
                    _lCupCount = Convert.ToInt64(tbxCount.Text);
                }

                // Calculate the cup count if we do not have it on the form or they entered a value that makes no sense
                if ((_lCupCount < 1) || (_lCupCount < _LatestCustomerData.LastCount))
                {
                    ltrlStatus.Text = "Calculating the latest est cup count";
                    _lCupCount      = _GeneralTrackerDb.CalcEstCupCount(_CustomerID, _LatestCustomerData, _HasCoffeeInTempOrder);
                    _bIsActual      = false;
                }
                // clear any repairs that may have been logged
                RepairsTbl _Repairs = new RepairsTbl();
                _Repairs.SetStatusDoneByTempOrder();

                //' add items to consumption log
                _lCupCount = AddItemsToClientUsageTbl(_CustomerID, _bIsActual, _lCupCount, _CoffeeStock, _OrderDate);

                // update the last cup count for the client
                if (!_OriginalUsageDAL.UpdateUsageCupCount(_CustomerID, _lCupCount))
                {
                    showMessageBox _smb = new showMessageBox(this.Page, "Error", "Error updating last count");
                    ltrlStatus.Text = "error updating last count";
                }

                // now update the predictions
                _GeneralTrackerDb.UpdatePredictions(_CustomerID, _lCupCount);

                // update all items in the order table as done that are done
                _TempOrdersDAL.MarkTempOrdersItemsAsDone();

                // reset count and enable client
                _GeneralTrackerDb.ResetCustomerReminderCount(_CustomerID, _HasCoffeeInTempOrder);
                if (_HasCoffeeInTempOrder)
                {
                    _GeneralTrackerDb.SetClientCoffeeOnlyIfInfo(_CustomerID);
                }
                // may need to add another check here to handle if they have ordered maintenance stuff.


                switch (rbtnSendConfirm.SelectedValue)
                {
                case "none":
                    break;

                case "postbox":
                    SendDeliveredEmail(_CustomerID, "placed your order in the your post box.");
                    break;

                case "dispatched":
                    SendDeliveredEmail(_CustomerID, "dispatched you order.");
                    break;

                case "done":
                    SendDeliveredEmail(_CustomerID, "delivered your order and it has signed for.");
                    break;

                default:
                    break;
                }
                // destroy the temp table that we used to create this temp orders
                _TempOrdersDAL.KillTempOrdersData();

                ShowResults(_CustomerNameLabel.Text, _CustomerID, _OriginalUsageData);
            }
        }