Esempio n. 1
0
    private void Query(int pageIndex)
    {
        try
        {
            var querylist = new RepairService().SearchRepairInfo(this.loggingSessionInfo
                                                                 , CurrentQueryCondition.unit_ids
                                                                 , CurrentQueryCondition.status
                                                                 , CurrentQueryCondition.repair_date_begin
                                                                 , CurrentQueryCondition.repair_date_end
                                                                 , SplitPageControl1.PageSize
                                                                 , pageIndex * SplitPageControl1.PageSize
                                                                 );

            SplitPageControl1.RecoedCount = querylist.icount;
            SplitPageControl1.PageIndex   = pageIndex;
            //验证查询当前页索引是否在记录总数范围内。
            if (SplitPageControl1.PageIndex != pageIndex)
            {
                Query(SplitPageControl1.PageIndex);
                return;
            }
            else
            {
                gvInoutBill.DataSource = querylist.repairInfoList;
                gvInoutBill.DataBind();
            }
        }
        catch (Exception ex)
        {
            PageLog.Current.Write(ex);
            this.InfoBox.ShowPopError("加载数据出错!");
        }
    }
Esempio n. 2
0
        public void Add_New_Note_To_Repair()
        {
            var repairContextMock = new Mock <DB.Interface.IDatabaseService>();

            repairContextMock.Setup(x => x.Repairs).Returns(repairsMock.Object);
            repairContextMock.Setup(x => x.Cars).Returns(carsMock.Object);
            repairContextMock.Setup(x => x.RepairNotes).Returns(emptyRepairNotesMock.Object);

            RepairService repairService = new RepairService(repairContextMock.Object);

            repairService.AddNote(new BL.Repair.DTO.RepairDTO
            {
                Id    = 1,
                Notes = new List <RepairNoteDTO> {
                    new RepairNoteDTO {
                        Description = "Uzyto oleju 5W40 Valvoline"
                    }
                },
                Date = DateTime.Parse("10.08.2018 15:53:00")
            });
            try
            {
                emptyRepairNotesMock.Verify(m => m.Add(It.IsAny <RepairNotes>()), Times.AtLeastOnce());
                repairContextMock.Verify(m => m.Save(), Times.AtLeastOnce());
                Assert.IsTrue(true);
            }
            catch (Exception e)
            {
                Assert.IsTrue(false);
            }
        }
        public ActionResult UpdateRepair(Repair repair)
        {
            repair.OwnerId = (Session["Account"] as AccountInfo).Id;
            var repairService = new RepairService();

            return(Json(repairService.UpdateByOwner(repair)));
        }
Esempio n. 4
0
        /// <summary>
        /// 一键上传信息保存
        /// </summary>
        /// <param name="Customer_Id">客户标识</param>
        /// <param name="Unit_Id">组织标识</param>
        /// <param name="User_Id">用户标识</param>
        /// <param name="repairInfoList">一键报修信息集合</param>
        /// <returns></returns>
        public bool SetRepairInfo(string Customer_Id, string Unit_Id, string User_Id, IList <RepairInfo> repairInfoList)
        {
            string strError = string.Empty;

            try
            {
                LoggingSessionInfo loggingSessionInfo = GetLoggingSessionInfo(Customer_Id, User_Id, Unit_Id);
                RepairService      repairService      = new RepairService();

                bool bReturn = repairService.SetRepairInfo(loggingSessionInfo, repairInfoList, out strError);
                if (bReturn)
                {
                    return(bReturn);
                }
                else
                {
                    throw new Exception(string.Format(strError, strError));
                }
            }
            catch (Exception ex)
            {
                strError = ex.ToString();
                throw (ex);
            }
        }
        public ActionResult DeleteRepairs(int[] ids)
        {
            var repairService = new RepairService();
            var ownerId       = (Session["Account"] as AccountInfo).Id;

            return(Json(repairService.DeleteByOwner(ids, ownerId)));
        }
Esempio n. 6
0
        //accept repair
        //check repair status by SMNE

        public RepairOrder CheckStatus(string searchString)
        {
            RepairService rs     = new RepairService();
            var           result = rs.GetRepairOrder(searchString);

            return(result);
        }
        public RepairServiceTests()
        {
            _unitOfWork = new UnitOfWorkMock();

            _vehicleService = new VehicleService(_unitOfWork);
            _repairService  = new RepairService(_unitOfWork, _vehicleService);
        }
