예제 #1
0
 public ContactsThayMayNeedData()
 {
     _CustomerData            = new CustomersTbl();
     _RequiresPurchOrder      = false;
     _ClientUsageData         = new ClientUsageTbl();
     _NextRoastDateByCityData = new NextRoastDateByCityTbl();
 }
예제 #2
0
 public CustomersWithDatesAndUsageTbl()
 {
     _Customer            = new CustomersTbl();
     _NextRoastDateByCity = new NextRoastDateByCityTbl();
     _ClientUsage         = new ClientUsageTbl();
 }
예제 #3
0
        public bool HandleAndUpdateRepairStatusChange(RepairsTbl pRepair)
        {
            // send email and handle status change
            bool _Success = true;

            switch (pRepair.RepairStatusID)
            {
            case CONST_REPAIRSTATUS_LOGGED:
            {
                _Success = LogARepair(pRepair, true);
                break;
            }

            case CONST_REPAIRSTATUS_COLLECTED:
            {
                if (pRepair.RelatedOrderID.Equals(0))
                {
                    _Success = LogARepair(pRepair, true);
                }
                else
                {
                    OrderTbl _Order = new OrderTbl();
                    _Order.UpdateIncDeliveryDateBy7(pRepair.RelatedOrderID);
                }
                break;
            }

            case CONST_REPAIRSTATUS_WORKSHOP:
            {
                if (pRepair.RelatedOrderID.Equals(0))
                {
                    _Success = LogARepair(pRepair, false);
                }
                else
                {
                    OrderTbl _Order = new OrderTbl();
                    _Order.UpdateIncDeliveryDateBy7(pRepair.RelatedOrderID);
                }
                if (!String.IsNullOrEmpty(pRepair.MachineSerialNumber))
                {
                    // if we have no serial number in the current Customer Tbl then update
                    CustomersTbl _Customers = new CustomersTbl();
                    _Customers.SetEquipDetailsIfEmpty(pRepair.MachineTypeID, pRepair.MachineSerialNumber, pRepair.CustomerID);
                }
                break;
            }

            case CONST_REPAIRSTATUS_READY:
            {
                if (pRepair.RelatedOrderID > 0)
                {
                    OrderTbl _Order = new OrderTbl();
                    NextRoastDateByCityTbl _NextDates = new NextRoastDateByCityTbl();
                    _Order.UpdateOrderDeliveryDate(_NextDates.GetNextDeliveryDate(pRepair.CustomerID), pRepair.RelatedOrderID);
                }

                break;
            }

            case CONST_REPAIRSTATUS_DONE:
            {
                if (pRepair.RelatedOrderID > 0)
                {
                    OrderTbl _Order = new OrderTbl();
                    _Order.UpdateSetDoneByID(true, pRepair.RelatedOrderID);
                    // ??? should we do this since it interupts with the Preiction Calculations
                }
                break;
            }

            default:
            {
                break;
            }
            }
            _Success = String.IsNullOrEmpty(UpdateRepair(pRepair));

            _Success = _Success && SendStatusChangeEmail(pRepair);

            return(_Success);
        }