public void GetRuleTrail(Action <RuleTrailDTO, Exception> action, long policyId, long ruleId, long trailId) { var url = PMSClientConfig.BaseApiAddress + "Policies/" + policyId + "/Rules/" + ruleId + "/Trails/" + trailId; WebClientHelper.Get(new Uri(url, PMSClientConfig.UriKind), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void TestInitialize() { _scope = new UnitOfWorkScope(new EFUnitOfWorkFactory(() => new DataContainer())); basicInfoDomainServiceObjects = new BasicInfoDomainServiceObjectsContainer(_scope); OrderConfigurator orderConfigurator = null; //new OrderConfigurator(new OrderStateFactory(new FuelReportDomainService(new FuelReportRepository(_scope), // new VoyageDomainService( new VoyageRepository(_scope)),new InventoryOperationDomainService(new InventoryOperationRepository(_scope)), // new InventoryOperationRepository(_scope),new InventoryOperationFactory() ),new InvoiceDomainService() )); var client = new WebClientHelper(new HttpClient()); _orderRepository = new OrderRepository(_scope, orderConfigurator, new EFRepository<OrderItem>(_scope)); _orderRepository.GetAll(); _tr = new TransactionScope(); var hostAdapter = new ExternalHostAddressHelper(); _target = new GoodFacadeService( new GoodDomainService( new GoodAntiCorruptionAdapter( new GoodAntiCorruptionServiceWrapper (client, hostAdapter), new GoodAntiCorruptionMapper()), new EFRepository<Good>(_scope), basicInfoDomainServiceObjects.CompanyDomainService, new EFRepository<GoodUnit>(_scope)), new GoodToGoodDtoMapper(new CompanyGoodUnitToGoodUnitDtoMapper())); }
void wc_RequestCompleted(object sender, RequestCompletedEventArgs e) { WebClientHelper wc = sender as WebClientHelper; ContentType = wc.ContentType; dispatcher.BeginInvoke(new Action(() => { GetImageSourceCompletedEventArgs eventArgs; if (e.Error != null) { eventArgs = new GetImageSourceCompletedEventArgs(e.Error, false, this); } else { try { eventArgs = CreateBitmapFromStream(e.Response); } finally { e.Response.Close(); } } GetImageSourceAsyncCallback callback = (GetImageSourceAsyncCallback)e.UserState; callback(this, eventArgs); })); }
/// <summary> /// Posts a RaygunMessage to the Raygun.io api endpoint. /// </summary> /// <param name="raygunMessage">The RaygunMessage to send. This needs its OccurredOn property /// set to a valid DateTime and as much of the Details property as is available.</param> public override void Send(RaygunMessage raygunMessage) { try { bool canSend = OnSendingMessage(raygunMessage) && CanSend(raygunMessage); if (canSend) { var message = SimpleJson.SerializeObject(raygunMessage); WebClientHelper.Send(message, _apiKey, ProxyCredentials); } } catch (Exception ex) { try { System.Diagnostics.Trace.WriteLine(string.Format("Error Logging Exception to Raygun.io {0}", ex.Message)); } catch { // ignored } if (RaygunSettings.Settings.ThrowOnError) { throw; } } }
public ActionResult Create(ScheduledJobViewModel vm) { if (ModelState.IsValid) { var jobInfo = new JobInfoModel { JobType = "Scheduled", CronExpression = vm.CronExpression, Url = vm.Url }; var newScheduledJob = new ScheduledJob { Name = vm.Name, JobInfo = JsonConvert.SerializeObject(jobInfo) }; _db.ScheduledJobs.Add(newScheduledJob); _db.SaveChanges(); try { // Create Hangfire Job RecurringJob.AddOrUpdate(vm.Name, () => WebClientHelper.InvokeUrl(vm.Url), vm.CronExpression); return(RedirectToAction("Index")); } catch (Exception ex) { ViewBag.jobException = "Invalid cron expression"; } } return(View(vm)); }
public void GetAllJobInPeriodWithPagination(Action <PageResultDTO <JobInPeriodDTOWithActions>, Exception> action, long periodId, int pageSize, int pageIndex, string columnNames) { var url = string.Format(baseAddress + makeApiAdress(periodId) + "?PageSize=" + pageSize + "&PageIndex=" + pageIndex); url += !string.IsNullOrWhiteSpace(columnNames) ? "&SelectedColumns=" + columnNames : ""; WebClientHelper.Get(new Uri(url, PMSClientConfig.UriKind), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void GetJobInPeriod(Action <JobInPeriodDTO, Exception> action, long periodId, long jobId, string columnNames) { var url = string.Format(baseAddress + makeApiAdress(periodId) + "?JobId=" + jobId); url += !string.IsNullOrWhiteSpace(columnNames) ? "&SelectedColumns=" + columnNames : ""; WebClientHelper.Get(new Uri(url, PMSClientConfig.UriKind), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public string CardSend(string _orderid, string _cardno, string _cardpwd, int _typeId, int cardvalue, out string supporderid, out string supperrorcode, out string errmsg) { errmsg = string.Empty; supporderid = string.Empty; supperrorcode = string.Empty; string str = "-1"; string SuppKey = base.SuppKey; if (!string.IsNullOrEmpty(base.PostCardUrl) && !string.IsNullOrEmpty(SuppKey)) { string url = base.PostCardUrl + "?"; string str4 = this.GetCardType(_typeId).ToString(); string str5 = "0"; string str6 = string.Format("type={0}&parter={1}&cardno={2}&cardpwd={3}&value={4}&restrict={5}&orderid={6}&callbackurl={7}", new object[] { str4, base.SuppAccount, _cardno, _cardpwd, cardvalue, str5, _orderid, this.notify_url }); string str7 = Cryptography.MD5(str6 + base.SuppKey); try { StringBuilder builder = new StringBuilder(str6); builder.AppendFormat("&sign={0}", str7); string retcode = WebClientHelper.GetString(url, builder.ToString(), "GET", Encoding.GetEncoding("GB2312"), 0x2710); supperrorcode = retcode.Replace("opstate=", ""); errmsg = this.GetLBMsgInfo(retcode, string.Empty); if (retcode == "opstate=1") { str = "0"; } } catch (Exception exception) { ExceptionHandler.HandleException(exception); } } return(str); }
/// <summary> /// /// </summary> /// <param name="orderid"></param> /// <returns></returns> public string Query(string orderid) { string agentID = SuppAccount; string billID = orderid; string timeStamp = DateTime.Now.ToString("yyyyMMddHHmmss"); string plain = string.Format("agent_id={0}&bill_id={1}&time_stamp={2}|||{3}" , agentID , billID , timeStamp , SuppKey); string sign = Md5Sign(plain).ToLower(); string responeText; try { string postUrl = string.Format("http://service.800j.com/consign/HuisuRecycleCardQuery.aspx?agent_id={0}&bill_id={1}&time_stamp={2}&sign={3}" , agentID , billID , timeStamp , sign); responeText = WebClientHelper.GetString(postUrl, null, "GET", Encoding.GetEncoding("gbk")); } catch (Exception ex) { ExceptionHandler.HandleException(ex); responeText = ex.Message; } return(responeText); }
public void UpdateLog(Action <LogDTO, Exception> action, LogDTO log) { var url = string.Format(baseAddress); WebClientHelper.Put(new Uri(url, UriKind.Absolute), action, log, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void GetAllCalculationResults(Action <PageResultDTO <JobIndexPointSummaryDTOWithAction>, Exception> action, long periodId, long calculationId, int pageSize, int pageIndex) { var url = string.Format(baseAddress + makeApiAdress(periodId) + "/" + calculationId + "/JobIndexPoints" + "?PageSize=" + pageSize + "&PageIndex=" + pageIndex); WebClientHelper.Get <PageResultDTO <JobIndexPointSummaryDTOWithAction> >(new Uri(url, UriKind.Absolute), action, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
//public void GetCalculationResultDetails(Action<EmployeeCalculationResultDetailsDTO, Exception> action, long calculationId, // string employeeNo, int pageSize, int pageIndex) //{ // action( // new EmployeeCalculationResultDetailsDTO // { // }, null); //} public void GetCalculationState(Action <CalculationStateWithRunSummaryDTO, Exception> action, long periodId, long id) { var url = string.Format(baseAddress + makeApiAdress(periodId) + "/" + id + "/State"); WebClientHelper.Get <CalculationStateWithRunSummaryDTO>(new Uri(url, UriKind.Absolute), (res, exp) => action(res, exp), WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void ChangeCalculationState(Action <Exception> action, long periodId, long id, CalculationStateDTO calculationState) { var url = string.Format(baseAddress + makeApiAdress(periodId) + "/" + id + "/State"); WebClientHelper.Put <CalculationStateDTO, CalculationStateDTO>(new Uri(url, UriKind.Absolute), (res, exp) => action(exp), calculationState, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
private void Send(string message) { RaygunLogger.Instance.Verbose("Sending Payload --------------"); RaygunLogger.Instance.Verbose(message); RaygunLogger.Instance.Verbose("------------------------------"); WebClientHelper.Send(message, _apiKey, ProxyCredentials); }
public void UpdateJobIndexInquiryForm(Action <InquiryFormByIndexDTO, Exception> action, InquiryFormByIndexDTO inquiryForm) { var url = string.Format(baseAddress + makeJobIndexPointByIndexApiAdress(inquiryForm.PeriodId, inquiryForm.InquirerEmployeeNo, inquiryForm.JobIndexId) + "?Batch=1"); WebClientHelper.Put(new Uri(url, PMSClientConfig.UriKind), action, inquiryForm, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void GetSubordinatesEmployees(Action <PageResultDTO <EmployeeDTOWithActions>, Exception> action, string managerEmployeeNo, long periodId, EmployeeCriteria employeeCriteria, int pageSize, int pageIndex) { var url = string.Format(baseAddress + makeApiAdress(periodId) + "?verifierEmployeeNo=" + managerEmployeeNo + "&PageSize=" + pageSize + "&PageIndex=" + pageIndex + getFilterEmployee(employeeCriteria, "&")); WebClientHelper.Get(new Uri(url, PMSClientConfig.UriKind), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
/// <summary> /// 删除这个App。 /// </summary> public void Delete() { using (var webClient = WebClientHelper.GetWebClient()) { var address = string.Format("http://fir.im/api/v2/app/{0}?token={1}", _appToken, _userToken); var bytes = webClient.UploadData(address, "DELETE", new byte[0]); Console.WriteLine(Encoding.UTF8.GetString(bytes)); } }
public void UpdateInquirySubjectForm(Action <InquiryUnitFormDTO, Exception> action, InquiryUnitFormDTO inquiryForm) { var url = string.Format(baseAddress + makeInquiryUnitIndexPointApiAdress( inquiryForm.PeriodId, inquiryForm.InquirerEmployeeNo, inquiryForm.InquiryUnitId)); WebClientHelper.Put(new Uri(url, PMSClientConfig.UriKind), action, inquiryForm, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public IList <EpisodeDto> GetEpisodesList() { var json = WebClientHelper .GetJson("https://swapi.dev/api/films/", "results"); var episodes = JsonConvert .DeserializeObject <List <EpisodeDto> >(json); return(episodes); }
public void GetAllUsers(Action <PageResultDTO <UserDTOWithActions>, Exception> action, int pageSize, int pageIndex, Dictionary <string, string> sortBy, UserCriteria criteria) { var url = baseAddressUsers + "?PageSize=" + pageSize + "&PageIndex=" + pageIndex + getFilterUser(criteria); if (sortBy.Count > 0) { url += "&SortBy=" + QueryConditionHelper.GetSortByQueryString(sortBy); } WebClientHelper.Get(new Uri(url, UriKind.Absolute), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
/// <summary> /// 获取所有版本信息。 /// </summary> /// <returns>版本信息数组。</returns> public AppVersionModel[] GetAllVersions() { AppVersionModel[] result; using (var webClient = WebClientHelper.GetWebClient()) { var content = Encoding.UTF8.GetString(webClient.DownloadData(string.Format("http://fir.im/api/v2/app/{0}/versions?token={1}", _appToken, _userToken))); result = JsonConvert.DeserializeObject <AppVersionModel[]>(content); } return(result); }
/// <summary> /// /// </summary> /// <returns></returns> string SendToSupp() { string msg = string.Empty; try { ChannelTypeInfo chanelTypeInfo = ChannelType.GetCacheModel(TypeId); if (chanelTypeInfo == null) { msg = "找不到通道,请联系商务或系统管理员处理。"; } else { int card_type = 0; if (int.TryParse(chanelTypeInfo.code, out card_type)) { string callBackurl = WebUtility.GetCurrentHost() + "/merchant/receiveResult/cardsell.aspx"; string postData = string.Format( "type={0}&parter={1}&cardno={2}&cardpwd={3}&value={4}&restrict={5}&orderid={6}&callbackurl={7}", card_type, UserId, CardNo, CardPwd, FaceValue, 0, DateTime.Now.Ticks.ToString(), callBackurl); string sign = viviLib.Security.Cryptography.MD5(postData + CurrentUser.APIKey); postData += "&sign=" + sign + "&attach=cardsell"; string postUrl = WebUtility.GetGatewayUrl() + "/CardReceive.ashx"; string callback = WebClientHelper.GetString(postUrl, postData, "GET", System.Text.Encoding.GetEncoding("GB2312"), 10000); if (callback == "opstate=0") { msg = "true"; } else { msg = callback; } } else { msg = "系统故障"; } } } catch (Exception ex) { msg = ex.Message; } return(msg); }
public void RequestData() { GreenIQConfigurationResponse resp = (GreenIQConfigurationResponse)WebClientHelper.RequestJSONData(typeof(GreenIQConfigurationResponse), this.location + "get_valves_state_and_config.php?access_token=" + accessKey, null); GreenIQHubState state = new GreenIQHubState(); state.PortsConfiguration = resp.data; currentState = state; this.StateChanged(this, new DeviceStateChangedEventArgs(state)); }
public void UpdateUnitIndexInPeriod(Action <UnitIndexInPeriodDTO, Exception> action, UnitIndexInPeriodDTO unitIndexInPeriod) { //action(unitIndexInPeriod, null); //var url = string.Format(baseAddress + "?Id=" + unitIndexInPeriod.Id); //WebClientHelper.Put<UnitIndexInPeriod, UnitIndexInPeriod>(new Uri(url, UriKind.Absolute), // (res, exp) => action(res, exp), unitIndexInPeriod, // WebClientHelper.MessageFormat.Json); var url = string.Format(baseAddress + makeApiAdress(unitIndexInPeriod.PeriodId)); WebClientHelper.Put(new Uri(url, PMSClientConfig.UriKind), action, unitIndexInPeriod, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void RequestData() { currentState = (JawboneState)WebClientHelper.RequestJSONData(typeof(JawboneState), this.location + "bandevents", jawboneKey); if (StateChanged != null) { StateChanged(this, new DeviceStateChangedEventArgs(currentState)); } }
//By index public void GetInquirerInquiryIndices(Action <List <InquiryIndexDTO>, Exception> action, long periodId, string inquirerEmployeeNo) { if (periodId == -1) { action(new List <InquiryIndexDTO>(), null); } var url = string.Format(baseAddress + makeInquirerInquiryIndexApiAdress(periodId, inquirerEmployeeNo)); WebClientHelper.Get(new Uri(url, PMSClientConfig.UriKind), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void AddJobIndexInPeriod(Action <JobIndexInPeriodDTO, Exception> action, JobIndexInPeriodDTO jobIndexInPeriod) { //action(jobIndexInPeriod, null); //var url = string.Format(baseAddress); //WebClientHelper.Post<JobIndexInPeriod, JobIndexInPeriod>(new Uri(url, UriKind.Absolute), // (res, exp) => action(res, exp), jobIndexInPeriod, // WebClientHelper.MessageFormat.Json); var url = string.Format(baseAddress + makeApiAdress(jobIndexInPeriod.PeriodId)); WebClientHelper.Post(new Uri(url, PMSClientConfig.UriKind), action, jobIndexInPeriod, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public ActionResult UpdateUserInfo(UserViewModel user) { Customer customer = user.toCustomer(); customer.LastSignInIpAddr = WebClientHelper.GetHostAddress(); _customerRepository.AddCustomer(customer); customer.Password = null; Session.Add(Constants.SESSION_USER, customer); return(RedirectToAction("UserInfo")); }
public void GetAllUserActionTypes(Action <List <ActionType>, Exception> action, string userName, bool isGroup, string groupId) { if (groupId.IsNullOrEmpty()) { groupId = "0"; } var url = baseAddressActionTypes + "?userName="******"&isGroup=" + isGroup + "&groupId=" + groupId; WebClientHelper.Get(new Uri(url, UriKind.Absolute), action, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token)); }
public void GetSessionToken(Action <string, Exception> action, string token, string newCurrentWorkListUser) { var url = string.Format(PMSClientConfig.BaseApiAddress + "/token"); if (!string.IsNullOrWhiteSpace(newCurrentWorkListUser)) { url = url + "?CurrentWorkListUserName="******"SilverLight", "1" }, { "Authorization", "SAML " + token } }); }
/// <summary> /// Makes a REST call to upload a video to the facebook server. /// </summary> /// <param name="parameters">Parameters for REST call</param> /// <param name="data">the bytes of the file</param> /// <param name="contentType"></param> /// <param name="uploadUrl">The url to upload the file to</param> /// <param name="ar"></param> /// <remarks>Function made virtual for unittesting</remarks> public void UploadFile(IDictionary <string, string> parameters, byte[] data, string contentType, Uri uploadUrl, AsyncResult ar) { string boundary = DateTime.Now.Ticks.ToString("x", CultureInfo.InvariantCulture); byte[] postData = CreatePostData(parameters, data, contentType, boundary); WebClientHelper client = new WebClientHelper(ar) { Method = "POST" }; client.RequestCompleted += OnRequestCompleted; client.SendRequest(uploadUrl, postData, String.Concat("multipart/form-data; boundary=", boundary)); }
public void TestInitialize() { _scope = new UnitOfWorkScope(new EFUnitOfWorkFactory(() => new DataContainer())); var client = new WebClientHelper(new HttpClient()); _orderRepository = new OrderRepository(_scope, new OrderConfigurator(), new EFRepository<OrderItem>(_scope)); _orderRepository.GetAll(); _tr = new TransactionScope(); GenerateRepositories(); }
internal void CheckVersion(bool IsStartUp, bool IsManually) { try { if (IsStartUp) Thread.Sleep(7000); WebClientHelper webclientHelper = new WebClientHelper(); ProxyInfo proxyinfo = ConfigCtrl.GetProxy(); webclientHelper.SetProxy(proxyinfo.Server, proxyinfo.Port, proxyinfo.UserName, proxyinfo.Password); if (proxyinfo.Enable) webclientHelper.EnableProxy(); Stream updatestream = null; try { // Download the update info file to the memory, updatestream = webclientHelper.OpenRead(REMOTE_URI + UPDATE_FILE); } catch (Exception ex) { LogHelper.Write("Download update.xml", REMOTE_URI + UPDATE_FILE, ex, LogSeverity.Error); return; } if (updatestream == null) { LogHelper.Write("Download update.xml", REMOTE_URI + UPDATE_FILE, LogSeverity.Error); return; } // read and close the stream using (System.IO.StreamReader streamReader = new System.IO.StreamReader(updatestream, System.Text.Encoding.GetEncoding("GB2312"))) { string updateInfo = streamReader.ReadToEnd(); // if something was read if (!string.IsNullOrEmpty(updateInfo)) { //LogHelper.Write("Johnny.Kaixin.WinUI.AutoUpdate.CheckVersion.updateInfo:", updateInfo, LogSeverity.Info); string newVersion = JsonHelper.GetMid(updateInfo, "<Version Num = \"", "\"/>"); if (String.IsNullOrEmpty(newVersion)) { LogHelper.Write("Get Version", "newVersion is null", LogSeverity.Info); return; } if (CompareVersions(Assembly.GetExecutingAssembly().GetName().Version.ToString(), newVersion)) { // Download the auto update program to the application // path, so you always have the last version runing if (webclientHelper.DownloadFile(REMOTE_URI + "AutoUpdate.exe", Application.StartupPath + "\\AutoUpdate.exe")) { if (NewVersionFound != null) NewVersionFound(newVersion, Application.StartupPath + "\\AutoUpdate.exe", System.Web.HttpUtility.UrlEncode(updateInfo)); } else { LogHelper.Write("Download AutoUpdate.exe failed", REMOTE_URI + "AutoUpdate.exe", LogSeverity.Error); return; } } else if (IsManually) { if (LatestVersionConfirmed != null) LatestVersionConfirmed(Assembly.GetExecutingAssembly().GetName().Version.ToString()); } } } } catch (Exception ex) { LogHelper.Write("AutoUpdate.CheckVersion", ex, LogSeverity.Error); } }
/// <summary> /// Starts download of requested image /// </summary> /// <param name="requestedSize">Size of the image</param> /// <param name="callback">Callback that will be called when download completes</param> public void GetImageAsync(FacebookImageDimensions requestedSize, GetImageSourceAsyncCallback callback) { #if !SILVERLIGHT dispatcher = Dispatcher.CurrentDispatcher; #else dispatcher = System.Windows.Deployment.Current.Dispatcher; #endif Uri = _normal; switch (requestedSize) { case FacebookImageDimensions.Big: Uri = _big; break; case FacebookImageDimensions.Small: Uri = _small; break; case FacebookImageDimensions.Square: Uri = _square; break; } if (Uri == null) { callback(this, new GetImageSourceCompletedEventArgs(new InvalidOperationException(), false, this)); return; } WebClientHelper wc = new WebClientHelper(callback); wc.RequestCompleted += new EventHandler<RequestCompletedEventArgs>(wc_RequestCompleted); wc.SendRequest(Uri, null, null); }
public void TestInitialize() { _scope = new UnitOfWorkScope(new EFUnitOfWorkFactory(() => new DataContainer())); basicInfoDomainServiceObjects = new BasicInfoDomainServiceObjectsContainer(_scope); scrapTestObjects = new ScrapTestObjectsContainer(_scope); var orderConfigurator = new OrderConfigurator ( new OrderStateFactory ( new InventoryOperationDomainService(new InventoryOperationRepository(_scope), scrapTestObjects.ScrapDomainService))); var client = new WebClientHelper(new HttpClient()); _orderRepository = new OrderRepository(_scope, orderConfigurator, new EFRepository<OrderItem>(_scope)); _orderRepository.GetAll(); _tr = new TransactionScope(); var hostAdapter = new ExternalHostAddressHelper(); var vesselService = new VesselInCompanyDomainService (new VesselInCompanyRepository(_scope, null), new VoyageRepository(_scope)); //var goodPartyService = new GoodPartyAssignmentDomainService // (new GoodPartyAssignmentAntiCorruptionAdapter(new GoodAssignmentAntiCorruptionServiceWrapper(client, hostAdapter))); var goodService = new GoodDomainService ( new GoodAntiCorruptionAdapter(new GoodAntiCorruptionServiceWrapper(client, hostAdapter), new GoodAntiCorruptionMapper()), new EFRepository<Good>(_scope), basicInfoDomainServiceObjects.CompanyDomainService, new EFRepository<GoodUnit>(_scope)); var goodUnitService = new GoodUnitDomainService ( new BaseAntiCorruptionAdapter<GoodUnit, GoodUnitDto> (new BaseAntiCorruptionServiceWrapper<GoodUnitDto>(client), new BaseAntiCorruptionMapper<GoodUnit, GoodUnitDto>()), new EFRepository<GoodUnit>(_scope)); var companyService = new CompanyDomainService ( new CompanyAntiCorruptionAdapter(new CompanyAntiCorruptionServiceWrapper(client, hostAdapter), new CompanyAntiCorruptionMapper()), new CompanyRepository(_scope)); //_target = new OrderApplicationService // ( // _orderRepository, _scope, new UserRepository(_scope), vesselService, goodService, // new OrderFactory(new OrderCodeGenerator(_orderRepository), orderConfigurator, new WorkflowRepository(_scope)), companyService, // new OrderItemDomainService(new EFRepository<OrderItem>(_scope)), orderConfigurator); //_sapid = FakeDomainService.GetCompanies().Single(c => c.Id == 1); //_imsemCo = FakeDomainService.GetCompanies().Single(c => c.Id == 3); //_hafiz = FakeDomainService.GetCompanies().Single(c => c.Id == 2); this.sapidVesselInCompany = FakeDomainService.GetVesselsInCompanies().First(c => c.CompanyId == 1); _sapidVessel2 = FakeDomainService.GetVesselsInCompanies().Last(c => c.CompanyId == 1); this.hafizVesselInCompany = FakeDomainService.GetVesselsInCompanies().First(c => c.CompanyId == 2); _good = FakeDomainService.GetGoods().Single(c => c.Id == 1); _good2 = FakeDomainService.GetGoods().Single(c => c.Id == 2); _unit = FakeDomainService.GetCompanyGoodUnits().Single(c => c.Id == 1); _unit2 = FakeDomainService.GetCompanyGoodUnits().Single(c => c.Id == 2); _unit3 = FakeDomainService.GetCompanyGoodUnits().Single(c => c.Id == 4); //_goodPartAssignment = FakeDomainService.GetGoodPartyAssignments().Single(c => c.Id == 1); //_goodPartAssignment2 = FakeDomainService.GetGoodPartyAssignments().Single(c => c.Id == 2); }
private void GenerateRepositories() { _scope = new UnitOfWorkScope(new EFUnitOfWorkFactory(() => new DataContainer())); var client = new WebClientHelper(new HttpClient()); _orderRepository = new OrderRepository(_scope, new OrderConfigurator(), new EFRepository<OrderItem>(_scope)); _orderRepository.GetAll(); _tr = new TransactionScope(); var hostAdapter = new ExternalHostAddressHelper(); var vesselService = new VesselDomainService(new BaseAntiCorruptionAdapter<Vessel, WarehouseDto>( new VesselAntiCorruptionServiceWrapper( client, hostAdapter), new VesselAntiCorruptionMapper()), new VesselRepository(_scope)); var goodService = new GoodDomainService(new GoodAntiCorruptionAdapter( new GoodAntiCorruptionServiceWrapper(client, hostAdapter), new GoodAntiCorruptionMapper()), new EFRepository<Good>(_scope)); var companyService = new CompanyDomainService( new CompanyAntiCorruptionAdapter(new CompanyAntiCorruptionServiceWrapper (client, hostAdapter), new CompanyAntiCorruptionMapper()), new CompanyRepository(_scope)); var orderApplicationService = new OrderApplicationService( _orderRepository, _scope, new UserRepository(_scope), vesselService, goodService, new OrderFactory(new OrderCodeGenerator() , new OrderConfigurator() , new WorkflowRepository(_scope)), companyService, new OrderItemDomainService(new EFRepository<OrderItem>(_scope)), new OrderConfigurator()); _approvalWorkFlowRepository = new WorkflowLogRepository(_scope); _approveFlowApplicationService = new ApproveFlowApplicationService(_scope, _approvalWorkFlowRepository, new WorkflowRepository(_scope)); }
public MasterDataUpdate() { _webclientHelper = new WebClientHelper(); }
public FuelReportTestObjectsContainer(UnitOfWorkScope unitOfWorkScope) { this.UnitOfWorkScope = unitOfWorkScope; var basicInfoDomainServiceObjects = new BasicInfoDomainServiceObjectsContainer(unitOfWorkScope); var scrapTestObjects = new ScrapTestObjectsContainer(this.UnitOfWorkScope); this.FuelReportConfigurator = new FuelReportConfigurator(new FuelReportStateFactory(),null,null); this.FuelReportRepository = new FuelReportRepository(this.UnitOfWorkScope, this.FuelReportConfigurator); var currencyRepository = new EFRepository<Currency>(this.UnitOfWorkScope); var currencyDomainService = new CurrencyDomainService(currencyRepository); this.VoyageDomainService = new VoyageDomainService(new VoyageRepository(this.UnitOfWorkScope), FuelReportRepository); this.VoyageLogDomainService = new VoyageLogDomainService(new VoyageLogRepository(this.UnitOfWorkScope)); var inventoryOperationFactory = new InventoryOperationFactory(); var inventoryOperationRepository = new InventoryOperationRepository(this.UnitOfWorkScope); var inventoryOperationDomainService = new InventoryOperationDomainService(inventoryOperationRepository, scrapTestObjects.ScrapDomainService); var orderConfigurator = new OrderConfigurator( new OrderStateFactory( inventoryOperationDomainService )); this.OrderDomainService = new OrderDomainService(new OrderRepository(this.UnitOfWorkScope, orderConfigurator, new EFRepository<OrderItem>(this.UnitOfWorkScope))); var client = new WebClientHelper(new HttpClient()); var hostAdapter = new ExternalHostAddressHelper(); var goodDomainService = new GoodDomainService( new GoodAntiCorruptionAdapter( new GoodAntiCorruptionServiceWrapper(client, hostAdapter), new GoodAntiCorruptionMapper()), new EFRepository<Good>(this.UnitOfWorkScope), basicInfoDomainServiceObjects.CompanyDomainService, new EFRepository<GoodUnit>(this.UnitOfWorkScope)); var inventoryManagementDomainService = new InventoryManagementDomainService(goodDomainService, currencyDomainService); this.FuelReportDomainService = new FuelReportDomainService( this.FuelReportRepository, this.VoyageDomainService, inventoryOperationDomainService, inventoryOperationRepository, inventoryOperationFactory, OrderDomainService, inventoryManagementDomainService , new CharteringDomainService(new CharterInRepository(this.UnitOfWorkScope), new CharterOutRepository(this.UnitOfWorkScope))); this.WorkflowLogRepository = new WorkflowLogRepository(this.UnitOfWorkScope); //var inventoryOperationNotifier = new InventoryOperationNotifier(); this.FuelReportApplicationService = null; //this.FuelReportApplicationService = new FuelReportApplicationService( // this.UnitOfWorkScope, // currencyDomainService, // this.VoyageDomainService, // FuelReportDomainService, // new ApproveFlowApplicationService(this.UnitOfWorkScope, new WorkflowLogRepository(this.UnitOfWorkScope), new WorkflowRepository(this.UnitOfWorkScope), new OrderConfigurator(new OrderStateFactory(new InventoryOperationDomainService(new InventoryOperationRepository(this.UnitOfWorkScope), new ScrapDomainService(new ScrapRepository(this.UnitOfWorkScope, new ScrapConfigurator(new ScrapStateFactory(new ApprovableScrapDomainService(new VesselDomainService(new BaseAntiCorruptionAdapter<Vessel, WarehouseDto>(), ), )))), )), )), )); var goodMapper = new GoodToGoodDtoMapper(new CompanyGoodUnitToGoodUnitDtoMapper()); var currencyMapper = new CurrencyToCurrencyDtoMapper(); var companyDtoMapper = new BaseFacadeMapper<Company, CompanyDto>(); var vesselDtoMapper = new VesselToVesselDtoMapper(companyDtoMapper); var fuelReportDetailMapper = new FuelReportDetailToFuelReportDetailDtoMapper(goodMapper, currencyMapper); var fuelReportToFuelReportDtoMapper = new FuelReportToFuelReportDtoMapper( fuelReportDetailMapper, vesselDtoMapper); this.VoyageFacadeService = new VoyageFacadeService( VoyageDomainService, new VoyageToVoyageDtoMapper(), FuelReportDomainService, fuelReportToFuelReportDtoMapper, inventoryOperationDomainService, new InventoryOperationToInventoryOperationDtoMapper(fuelReportDetailMapper), this.VoyageLogDomainService, new VoyageLogToVoyageLogDtoMapper(companyDtoMapper, vesselDtoMapper), goodMapper); }