Esempio n. 8
0
        /// <summary>
        /// 获取所有页面的头部导航菜单
        /// </summary>
        /// <returns></returns>
        public ActionResult GetHeader()
        {
            var account = Session["Account"] as AccountInfo;

            if (account != null)
            {
                if (account.IsAdmin)
                {
                    var repairService = new RepairService();
                    ViewData["RepairUnFinishCount"] = repairService.GetUnFinishCount();

                    var adviceService = new AdviceService();
                    ViewData["AdviceUnReplyCount"] = adviceService.GetUnReplyCount();
                }
                else
                {
                    var feeService = new FeeService();
                    ViewData["FeeUnFinishCount"] = feeService.GetUnFinishCountForOwner(account.Id);

                    var announService = new AnnouncementService();
                    ViewData["AnnounUnReadCount"] = announService.GetUnReadCountForOwner(account.Id);

                    var ownerService = new OwnerService();
                    ViewData["NewReplyCount"] = ownerService.GetNewReplyCount(account.Id);
                }
            }
            return(PartialView("Header"));
        }
Esempio n. 9
0
        public void Update_Note()
        {
            var repairContextMock = new Mock <DB.Interface.IDatabaseService>();

            repairContextMock.Setup(x => x.Repairs).Returns(repairsMock.Object);
            repairContextMock.Setup(x => x.Cars).Returns(carsMock.Object);
            repairContextMock.Setup(x => x.RepairNotes).Returns(repairNotesMock.Object);

            var repairService = new RepairService(repairContextMock.Object);

            repairService.UpdateNote(new BL.Repair.DTO.RepairDTO
            {
                Id    = 1,
                CarId = 2,
                Date  = DateTime.Parse("10.08.2018 15:53:00"),
                Name  = "Olejek",
                updatedRepairNoteId = 1,
                Notes = new List <RepairNoteDTO> {
                    new RepairNoteDTO {
                        Id = 1, Description = "Uzyto oleju 5W40 Valvoline"
                    }
                }
            });
            try
            {
                // repairNotesMock.Verify(m => m.Add(It.IsAny<RepairNotes>()), Times.AtLeastOnce);
                repairContextMock.Verify(m => m.Save(), Times.AtLeastOnce());
                Assert.IsTrue(true);
            }
            catch (Exception e)
            {
                Assert.IsTrue(false);
            }
        }
        public ActionResult AddRepair(Repair repair)
        {
            repair.OwnerId   = (Session["Account"] as AccountInfo).Id;
            repair.ApplyDate = DateTime.Now.Date;
            var repairService = new RepairService();

            return(Json(repairService.Add(repair)));
        }
Esempio n. 11
0
        public void Read_All_Repairs_For_Selected_Car()
        {
            var repairContextMock = new Mock <DB.Interface.IDatabaseService>();

            repairContextMock.Setup(x => x.Repairs).Returns(repairsMock.Object);
            repairContextMock.Setup(x => x.Cars).Returns(carsMock.Object);
            var repairService = new RepairService(repairContextMock.Object);
            var carRepairs    = repairService.GetAllByCarId(3);

            Assert.IsTrue(carRepairs.Count == 2);
        }
        public static void Main(string[] args)
        {
            RepairService x = new RepairService();

            //x.GetAllRepairOrders();

            x.CreateRepairOrder(new Fibrella.Core.Data.RepairOrder {
                ReceiptDate  = DateTime.Now.Date,
                CustomerName = "Kangkong Service Test"
            });
        }
Esempio n. 13
0
        public void Read_All_Repairs()
        {
            var repairContextMock = new Mock <DB.Interface.IDatabaseService>();

            repairContextMock.Setup(x => x.Repairs).Returns(repairsMock.Object);

            var repairService = new RepairService(repairContextMock.Object);
            var repairs       = repairService.GetAll();

            Assert.IsTrue(repairs.Count == 3);
        }
Esempio n. 14
0
        // DELETE: api/Repair/5
        public IHttpActionResult Delete(int id)
        {
            bool result = new RepairService().Remove(id);

            if (result)
            {
                return(Ok());
            }
            else
            {
                return(Conflict());
            }
        }
