Esempio n. 1
0
        /// <summary>
        /// Получение перечня упаковочных работ.
        /// </summary>
        public ArrayList GetPackingWorks()
        {
            ArrayList PackingWorksList = new ArrayList();

            // Если прибор гарантийный и гарантия не аннулирована, не включаем стоимость упаковки в калькуляцию
            if ((this.WarrantyRepair) && (!this.VoidWarranty))
            {
                return(PackingWorksList);
            }

            string BlockName           = "";
            string BlockNameID         = "";
            string WorksType           = "Упаковка и накладные расходы";
            string WorksTypeID         = ServicesCard.GetItemID(ApplicationCard.UniversalCard, WorksType);
            int    Amount              = 1;
            bool   Improvement         = false;
            bool   VoidWarranty        = this.VoidWarranty;
            bool   DoubleCost          = false;
            string DescriptionOfReason = this.DescriptionOfReason;
            bool   RefusalToRepair     = this.RefusalToRepair;

            CalculationItem NewItem = new CalculationItem(Card, DeviceName, DeviceItemID, BlockName, BlockNameID, WorksType, WorksTypeID, Improvement, Amount, true, VoidWarranty, DoubleCost,
                                                          DescriptionOfReason, RefusalToRepair);

            PackingWorksList.Add(NewItem);

            return(PackingWorksList);
        }
Esempio n. 2
0
        public async Task <ServicesCardResponse> SaveAsync(ServicesCard servicesServicesCard)
        {
            try
            {
                await servicesServicesCardRepository.AddAsync(servicesServicesCard);

                await unitOfWork.CompleteAsync();

                return(new ServicesCardResponse(servicesServicesCard));
            }
            catch (Exception ex)
            {
                return(new ServicesCardResponse($"Ошибка при сохранении Услуги: {ex.Message}"));
            }
        }
Esempio n. 3
0
        public async Task <ServicesCardResponse> UpdateAsync(int id, ServicesCard servicesServicesCard)
        {
            var existingServicesCard = await servicesServicesCardRepository.FindByIdAsync(id);

            if (existingServicesCard == null)
            {
                return(new ServicesCardResponse("Услуга не найдена!"));
            }

            existingServicesCard.Name = servicesServicesCard.Name;

            try
            {
                servicesServicesCardRepository.Update(existingServicesCard);
                await unitOfWork.CompleteAsync();

                return(new ServicesCardResponse(existingServicesCard));
            }
            catch (Exception ex)
            {
                return(new ServicesCardResponse($"Ошибка при обновлении Услуги: {ex.Message}"));
            }
        }
Esempio n. 4
0
 public ServicesCardResponse(bool success, string message, ServicesCard servicesCard) : base(success, message)
 {
     ServicesCard = servicesCard;
 }
Esempio n. 5
0
 public ServicesCardResponse(ServicesCard servicesCard) : this(true, string.Empty, servicesCard)
 {
 }
 public void Update(ServicesCard servicesServicesCard)
 {
     context.ServicesCard.Update(servicesServicesCard);
 }
 public void Remove(ServicesCard servicesServicesCard)
 {
     context.ServicesCard.Remove(servicesServicesCard);
 }
 public async Task AddAsync(ServicesCard servicesServicesCard)
 {
     await context.ServicesCard.AddAsync(servicesServicesCard);
 }
Esempio n. 9
0
        /// <summary>
        /// Получение перечня калибровочных работ.
        /// </summary>
        public ArrayList GetCalibrateWorks()
        {
            ArrayList CalibrateWorksList = new ArrayList();

            // Если прибор гарантийный и гарантия не аннулирована, не включаем калибровку в калькуляцию
            if ((this.WarrantyRepair) && (!this.VoidWarranty))
            {
                return(CalibrateWorksList);
            }

            /* Калибровка прибора */
            string WorkName = "";

            if (this.OnlyAccessories)
            {
                WorkName = "Диагностика комплектующих";
            }
            else
            {
                WorkName = "Калибровка " + this.DeviceType;
                if (this.GetAge() > 10)
                {
                    WorkName = WorkName + " (старше 10 лет)";
                }
            }

            string CalibWorkID         = ServicesCard.GetItemID(ApplicationCard.UniversalCard, WorkName);
            string BlockName           = "";
            string BlockNameID         = "";
            string WorksType           = WorkName;
            string WorksTypeID         = CalibWorkID;
            int    Amount              = 1;
            bool   Improvement         = false;
            bool   VoidWarranty        = this.VoidWarranty;
            bool   DoubleCost          = false;
            string DescriptionOfReason = this.DescriptionOfReason;
            bool   RefusalToRepair     = this.RefusalToRepair;

            CalculationItem NewItem = new CalculationItem(Card, DeviceName, DevicePassportID, BlockName, BlockNameID, WorksType, WorksTypeID, Improvement, Amount, true, VoidWarranty, DoubleCost,
                                                          DescriptionOfReason, RefusalToRepair);

            CalibrateWorksList.Add(NewItem);

            /* Калибровочные работы для дополнительных изделий */
            foreach (AdditionalWare CurrentWare in AdditionalWaresList)
            {
                WorkName = "Калибровка " + CurrentWare.TypeName;
                if (CurrentWare.GetAge() > 10)
                {
                    WorkName = WorkName + " (старше 10 лет)";
                }
                CalibWorkID = ServicesCard.GetItemID(ApplicationCard.UniversalCard, WorkName);

                string WaresBlockName           = "";
                string WaresBlockNameID         = "";
                string WaresWorksType           = WorkName;
                string WaresWorksTypeID         = CalibWorkID;
                int    WaresWorkAmount          = 1;
                bool   WaresImprovement         = false;
                bool   WaresVoidWarranty        = this.VoidWarranty;
                bool   WaresDoubleCost          = false;
                string WaresDescriptionOfReason = this.DescriptionOfReason;
                bool   WaresRefusalToRepair     = this.RefusalToRepair;

                CalculationItem NewWaresItem = new CalculationItem(Card, DeviceName, DevicePassportID, WaresBlockName, WaresBlockNameID, WaresWorksType, WaresWorksTypeID, WaresImprovement, WaresWorkAmount,
                                                                   true, WaresVoidWarranty, WaresDoubleCost, WaresDescriptionOfReason, WaresRefusalToRepair);
                CalibrateWorksList.Add(NewWaresItem);
            }
            return(CalibrateWorksList);
        }