Summary description for CarServicePresentationUtility
Exemplo n.º 1
0
        public static bool ProcessStartRepairDate(string startRepairDateTxt, BulletedList notificationMsgList,
                                                  out DateTime?startRepairDate)
        {
            startRepairDate = null;
            bool validStartRepairDate = string.IsNullOrEmpty(startRepairDateTxt) == false;

            if (validStartRepairDate == false)
            {
                CarServicePresentationUtility.AppendNotificationMsg("Start repair date is required", notificationMsgList);
            }
            else
            {
                DateTime startRepairDateValue = DateTime.Now;
                validStartRepairDate = CarServiceUtility.IsValidDate(startRepairDateTxt, out startRepairDateValue);
                if (validStartRepairDate == true)
                {
                    startRepairDate = startRepairDateValue;
                }
                else
                {
                    CarServicePresentationUtility.AppendNotificationMsg("Start repair date is not in valid format", notificationMsgList);
                }
            }
            return(validStartRepairDate);
        }
Exemplo n.º 2
0
        private static void BindSparePartsLists(List <int> destItemSparePartIds, ListBox srcListBox,
                                                ListBox destListBox, bool srcPriceCalculation, ICarServicePersister persister, out decimal totalPrice)
        {
            totalPrice = 0M;
            IQueryable <SparePart> activeSpareParts = persister.GetActiveSpareParts();
            List <SparePart>       srcSpareParts    = new List <SparePart>();
            List <SparePart>       destSpareParts   = new List <SparePart>();

            foreach (SparePart currSP in activeSpareParts)
            {
                if (destItemSparePartIds.Contains(currSP.PartId))
                {
                    destSpareParts.Add(currSP);
                    if (srcPriceCalculation == false)
                    {
                        totalPrice += currSP.Price;
                    }
                }
                else
                {
                    srcSpareParts.Add(currSP);
                    if (srcPriceCalculation)
                    {
                        totalPrice += currSP.Price;
                    }
                }
            }
            object customSpareParts = CarServicePresentationUtility.GetSparePartsFormatForListBox(srcSpareParts);

            BindListBox(srcListBox, customSpareParts);
            customSpareParts = CarServicePresentationUtility.GetSparePartsFormatForListBox(destSpareParts);
            BindListBox(destListBox, customSpareParts);
        }
Exemplo n.º 3
0
        public static bool IsSparePartItemsValid(ListItemCollection selectedSparePartItems,
                                                 BulletedList notificationMsgList)
        {
            bool validSpareParts = (selectedSparePartItems.Count > 0);

            if (validSpareParts == false)
            {
                CarServicePresentationUtility.AppendNotificationMsg("Spare parts are not selected", notificationMsgList);
            }
            return(validSpareParts);
        }
Exemplo n.º 4
0
        public static bool ProcessRepairPrices(string sparePartsPriceTxt, string repairPriceTxt,
                                               BulletedList notificationMsgList, out decimal sparePartsPrice, out decimal repairPrice)
        {
            sparePartsPrice = 0M;
            repairPrice     = 0M;
            bool validPrices = ValidatePrices(sparePartsPriceTxt, repairPriceTxt,
                                              out sparePartsPrice, out repairPrice);

            if (validPrices == false)
            {
                CarServicePresentationUtility.AppendNotificationMsg("Repair price should be larger than or equal to spare parts price", notificationMsgList);
            }
            return(validPrices);
        }