Esempio n. 1
0
        ContactsUpdated CheckNoneCoffeeCustomer(ContactType pCustomer, ContactsUpdated pContact)
        {
            // customer is a none coffee customer check if this is correct
            ClientUsageLinesTbl _LatestUsageData = new ClientUsageLinesTbl();
            ItemUsageTbl        _LatestItemData  = new ItemUsageTbl();
            // the client is set to not have coffee tracked but has taken coffee check if they have taken anything else
            List <ItemUsageTbl> _LatestCoffeeItems = _LatestItemData.GetLastItemsUsed(pCustomer.CustomerID, TrackerTools.CONST_SERVTYPECOFFEE);

            _LatestItemData = _LatestItemData.GetLastMaintenanceItem(pCustomer.CustomerID);
            if (_LatestCoffeeItems.Count > 0)
            { // they ordered coffee from us but are marked as a none coffee client
                DateTime _InstallDate = _LatestUsageData.GetCustomerInstallDate(pCustomer.CustomerID);
                if (_LatestUsageData.LineDate >= _InstallDate)
                {
                    // there is only coffee for the installation date
                    if (_LatestItemData == null)
                    {
                        pContact.ContactTypeID = CustomerTypeTbl.CONST_INFO_ONLY; // they have no coffee or maint items so they are info only
                    }
                }
                else
                {
                    // they have take coffee past the install date
                    if (_LatestItemData == null)
                    {
                        pContact.ContactTypeID = CustomerTypeTbl.CONST_COFFEE_ONLY; // they have no maint items so they are coffee only
                    }
                }
                // else they should be set correctly
            }
            else
            {
                if (_LatestItemData == null)
                {
                    pContact.ContactTypeID = CustomerTypeTbl.CONST_INFO_ONLY; // they have no coffee or main items so they are info only
                }
            }

            _LatestCoffeeItems.Clear();
            return(pContact);
        }
Esempio n. 2
0
        ContactsUpdated CheckCoffeeCustomerIsOne(ContactType pCustomer, ContactsUpdated pContact)
        {
            // if the customer type is set not to be reminded about coffee
            ClientUsageLinesTbl _LatestUsageData = new ClientUsageLinesTbl();
            ItemUsageTbl        _LatestItemData  = new ItemUsageTbl();
            DateTime            _InstallDate     = DateTime.MinValue;

            _LatestUsageData = _LatestUsageData.GetLatestUsageData(pCustomer.CustomerID, TrackerDotNet.classes.TrackerTools.CONST_SERVTYPECOFFEE);
            if (_LatestUsageData != null)
            {
                _InstallDate = _LatestUsageData.GetCustomerInstallDate(pCustomer.CustomerID);
                if (_LatestUsageData.LineDate <= _InstallDate)
                {
                    // they have not ordered since the first time, so are they a service client?
                    _LatestItemData = _LatestItemData.GetLastMaintenanceItem(pCustomer.CustomerID);
                    if (_LatestItemData == null)
                    { // they have not ordered since the first order so set prediction to disabled
                        pContact.ContactTypeID      = CustomerTypeTbl.CONST_INFO_ONLY;
                        pContact.PredictionDisabled = true;
                    }
                    else // they have ordered other stuff from us but not coffee
                    {
                        pContact.ContactTypeID = CustomerTypeTbl.CONST_SERVICE_ONLY; // set it to the first time of service ony client
                    }
                }
                else
                {
                    // they have ordered coffee have they ordered anything else, and they have been a client for long enough?
                    if (_InstallDate.AddMonths(CONST_MINMONTHS) <= _LatestUsageData.LineDate)
                    {
                        // we have a client that has been ordering for a while if they have not ordered maint stuff then sert them as coffee only or green only
                        _LatestItemData = _LatestItemData.GetLastMaintenanceItem(pCustomer.CustomerID);
                        if (_LatestItemData == null)
                        {
                            pContact.ContactTypeID = CustomerTypeTbl.CONST_COFFEE_ONLY;
                        }
                        else
                        { // they have ordered other stuff if they are set to coffee only set them to something else
                            if (pContact.ContactTypeID == CustomerTypeTbl.CONST_COFFEE_ONLY)
                            {
                                pContact.ContactTypeID = CustomerTypeTbl.CONST_COFFEEANDMAINT; // not they will be reminded of maintenance too
                            }
                        }
                    }
                    else
                    {
                    }
                }
            }
            else
            {
                // they have no coffee in thier list are they a none coffee client?
                _LatestItemData = _LatestItemData.GetLastMaintenanceItem(pCustomer.CustomerID);
                if (_LatestItemData != null)
                {
                    // they have ordered maitenance stuff but not coffee stuff before
                    pContact.ContactTypeID = CustomerTypeTbl.CONST_SERVICE_ONLY; // set it to the first time of service ony client
                }
                else
                {
                    pContact.ContactTypeID = CustomerTypeTbl.CONST_INFO_ONLY; // nothing has been ordered so set as prediction
                }
            }
            return(pContact);
            //_ColsStream.WriteLine("CheckCoffeeCustomerIsOne: 16");
        }