Example #1
0
        public NewService_ViewModel()
        {
            if (!this.IsInDesignMode)
            {
                AppMessages.CustomerToSelect.Register(this, c =>
                {
                    _customerID = c.id;

                    if (c.defaultDiscount != null)
                    {
                        discount = (float)c.defaultDiscount * 100;
                    }
                    else
                    {
                        discount = 0;
                    }
                });
                AppMessages.ServiceWorksheetsChanged.Register(this, rc => GetWorksheetIDNumber());
                hasWarranty = false;
                requestQuot = false;
                //errorType = new ObservableCollection<SQLConnectionLib.ErrorTypes>(SQLConnection.Execute.ErrorTypesTable);
                newService = new WorksheetRepresentation();
                GetWorksheetIDNumber();
            }
            else
            {
                hasWarranty = true;
            }
        }
Example #2
0
        public NewService_ViewModel()
        {
            if (!this.IsInDesignMode)
            {
                AppMessages.CustomerToSelect.Register(this, c =>
                {
                    _customerID = c.id;

                    if (c.defaultDiscount != null)
                    {
                        discount = (float)c.defaultDiscount * 100;
                    }
                    else
                    {
                        discount = 0;
                    }
                });
                AppMessages.ServiceWorksheetsChanged.Register(this, rc => GetWorksheetIDNumber());
                hasWarranty = false;
                requestQuot = false;
                //errorType = new ObservableCollection<SQLConnectionLib.ErrorTypes>(SQLConnection.Execute.ErrorTypesTable);
                newService = new WorksheetRepresentation();
                GetWorksheetIDNumber();
            }
            else
            {
                hasWarranty = true;
            }
        }
        public static WorksheetRepresentation convertWorksheet(ServiceWorksheets worksheet)
        {
            WorksheetRepresentation convertedWorksheet = new WorksheetRepresentation()
            {
                buyDate            = worksheet.buyDate,
                comment            = worksheet.comment,
                customer           = convertCustomer(worksheet.Customers),
                deviceID           = worksheet.deviceID,
                deviceManufacturer = worksheet.deviceManufacturer,
                deviceName         = worksheet.deviceName,
                discount           = worksheet.discount,
                errorType          = (ErrorTypeEnum)worksheet.errorTypeID,
                errorDescription   = worksheet.errorDescription,
                hasWarranty        = worksheet.hasWarranty,
                id             = worksheet.worksheetID,
                inQuotMode     = worksheet.inQuotMode,
                isPaid         = worksheet.isPaid,
                maxCost        = worksheet.maxCost,
                parts          = new List <PartRepresentation>(),
                plusParts      = worksheet.plusParts,
                quotAccepted   = worksheet.quotAccepted,
                quotRequested  = worksheet.quotRequested,
                serialID       = worksheet.serialID,
                serviceCost    = worksheet.serviceCost,
                serviceEnd     = worksheet.serviceEnd,
                serviceStart   = worksheet.serviceStart,
                status         = (ServiceStatusEnum)worksheet.statusID,
                warrantyNumber = worksheet.warrantyNumber,
                yearCounter    = worksheet.yearCounter
            };

            foreach (Parts part in worksheet.Parts)
            {
                convertedWorksheet.parts.Add(convertPart(part));
            }

            return(convertedWorksheet);
        }
        public static WorksheetRepresentation convertWorksheet(ServiceWorksheets worksheet)
        {
            WorksheetRepresentation convertedWorksheet = new WorksheetRepresentation()
            {
                buyDate = worksheet.buyDate,
                comment = worksheet.comment,
                customer = convertCustomer(worksheet.Customers),
                deviceID = worksheet.deviceID,
                deviceManufacturer = worksheet.deviceManufacturer,
                deviceName = worksheet.deviceName,
                discount = worksheet.discount,
                errorType = (ErrorTypeEnum)worksheet.errorTypeID,
                errorDescription = worksheet.errorDescription,
                hasWarranty = worksheet.hasWarranty,
                id = worksheet.worksheetID,
                inQuotMode = worksheet.inQuotMode,
                isPaid = worksheet.isPaid,
                maxCost = worksheet.maxCost,
                parts = new List<PartRepresentation>(),
                plusParts = worksheet.plusParts,
                quotAccepted = worksheet.quotAccepted,
                quotRequested = worksheet.quotRequested,
                serialID = worksheet.serialID,
                serviceCost = worksheet.serviceCost,
                serviceEnd = worksheet.serviceEnd,
                serviceStart = worksheet.serviceStart,
                status = (ServiceStatusEnum)worksheet.statusID,
                warrantyNumber = worksheet.warrantyNumber,
                yearCounter = worksheet.yearCounter
            };

            foreach (Parts part in worksheet.Parts)
            {
                convertedWorksheet.parts.Add(convertPart(part));
            }

            return convertedWorksheet;
        }