/// <summary> /// Save new service /// </summary> /// <param name="model">Info model</param> /// <returns>Service id</returns> public int CreateJobWithoutEngineer(ServiceInfoModel model) { Log.File.Info(Msg.GenerateLogMsg("Saving job info...")); var serviceId = Repository.SaveServiceWithoutEngineer(model); return(serviceId); }
/// <summary> /// Execute store procedure 'UpdateJob', which update job info or create new /// </summary> /// <param name="model"> Model of data from pag </param> /// <returns> Return Job ID </returns> public int SaveServiceWithoutEngineer(ServiceInfoModel model) { var result = Query <int>("UpdateJob", parameters: new { model.CustomerId, model.ModelId, model.SerialNumber, model.DateOfPurchase, model.DateOfBookRepairClick, model.RetailerName, model.ProofOfPurchase, model.RetailerReference, model.RetailedInvoiceDate, model.SelectedType, model.FaultDescr, model.UserID, model.EngineerId, model.ClientId, model.ServiceId, model.ClientRef, model.ModelNumber, model.ProductCategory, model.WarrantyFg, model.CustomerType, model.PolicyNumber, StatusID = model.StatusId, model.AgentReferenceNo, @SymptomIRISCode = model.symptomIRISCode, @ConditionIRISCode = model.conditionIRISCode, @RetailerId = model.RetailerId }, commandType: CommandType.StoredProcedure).FirstOrDefault(); return(result); }
public async Task ContractCancelAsyncShouldWorkCorrectlyWithServiceType() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var dbContext = new ApplicationDbContext(options); var serviceInfoRepo = new EfDeletableEntityRepository <ServiceInfo>(dbContext); var simRepo = new EfDeletableEntityRepository <SimCard>(dbContext); var moqServiceNumberService = new Mock <IServiceNumberService>(); var service = new ServiceInfoService( serviceInfoRepo, simRepo, moqServiceNumberService.Object); var orderId = Guid.NewGuid().ToString(); var model = new ServiceInfoModel { IsActive = true, }; var createdServiceInfo = await service.CreateAsync <ServiceInfoModel>(orderId, model, string.Empty); await service.ContractCancelAsync(1, string.Empty); var serviceInfo = await service.GetByIdAsync <ServiceInfoModel>(1); Assert.False(serviceInfo.IsActive); }
public async Task GetByOrderIdAsyncShouldWorkCorrectly() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var dbContext = new ApplicationDbContext(options); var serviceInfoRepo = new EfDeletableEntityRepository <ServiceInfo>(dbContext); var simRepo = new EfDeletableEntityRepository <SimCard>(dbContext); var moqServiceNumberService = new Mock <IServiceNumberService>(); var service = new ServiceInfoService( serviceInfoRepo, simRepo, moqServiceNumberService.Object); var orderId = Guid.NewGuid().ToString(); var model = new ServiceInfoModel(); var createdServiceInfo = await service.CreateAsync <ServiceInfoModel>(orderId, model, string.Empty); var serviceInfo = await service.GetByOrderIdAsync <ServiceInfoModel>(orderId); Assert.Equal(orderId, serviceInfo.OrderId); Assert.Equal(createdServiceInfo.Id, serviceInfo.Id); }
public async Task GetAllByCustomerIdAsyncShouldWorkCorrectlyWithServiceType() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var dbContext = new ApplicationDbContext(options); var serviceInfoRepo = new EfDeletableEntityRepository <ServiceInfo>(dbContext); var simRepo = new EfDeletableEntityRepository <SimCard>(dbContext); var moqServiceNumberService = new Mock <IServiceNumberService>(); var service = new ServiceInfoService( serviceInfoRepo, simRepo, moqServiceNumberService.Object); var customerId = Guid.NewGuid().ToString(); var orderId = Guid.NewGuid().ToString(); var model = new ServiceInfoModel { CustomerId = customerId, IsActive = true, }; var createdServiceInfo = await service.CreateAsync <ServiceInfoModel>(orderId, model, string.Empty); var serviceInfos = await service.GetAllByCustomerIdAsync <ServiceInfoModel>(customerId); Assert.Single(serviceInfos); Assert.Collection( serviceInfos, x => Assert.Equal(customerId, x.CustomerId)); }
public void InitServiceInfo(bool isStarted) { if (ServiceInfoDictionary.ServiceInfoDic.ContainsKey(StrDeviceId)) { ServiceInfoDictionary.ServiceInfoDic[StrDeviceId].DeviceId = StrDeviceId; ServiceInfoDictionary.ServiceInfoDic[StrDeviceId].DeviceName = _name; ServiceInfoDictionary.ServiceInfoDic[StrDeviceId].CommProgramName = _commProgramName; ServiceInfoDictionary.ServiceInfoDic[StrDeviceId].IsStarted = isStarted; ServiceInfoDictionary.ServiceInfoDic[StrDeviceId].IP = _hostIp; ServiceInfoDictionary.ServiceInfoDic[StrDeviceId].Port = _port; ServiceInfoDictionary.ServiceInfoDic[StrDeviceId].ConnId = string.Empty; ServiceInfoDictionary.ServiceInfoDic[StrDeviceId].DeviceType = 1; ServiceInfoDictionary.ServiceInfoDic[StrDeviceId].SpreadModel = SpreadObject; ServiceInfoDictionary.ServiceInfoDic[StrDeviceId].DicConnId = DicConnId; } else { ServiceInfoModel model = new ServiceInfoModel(); model.DeviceId = StrDeviceId; model.DeviceName = _name; model.CommProgramName = _commProgramName; model.IsStarted = isStarted; model.IP = _hostIp; model.Port = _port; model.ConnId = string.Empty; model.DeviceType = 1; model.SpreadModel = SpreadObject; model.DicConnId = DicConnId; ServiceInfoDictionary.ServiceInfoDic.TryAdd(StrDeviceId, model); } }
public int CreateRepeatedJobWithoutEngineer(ServiceInfoModel model) { Log.File.Info(Msg.GenerateLogMsg("Saving job info...")); model.StatusId = 12; var serviceId = Repository.SaveServiceWithoutEngineer(model); serviceId = Repository.UpdateStatusId(serviceId, model.StatusId); return(serviceId); }
internal void RejectJob(ServiceInfoModel model, string notes) { Execute("RejectJob", new { model.ServiceId, model.UserID, notes, Settings.Default.JobClosedTrackingStatus }, commandType: CommandType.StoredProcedure); }
//public void RejectJob(string notes) //{ // Log.File.Info(Msg.GenerateLogMsg("Rejecting the job ...")); // var jobInfo = new ServiceInfoModel(); // jobInfo.InjectFrom(SessionInfo); // jobInfo.ClientId = StoreId; // jobInfo.UserID = UserId; // Repository.RejectJob(jobInfo,notes); //} public void SetStatusID(int serviceid, int statusid, int subStatusId) { Log.File.Info(Msg.GenerateLogMsg("updating the status of the job ...")); var jobInfo = new ServiceInfoModel(); jobInfo.ServiceId = serviceid; jobInfo.SubStatus = subStatusId; jobInfo.StatusId = statusid; Repository.SetStatusID(jobInfo); }
public void SetStatusID(ServiceInfoModel jobInfo) { Execute("SetStatusID", new { jobInfo.ServiceId, jobInfo.StatusId, SubStatusId = jobInfo.SubStatus }, commandType: CommandType.StoredProcedure); // Addadd note and change the status of the job to high cost query }
private void Initialize() { var instances = new List <NettingEngineInstance>(); for (var i = 0; i < _instances.Length; i++) { try { var generator = HttpClientGenerator.HttpClientGenerator.BuildForUrl(_instances[i]) //.WithAdditionalCallsWrapper(new ExceptionHandlerCallsWrapper()) .WithoutRetries() .WithoutCaching() .Create(); var instance = new NettingEngineInstance(i) { AccountSettings = generator.Generate <IAccountSettingsApi>(), Balances = generator.Generate <IBalancesApi>(), DailyInventory = generator.Generate <IDailyInventoryApi>(), InstrumentInventory = generator.Generate <IInstrumentInventoryApi>(), Instruments = generator.Generate <IInstrumentsApi>(), InstrumentSettings = generator.Generate <IInstrumentSettingsApi>(), Inventory = generator.Generate <IInventoryApi>(), OrderBooks = generator.Generate <IOrderBooksApi>(), Settings = generator.Generate <ISettingsApi>(), Trades = generator.Generate <ITradesApi>(), AssetHedgeSettings = generator.Generate <IAssetHedgeSettingsApi>(), Exchanges = generator.Generate <IExchangesApi>(), ServiceInfo = generator.Generate <IServiceInfoApi>(), ExternalInstruments = generator.Generate <IExternalInstrumentsApi>(), HedgeLimitOrders = generator.Generate <IHedgeLimitOrdersApi>() }; ServiceInfoModel serviceInfo = instance.ServiceInfo.GetAsync() .GetAwaiter() .GetResult(); instance.DisplayName = serviceInfo.Name; instances.Add(instance); } catch (Exception exception) { _log.WriteWarning(nameof(Initialize), new { instance = _instances[i] }, "Can not create service instance.", exception); } } _nettingEngineInstances = instances; }
public async Task SetServiceAsActiveAsyncShouldWorkCorrectly() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var dbContext = new ApplicationDbContext(options); var serviceInfoRepo = new EfDeletableEntityRepository <ServiceInfo>(dbContext); var simRepo = new EfDeletableEntityRepository <SimCard>(dbContext); var moqServiceNumberService = new Mock <IServiceNumberService>(); var service = new ServiceInfoService( serviceInfoRepo, simRepo, moqServiceNumberService.Object); var orderId = Guid.NewGuid().ToString(); await simRepo.AddAsync(new SimCard { ICC = "89359032201234567890", }); await simRepo.SaveChangesAsync(); var model = new ServiceInfoModel { ICC = "89359032201234567890", }; var serviceInfo = await service.CreateAsync <ServiceInfoModel>(orderId, model, string.Empty); await service.SetServiceAsActiveAsync(serviceInfo.Id); var serviceInfoForComp = await serviceInfoRepo.All() .FirstOrDefaultAsync(x => x.Id == serviceInfo.Id); var sims = await simRepo.All().ToListAsync(); Assert.True(serviceInfoForComp.IsActive); Assert.Empty(sims); }
public async Task FinishOrderAsyncShouldWorkCorrectly() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var dbContext = new ApplicationDbContext(options); var orderRepo = new EfDeletableEntityRepository <Order>(dbContext); var moqServiceInfoService = new Mock <IServiceInfoService>(); var fackeInfo = new ServiceInfo(); moqServiceInfoService.Setup(x => x.CreateAsync <ServiceInfoModel>(It.IsAny <string>(), It.IsAny <ServiceInfoModel>(), It.IsAny <string>())).Returns(Task.FromResult(fackeInfo)); var moqServiceNumberService = new Mock <IServiceNumberService>(); var service = new OrderService( orderRepo, moqServiceInfoService.Object, moqServiceNumberService.Object); var orderId = Guid.NewGuid().ToString(); await orderRepo.AddAsync(new Order { Id = orderId, Status = Status.ForExecution, }); await orderRepo.SaveChangesAsync(); var model = new ServiceInfoModel { OrderId = orderId, }; await service.FinishOrderAsync <ServiceInfoModel>(model); var order = await orderRepo.All() .FirstOrDefaultAsync(); Assert.Equal(Status.Finished, order.Status); }
public async Task ExistByIdAsyncShouldReturnFalseWhenDoesNotExists() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var dbContext = new ApplicationDbContext(options); var serviceInfoRepo = new EfDeletableEntityRepository <ServiceInfo>(dbContext); var simRepo = new EfDeletableEntityRepository <SimCard>(dbContext); var moqServiceNumberService = new Mock <IServiceNumberService>(); var service = new ServiceInfoService( serviceInfoRepo, simRepo, moqServiceNumberService.Object); var orderId = Guid.NewGuid().ToString(); var model = new ServiceInfoModel(); var createdServiceInfo = await service.CreateAsync <ServiceInfoModel>(orderId, model, string.Empty); Assert.False(await service.ExistByIdAsync(2)); }
public ActionResult WarningContent(string hallNo) { var list = Warning_DAL.GetVirtualMon(hallNo); #region 管理情况 var mang = new ManagementInfoModel(); var total = getVirtualMonDto(list, 1, 1).VALUE; var online = getVirtualMonDto(list, 1, 2).VALUE; mang.TotalNum = total.ToInt(); mang.OnlineNum = online.ToInt(); mang.OpenRate = total == 0 ? 0 : online / total; mang.HandleNum = getVirtualMonDto(list, 1, 3).VALUE.ToInt(); mang.HandleRate = total == 0 ? 0 : getVirtualMonDto(list, 1, 3).VALUE / total; mang.PoliceNum = getVirtualMonDto(list, 1, 4).VALUE.ToInt(); mang.ComplaintsNum = getVirtualMonDto(list, 1, 5).VALUE.ToInt(); mang.SecondaryHandleNum = getVirtualMonDto(list, 1, 6).VALUE.ToInt(); mang.CityNum = getVirtualMonDto(list, 1, 7).VALUE.ToInt(); ViewBag.Management = mang; #endregion #region 大厅排队情况 var que = new QueuingSituationModel(); que.Total = getVirtualMonDto(list, 2, 1).VALUE.ToInt(); que.WaitingNum = getVirtualMonDto(list, 2, 2).VALUE.ToInt(); //等候达标率=(正在等候人次-等候超时人数)/正在等候人次 que.WaitingRate = getVirtualMonDto(list, 2, 2).VALUE == 0 ? 0 : (getVirtualMonDto(list, 2, 2).VALUE - getVirtualMonDto(list, 2, 10).VALUE) / getVirtualMonDto(list, 2, 2).VALUE; //窗口饱和度= 当前等候人数 / 在线窗口数 var p = mang.OnlineNum == 0 ? 0 : getVirtualMonDto(list, 2, 2).VALUE / mang.OnlineNum; que.WindowPate = SaturationEnum.未饱和; if (p > getVirtualMonDto(list, 2, 5).VALUE) { que.WindowPate = SaturationEnum.极度饱和; } else if (p > getVirtualMonDto(list, 2, 4).VALUE) { que.WindowPate = SaturationEnum.非常饱和; } else if (p > getVirtualMonDto(list, 2, 3).VALUE) { que.WindowPate = SaturationEnum.饱和; } //大厅饱和度=总出票数/大厅容量 var hp = getVirtualMonDto(list, 2, 6).VALUE == 0 ? 0 : getVirtualMonDto(list, 2, 1).VALUE / getVirtualMonDto(list, 2, 6).VALUE; que.HallPate = SaturationEnum.未饱和; if (hp > getVirtualMonDto(list, 2, 9).VALUE) { que.HallPate = SaturationEnum.极度饱和; } else if (hp > getVirtualMonDto(list, 2, 8).VALUE) { que.HallPate = SaturationEnum.非常饱和; } else if (hp > getVirtualMonDto(list, 2, 7).VALUE) { que.HallPate = SaturationEnum.饱和; } //等候超时率=等候超时人数/正在等候人次 que.WaitingTimeoutPate = getVirtualMonDto(list, 2, 2).VALUE == 0 ? 0 : getVirtualMonDto(list, 2, 10).VALUE / getVirtualMonDto(list, 2, 2).VALUE; //等待超时人次预警 que.WaitingTimeout = AlarmLevelEnum.正常; var a = getVirtualMonDto(list, 2, 13).VALUE; if (que.WaitingTimeoutPate > a) { que.WaitingTimeout = AlarmLevelEnum.红色预警; } else if (que.WaitingTimeoutPate > getVirtualMonDto(list, 2, 12).VALUE) { que.WaitingTimeout = AlarmLevelEnum.橙色预警; } else if (que.WaitingTimeoutPate > getVirtualMonDto(list, 2, 11).VALUE) { que.WaitingTimeout = AlarmLevelEnum.黄色预警; } //平均等候时间=总等候时间/正在等候人次 que.AverageTime = (getVirtualMonDto(list, 2, 2).VALUE == 0 ? 0 : getVirtualMonDto(list, 2, 14).VALUE / getVirtualMonDto(list, 2, 2).VALUE).ToInt(); ViewBag.QueuingSituation = que; #endregion #region 务情况 var service = new ServiceInfoModel(); service.AcceptedNum = getVirtualMonDto(list, 3, 1).VALUE.ToInt(); service.OnServiceNum = getVirtualMonDto(list, 3, 2).VALUE.ToInt(); //超时办结率= 超时业务笔数/已受理业务笔数 service.TimeoutRate = getVirtualMonDto(list, 3, 2).VALUE == 0 ? 0 : getVirtualMonDto(list, 3, 3).VALUE / getVirtualMonDto(list, 3, 2).VALUE; //超时办结率= 超时业务笔数/已受理业务笔数 service.OnTimeRate = getVirtualMonDto(list, 3, 2).VALUE == 0 ? 0 : (getVirtualMonDto(list, 3, 2).VALUE - getVirtualMonDto(list, 3, 3).VALUE) / getVirtualMonDto(list, 3, 2).VALUE; service.TimeoutServiceWarning = AlarmLevelEnum.正常; if (getVirtualMonDto(list, 3, 3).VALUE > getVirtualMonDto(list, 3, 11).VALUE) { service.TimeoutServiceWarning = AlarmLevelEnum.红色预警; } else if (getVirtualMonDto(list, 3, 3).VALUE > getVirtualMonDto(list, 3, 10).VALUE) { service.TimeoutServiceWarning = AlarmLevelEnum.橙色预警; } else if (getVirtualMonDto(list, 3, 3).VALUE > getVirtualMonDto(list, 3, 9).VALUE) { service.TimeoutServiceWarning = AlarmLevelEnum.黄色预警; } service.LeaveNum = getVirtualMonDto(list, 3, 12).VALUE.ToInt(); //总呼叫号数/弃号数 service.LeaveRate = getVirtualMonDto(list, 2, 1).VALUE == 0 ? 0 : getVirtualMonDto(list, 3, 12).VALUE / getVirtualMonDto(list, 2, 1).VALUE; service.LeaveWarning = AlarmLevelEnum.正常; if (service.LeaveRate > getVirtualMonDto(list, 3, 16).VALUE) { service.LeaveWarning = AlarmLevelEnum.红色预警; } else if (service.LeaveRate > getVirtualMonDto(list, 3, 15).VALUE) { service.LeaveWarning = AlarmLevelEnum.橙色预警; } else if (service.LeaveRate > getVirtualMonDto(list, 3, 14).VALUE) { service.LeaveWarning = AlarmLevelEnum.黄色预警; } service.OneMoreServiceNum = getVirtualMonDto(list, 3, 17).VALUE.ToInt(); ViewBag.Service = service; #endregion #region 纳税人评价情况 var ev = new EvaluationInfoModel(); ev.Total = getVirtualMonDto(list, 4, 1).VALUE.ToInt(); ev.UnTotal = getVirtualMonDto(list, 4, 2).VALUE.ToInt(); ev.PoorNum = getVirtualMonDto(list, 4, 3).VALUE.ToInt(); //未评价率=未评价总数/(评价总数+未评价总数) var tt = (getVirtualMonDto(list, 4, 2).VALUE + getVirtualMonDto(list, 4, 1).VALUE); ev.UnEvaluationRate = tt == 0 ? 0 : getVirtualMonDto(list, 4, 2).VALUE / tt; //满意率=(评价总数-差评数)/评价总数 ev.SatisfactionRate = getVirtualMonDto(list, 4, 1).VALUE == 0 ? 0 : (getVirtualMonDto(list, 4, 1).VALUE - getVirtualMonDto(list, 4, 3).VALUE) / getVirtualMonDto(list, 4, 1).VALUE; //差评率=差评数/评价总数 ev.BadRate = getVirtualMonDto(list, 4, 1).VALUE == 0 ? 0 : getVirtualMonDto(list, 4, 3).VALUE / getVirtualMonDto(list, 4, 1).VALUE; ev.BadWarning = AlarmLevelEnum.正常; if (getVirtualMonDto(list, 4, 3).VALUE > getVirtualMonDto(list, 4, 6).VALUE) { ev.BadWarning = AlarmLevelEnum.红色预警; } else if (getVirtualMonDto(list, 4, 3).VALUE > getVirtualMonDto(list, 4, 5).VALUE) { ev.BadWarning = AlarmLevelEnum.橙色预警; } else if (getVirtualMonDto(list, 4, 3).VALUE > getVirtualMonDto(list, 4, 4).VALUE) { ev.BadWarning = AlarmLevelEnum.黄色预警; } ViewBag.EvaluationSituation = ev; #endregion return(View()); }