Esempio n. 15
0
        public void SetSessionWorker()
        {
            IndexUrl = AppConfig.Domain + "/Wei/WorkerIndex.aspx";

            var wkr = OrgService.GetService().GetWorkerByWei(UserOpenId);

            WorkerInfo = wkr;
            UserNo     = wkr.WkrCode;
            UserName   = wkr.WkrName;
            UserType   = "Worker";

            var rprTypeMap = RepairService.GetService().GetRprWkrTypeMapList(wkr.WkrCode).Select(s => s.RprType).ToList();
            var bulidMap   = RepairService.GetService().GetRprWkrBuildMapList(wkr.WkrCode).Select(s => s.BId).ToList();

            UserDataLimit = (rprTypeMap.Count == 0 ? "NULL" : string.Join(",", rprTypeMap))
                            + "&"
                            + (bulidMap.Count == 0 ? "NULL" : string.Join(",", bulidMap));
        }
Esempio n. 16
0
        static void Main(string[] args)
        {
            // instantiate the delegate
            //         vvv
            // Target Method tied to the delegate
            //NotifyDel notifyDel = new NotifyDel(EmailService.SendEmail);
            //Action notifyDel = new Action(EmailService.SendEmail);

            // C# offers predefined delegates like Action(delegate of type void), func(delegate that have a return type)

            // Types of Delegates:
            //      Single cast delegate - a delegate which is tied to a method
            //      Multicast delegate - a delegate tied to more than one method
            //notifyDel += TextService.SendText; // subscribing the methods to make multicast delegate
            // delegates maintains an invocation list that contains reference to all subscribed methods
            // Invoke the delegate
            //  notifyDel();
            //notifyDel.Invoke();

            //Console.WriteLine("----------Using Func Delegate------------");
            //     vvv    vvv
            //input parameter ,Return value
            // Func<double,double> area = new Func<double,double>(CircleArea);
            // Console.WriteLine($"Area of circle is { area.Invoke(4.5)}");
            // Predicate - a delegate of type bool
            // Predicate pDel= new Predicate(target function);

            RepairService repairService = new RepairService();// publisher

            Laptop laptop1 = new Laptop()
            {
                ServiceTag = "2S3S5T1"
            };

            repairService.Repaired += EmailService.SendEmail;                       // subscriber 1

            repairService.Repaired += TextService.SendText;                         //subscriber 2

            repairService.Repaired += PushNotificationService.SendPushNotification; // subscriber 3

            repairService.Repaired -= TextService.SendText;                         // unsubscribe

            repairService.Repair(laptop1);
        }
Esempio n. 17
0
        public void InitializeTests()
        {
            if (_repairService == null)
            {
                var dbContextOptions = new DbContextOptionsBuilder <CarMechanicContext>().UseInMemoryDatabase("testDB")
                                       .Options;
                _carMechanicContext = new CarMechanicContext(dbContextOptions);
                _carMechanicContext.Database.EnsureCreated();

                var mappingConfig = new MapperConfiguration(conf => { conf.AddProfile <CarMechanicMapper>(); });
                _mapper        = mappingConfig.CreateMapper();
                _repairService = new RepairService(_mapper, _carMechanicContext);

                var testCar  = TestConstants.GetTestCar(typeName: "BMW", model: "E46 320i", engineSerial: "N90", licensePlate: "asd123");
                var testUser = TestConstants.GetTestUser(name: "Teszt Felhasznalo", email: "*****@*****.**", phoneNumber: "456789");
                initialTestRepair     = TestConstants.GetTestRepair(price: 1000000, paid: false, status: Status.WaitingForParts, works: "Turbo Charger change");
                testCar.User          = testUser;
                testUser.Car          = testCar;
                testCar.Repair        = initialTestRepair;
                initialTestRepair.Car = testCar;

                _carMechanicContext.Repairs.Add(initialTestRepair);
                _carMechanicContext.StatusEntities.Add(new StatusEntity()
                {
                    Status = Status.Finished
                });
                _carMechanicContext.StatusEntities.Add(new StatusEntity()
                {
                    Status = Status.AddedForService
                });
                _carMechanicContext.StatusEntities.Add(new StatusEntity()
                {
                    Status = Status.WaitingForParts
                });
                _carMechanicContext.StatusEntities.Add(new StatusEntity()
                {
                    Status = Status.WorkingOnCarNow
                });

                _carMechanicContext.SaveChanges();
            }
        }
