示例#1
0
        public string CreateUser(User.User user)
        {
            if (!ValidateIMS.IsValid(user))
            {
                return("Fail. Not right format");
            }

            return(_manager["User"].Add(user));
        }
示例#2
0
        /// <summary>
        /// Validates and adds the entered addon into the addon inventory.
        /// </summary>
        public string Add(Addon addon)
        {
            if (!ValidateIMS.IsValid(addon))
            {
                return("Fail. Not right format");
            }

            _addonId = addon.Id;

            return(_manager["Addon"].Add(addon));
        }
示例#3
0
        /// <summary>
        ///  Validates and adds the entered vehicle into the vehicle inventory.
        /// </summary>
        public string Add(Vehicle vehicle)
        {
            if (!ValidateIMS.IsValid(vehicle))
            {
                return("Fail. Not right format");
            }

            if (_manager["Vehicle"].Contain(vehicle.Id))
            {
                return("Fail. Already exists within system");
            }

            _vehicleId = vehicle.Id;

            return(_manager["Vehicle"].Add(vehicle));
        }
示例#4
0
文件: SaleInstance.cs 项目: mr360/IMS
        public string GetTradeVehicle(Vehicle tradeIn)
        {
            if (!ValidateIMS.IsValid(tradeIn))
            {
                return("Fail. Not right format");
            }

            // Requires an explicit check because the vehicle is not being entered into the database
            // at this moment. It will be added once sale has been processed.
            if (_manager["Vehicle"].Contain(tradeIn.Id))
            {
                return("Fail. Already exists within system");
            }

            _tradeIn = tradeIn;
            return("Success.");
        }
示例#5
0
        public string Prepare()
        {
            if (_periodStart.Year == 1 || _periodEnd.Year == 1 || String.IsNullOrEmpty(_name))
            {
                return("Fail.Need to enter correct values for report building.");
            }

            List <DbObject> lInvoiceList = _manager["Invoice"].RetrieveMany("tax");

            _amountOfSale = lInvoiceList.Count();

            foreach (Tax tInvoice in lInvoiceList)
            {
                if (!ValidateIMS.ValidDateRangeCheck(tInvoice, _periodStart, _periodEnd))
                {
                    continue;
                }
                switch (_reportType)
                {
                case ReportType.Addon:
                    _totalPrice += tInvoice.AddonCost;
                    break;

                case ReportType.Sale:
                    _totalPrice += tInvoice.TotalCost;
                    break;

                case ReportType.TradeIn:
                    _totalPrice += tInvoice.TradeRebateCost;
                    break;
                }
            }

            _report = new Report.InvoiceReport(IdGenerator.UniqueId(), _name, _reportType, _periodStart, _periodEnd);
            _report.TotalSalePrice = _totalPrice;
            _report.AmountOfSale   = _amountOfSale;
            return("Success");
        }