Esempio n. 18
0
    // Should move this to another class
    private void AddServices(GameObject gameObject)
    {
        var services = aiData.GetServices();

        // Give all Npc's persuasion
        PersuasionService.Create(gameObject);

        foreach (var service in services)
        {
            switch (service)
            {
            case Service.Barter:
                BarterService.Create(gameObject);
                break;

            case Service.Enchanting:
                EnchantingService.Create(gameObject);
                break;

            case Service.Repair:
                RepairService.Create(gameObject);
                break;

            case Service.Spellmaking:
                SpellmakingService.Create(gameObject);
                break;

            case Service.Spells:
                SpellService.Create(gameObject);
                break;

            case Service.Training:
                TrainingService.Create(gameObject);
                break;
            }
        }

        if (destinationData != null && destinationData.Count > 0)
        {
            TravelService.Create(gameObject);
        }
    }
        public ActionResult GetRepairPage(int page = 1, int pageSize = 10, string beginDate = "", string endDate = "", int isFinish = 2)
        {
            var repairService = new RepairService();

            var where = PredicateBuilder.True <Repair>();

            var ownerId = (Session["Account"] as AccountInfo).Id;

            where = where.And(f => f.OwnerId == ownerId);

            if (!string.IsNullOrEmpty(beginDate))
            {
                DateTime begin;
                if (DateTime.TryParse(beginDate, out begin))
                {
                    where = where.And(f => f.ApplyDate >= begin);
                }
            }

            if (!string.IsNullOrEmpty(endDate))
            {
                DateTime end;
                if (DateTime.TryParse(endDate, out end))
                {
                    where = where.And(f => f.ApplyDate <= end);
                }
            }

            if (isFinish == 1)
            {
                where = where.And(f => f.FinishDate != null);
            }
            else if (isFinish == 0)
            {
                where = where.And(f => f.FinishDate == null);
            }

            return(Json(repairService.QueryToPageByOwner(where, page, pageSize)));
        }
Esempio n. 20
0
        public async Task CreateAsyncShouldCreateRepairWithValidData()
        {
            //Arrange
            var RepairRepository = this.GetConfiguredRepairRepository(new List <Repair>());
            var carRepoaitory    = this.GetConfiguredCarRepository();
            var repairService    = new RepairService(RepairRepository.Object, carRepoaitory.Object);

            //Act
            var result = await repairService.CreateAsync(
                SampleCarId,
                SampleRepairDescription,
                SampleRepairHours,
                SampleRepairPricePerHour,
                SampleEmployeeId);

            //Arrange
            var newRepair = RepairRepository.Object.All();

            result
            .Should()
            .NotBeNull();

            newRepair
            .Count()
            .Should()
            .BePositive();

            newRepair
            .First()
            .Should()
            .Match <Repair>(repair => repair.Description == SampleRepairDescription)
            .And
            .Match <Repair>(repair => repair.Hours == SampleRepairHours)
            .And
            .Match <Repair>(repair => repair.PricePerHour == SampleRepairPricePerHour)
            .And
            .Match <Repair>(repair => repair.ServiceId == SampleCarServiceId);
        }
 public override void DoEffect(Pawn usedBy)
 {
     RepairService.Repair(usedBy);
 }
Esempio n. 22
0
 public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List <Thing> ingredients, Bill bill)
 {
     RepairService.Repair(pawn);
 }
Esempio n. 23
0
        public void UpdateRepair([FromBody] RepairViewModel model)
        {
            RepairService repairService = new RepairService();

            repairService.UpdateRepair(model);
        }
Esempio n. 24
0
 public RepairController(RepairService repairService, IMapper mapper)
 {
     _mapper        = mapper;
     _repairService = repairService;
 }
Esempio n. 25
0
 public IActionResult Post()
 {
     RepairService.Work();
     return(Ok("Work was successfully done"));
 }
Esempio n. 26
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="repairService"></param>
 public RepairController(RepairService repairService, IHttpContextAccessor httpContext)
 {
     _repairService = repairService;
     _httpContext   = httpContext;
 }