示例#1
0
        public async Task PauseGameAsync(int gameId)
        {
            using (var adminService = new AdminServiceClient(new BasicHttpBinding(), new EndpointAddress(ConnectionData.Url)))
            {
                int sequenceNumber = SequenceNumber;

                var pauseGameReq = new PauseGameReq
                {
                    Auth = new ReqAuth
                    {
                        ClientName     = ConnectionData.Username,
                        TeamName       = ConnectionData.TeamName,
                        SessionId      = _sessionId,
                        SequenceNumber = sequenceNumber,
                        AuthCode       =
                            GetAuthCode(string.Format("{0}:{1}:{2}:{3}{4}", ConnectionData.TeamName, ConnectionData.Username,
                                                      _sessionId, sequenceNumber, ConnectionData.Password)),
                    },
                    GameId = gameId,
                };

                _stopwatch.Start();

                var pauseGameResp = await adminService.PauseGameAsync(pauseGameReq);

                _stopwatch.Stop();
                LastCallTime = _stopwatch.ElapsedMilliseconds;
                _stopwatch.Reset();

                if (pauseGameResp.Status != "OK")
                {
                    throw new Exception(pauseGameResp.Message);
                }
            }
        }
示例#2
0
        public async Task <GetOrdersResponse> DoRequest()
        {
            var auth = new AdminWS.Authentication()
            {
                Password = _builder.GetConfig().GetPassword(_builder.OrderType, _builder.GetCountryCode()),
                Username = _builder.GetConfig().GetUsername(_builder.OrderType, _builder.GetCountryCode())
            };

            var request = new AdminWS.GetOrdersRequest()
            {
                Authentication   = auth,
                OrdersToRetrieve = new[]
                {
                    new GetOrderInformation()
                    {
                        SveaOrderId = _builder.Id,
                        OrderType   = ConvertPaymentTypeToOrderType(_builder.OrderType),
                        ClientId    = _builder.GetConfig().GetClientNumber(_builder.OrderType, _builder.GetCountryCode())
                    }
                }
            };

            // make request to correct endpoint, return response object
            var endpoint = _builder.GetConfig().GetEndPoint(CONST.PaymentType.ADMIN_TYPE);
            var adminWS  = new AdminServiceClient(AdminServiceClient.EndpointConfiguration.WcfAdminSoapService, endpoint);
            var response = await adminWS.GetOrdersAsync(request);

            return(response);
        }
示例#3
0
        public async Task <DeliveryResponse> DoRequest()
        {
            var auth = new  Authentication()
            {
                Password = _builder.GetConfig().GetPassword(_builder.OrderType, _builder.GetCountryCode()),
                Username = _builder.GetConfig().GetUsername(_builder.OrderType, _builder.GetCountryCode())
            };

            var orderToDeliver = new AdminWS.DeliverOrderInformation()
            {
                ClientId    = _builder.GetConfig().GetClientNumber(_builder.OrderType, _builder.GetCountryCode()),
                SveaOrderId = _builder.Id,
                OrderType   = ConvertPaymentTypeToOrderType(_builder.OrderType)
                              //PrintType // optional for EU-clients, and integration package only supports EU-clients
            };

            var request = new AdminWS.PartialDeliveryRequest()
            {
                Authentication          = auth,
                OrderToDeliver          = orderToDeliver,
                RowNumbers              = _builder.RowIndexesToDeliver.ToArray(),
                InvoiceDistributionType = ConvertDistributionTypeToInvoiceDistributionType(_builder.DistributionType)
            };

            // make request to correct endpoint, return response object
            var endpoint = _builder.GetConfig().GetEndPoint(PaymentType.ADMIN_TYPE);
            var adminWS  = new AdminServiceClient(AdminServiceClient.EndpointConfiguration.WcfAdminSoapService, endpoint);
            var response = await adminWS.DeliverPartialAsync(request);

            return(response);
        }
        public Webpay.Integration.CSharp.AdminWS.DeliveryResponse DoRequest()
        {
            var auth = new AdminWS.Authentication()
            {
                Password = _builder.GetConfig().GetPassword(_builder.OrderType, _builder.GetCountryCode()),
                Username = _builder.GetConfig().GetUsername(_builder.OrderType, _builder.GetCountryCode())
            };

            var request = new AdminWS.CreditInvoiceRequest
            {
                Authentication          = auth,
                InvoiceId               = _builder.Id,
                ClientId                = _builder.GetConfig().GetClientNumber(_builder.OrderType, _builder.GetCountryCode()),
                RowNumbers              = _builder.RowIndexesToCredit.ToArray(),
                InvoiceDistributionType = ConvertDistributionTypeToInvoiceDistributionType(_builder.DistributionType),
                NewCreditInvoiceRows    = _builder.NewCreditOrderRows.Select(x => ConvertOrderRowBuilderToAdminWSOrderRow(x)).ToArray()
            };

            // make request to correct endpoint, return response object
            var endpoint = _builder.GetConfig().GetEndPoint(PaymentType.ADMIN_TYPE);
            var adminWS  = new AdminServiceClient("WcfAdminSoapService", endpoint);
            var response = adminWS.CreditInvoiceRows(request);

            return(response);
        }
示例#5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DateTime start = DateTime.Now;
            DateTime end;

            bool retry = false;

            do
            {
                try
                {
                    AdminServiceClient client = new AdminServiceClient();
                    var result = client.DeleteOldProfiles(new DeleteOldProfilesParam()
                    {
                        OnlyShowUsers = false
                    });
                    lstDeletedUsers.ItemsSource = result;
                    end   = DateTime.Now;
                    retry = false;
                }
                catch (Exception ex)
                {
                    //retry = true;
                }
            } while (retry);

            MessageBox.Show("End");
        }
示例#6
0
        //
        // GET: /ApplicationOrganisation/

        public ActionResult ApplicationOrganisationSelect()
        {
            var model = new ApplicationOrganisationSelectVM();

            //Initialize lists
            model.OrganisationsByTypesList = new List <OrganisationByTypeVM>();
            model.ApplicationList          = new List <ApplicationModel>();

            //Retreive all applications that are available to the current user.
            //Currently working in ********************GOD MODE********************* - If you have access to this screen you can maintain staff in all apps in the framework.
            try
            {
                var sc = new AdminServiceClient();
                var ApplicationList = sc.GetAllApplication(User.Identity.Name, User.Identity.Name, "Framework", "", false);
                model.ApplicationList = Mapper.Map <IEnumerable <ApplicationDC>, IEnumerable <ApplicationModel> >(ApplicationList).ToList();
            }
            catch (Exception ex)
            {
                model.Message = FixedResources.MESSAGE_RETRIEVAL_FAILED;
                return(View(model));
            }



            //Initialize lists
            model.OrganisationsByTypesList = new List <OrganisationByTypeVM>();

            SessionManager.ApplicationList        = model.ApplicationList;
            SessionManager.OrganisationByTypeList = model.OrganisationsByTypesList;

            return(View(model));
        }
示例#7
0
文件: Helpers.cs 项目: sevenate/fab
        public static AdminServiceClient CreateClientProxy(string endPointAddress, string username, string password)
        {
            var binding = new WSHttpBinding
            {
                MaxBufferPoolSize      = 2147483647,
                MaxReceivedMessageSize = 2147483647
            };

            binding.Security.Mode = SecurityMode.TransportWithMessageCredential;

            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
            binding.Security.Transport.ProxyCredentialType  = HttpProxyCredentialType.None;
            binding.Security.Transport.Realm = string.Empty;

            binding.Security.Message.ClientCredentialType       = MessageCredentialType.UserName;
            binding.Security.Message.NegotiateServiceCredential = true;
            binding.Security.Message.EstablishSecurityContext   = true;

//			var endPoint = new EndpointAddress(
//				Application.Current.Host.Source.AbsoluteUri.Replace(
//					Application.Current.Host.Source.AbsolutePath, "/Api/FeedbackService.svc"));

            var endPoint = new EndpointAddress(endPointAddress ?? EndPointAddress);

            var proxy = new AdminServiceClient(binding, endPoint);

            proxy.ClientCredentials.UserName.UserName = username ?? Username;
            proxy.ClientCredentials.UserName.Password = password ?? Password;

            return(proxy);
        }
示例#8
0
        public async Task <AdminWS.UpdateOrderResponse> DoRequest()
        {
            var auth = new AdminWS.Authentication()
            {
                Password = _builder.GetConfig().GetPassword(_builder.OrderType, _builder.GetCountryCode()),
                Username = _builder.GetConfig().GetUsername(_builder.OrderType, _builder.GetCountryCode())
            };

            var request = new AdminWS.UpdateOrderRequest()
            {
                Authentication    = auth,
                SveaOrderId       = _builder.SveaOrderId,
                OrderType         = ConvertPaymentTypeToOrderType(_builder.OrderType),
                ClientId          = _builder.GetConfig().GetClientNumber(_builder.OrderType, _builder.GetCountryCode()),
                Notes             = _builder.Notes,
                ClientOrderNumber = _builder.ClientOrderNumber
            };

            // make request to correct endpoint, return response object
            var endpoint = _builder.GetConfig().GetEndPoint(PaymentType.ADMIN_TYPE);
            var adminWS  = new AdminServiceClient(AdminServiceClient.EndpointConfiguration.WcfAdminSoapService, endpoint);
            var response = await adminWS.UpdateOrderAsync(request);

            return(response);
        }
        public Webpay.Integration.CSharp.AdminWS.DeliveryResponse DoRequest()
        {
            var auth = new AdminWS.Authentication()
            {
                Password = _builder.GetConfig().GetPassword(_builder.OrderType, _builder.GetCountryCode()),
                Username = _builder.GetConfig().GetUsername(_builder.OrderType, _builder.GetCountryCode())
            };

            var orderToDeliver = new AdminWS.DeliverOrderInformation()
            {
                ClientId    = _builder.GetConfig().GetClientNumber(_builder.OrderType, _builder.GetCountryCode()),
                SveaOrderId = _builder.Id,
                OrderType   = ConvertPaymentTypeToOrderType(_builder.OrderType)
                              //PrintType // optional for EU-clients, and integration package only supports EU-clients
            };

            var request = new AdminWS.PartialDeliveryRequest()
            {
                Authentication          = auth,
                OrderToDeliver          = orderToDeliver,
                RowNumbers              = _builder.RowIndexesToDeliver.ToArray(),
                InvoiceDistributionType = ConvertDistributionTypeToInvoiceDistributionType(_builder.DistributionType)
            };

            // make request to correct endpoint, return response object
            var endpoint = _builder.GetConfig().GetEndPoint(PaymentType.ADMIN_TYPE);
            var adminWS  = new AdminServiceClient(new WSHttpBinding(SecurityMode.Transport), new EndpointAddress(endpoint));
            var response = adminWS.DeliverPartial(request);

            return(response);
        }
示例#10
0
        public Webpay.Integration.CSharp.AdminWS.GetOrdersResponse DoRequest()
        {
            var auth = new Webpay.Integration.CSharp.AdminWS.Authentication()
            {
                Password = _builder.GetConfig().GetPassword(_builder.OrderType, _builder.GetCountryCode()),
                Username = _builder.GetConfig().GetUsername(_builder.OrderType, _builder.GetCountryCode())
            };

            var request = new Webpay.Integration.CSharp.AdminWS.GetOrdersRequest()
            {
                Authentication   = auth,
                OrdersToRetrieve = new[]
                {
                    new GetOrderInformation()
                    {
                        SveaOrderId = _builder.Id,
                        OrderType   = ConvertPaymentTypeToOrderType(_builder.OrderType),
                        ClientId    = _builder.GetConfig().GetClientNumber(_builder.OrderType, _builder.GetCountryCode())
                    }
                }
            };

            // make request to correct endpoint, return response object
            var endpoint = _builder.GetConfig().GetEndPoint(PaymentType.ADMIN_TYPE);
            var adminWS  = new AdminServiceClient(new WSHttpBinding(SecurityMode.Transport), new EndpointAddress(endpoint));
            var response = adminWS.GetOrders(request);

            return(response);
        }
示例#11
0
        /// <summary>
        /// Registers the user, with the given Facebook values if applicable
        /// </summary>
        private void Register()
        {
            // check if user needs to be synced with facebook
            if (!NewUser.SyncWithFacebook || !string.IsNullOrEmpty(FacebookAuthorizer.AuthorizationCode))
            {
                // get service client and register user
                AdminServiceClient userServiceClient = Container.Resolve <AdminServiceClient>();
                userServiceClient.Register(NewUser, LoginKey, FacebookAuthorizer.AuthorizationCode,
                                           (result) =>
                {
                    // turn off busy message
                    IsBusy = false;

                    // if the user was successfully registered, show confirmation message
                    if (result)
                    {
                        MessageBox.Show("Thank you for joining ArtistTrack!", "ArtistTrack", MessageBoxButton.OK);
                        RaiseClose();
                    }
                });
            }
            else
            {
                MessageBox.Show("Facebook authorization was not granted. Please uncheck the Sync with Facebook checkbox or try registering again.",
                                "ArtistTrack",
                                MessageBoxButton.OK);
            }
        }
        public Webpay.Integration.CSharp.AdminWS.CancelOrderRowsResponse DoRequest()
        {
            var auth = new AdminWS.Authentication()
            {
                Password = _builder.GetConfig().GetPassword(_builder.OrderType, _builder.GetCountryCode()),
                Username = _builder.GetConfig().GetUsername(_builder.OrderType, _builder.GetCountryCode())
            };

            var request = new AdminWS.CancelOrderRowsRequest()
            {
                Authentication  = auth,
                SveaOrderId     = _builder.Id,
                OrderType       = ConvertPaymentTypeToOrderType(_builder.OrderType),
                ClientId        = _builder.GetConfig().GetClientNumber(_builder.OrderType, _builder.GetCountryCode()),
                OrderRowNumbers = _builder.RowIndexesToCancel.ToArray(),
                //NewCreditInvoiceRows = _builder.NewCreditOrderRows.Select( x => ConvertOrderRowBuilderToAdminWSOrderRow(x) ).ToArray()
            };

            // make request to correct endpoint, return response object
            var endpoint = _builder.GetConfig().GetEndPoint(PaymentType.ADMIN_TYPE);
            var adminWS  = new AdminServiceClient(new WSHttpBinding(SecurityMode.Transport), new EndpointAddress(endpoint));
            var response = adminWS.CancelOrderRows(request);

            return(response);
        }
示例#13
0
        public async Task <CancelOrderRowsResponse> DoRequest()
        {
            var auth = new AdminWS.Authentication()
            {
                Password = _builder.GetConfig().GetPassword(_builder.OrderType, _builder.GetCountryCode()),
                Username = _builder.GetConfig().GetUsername(_builder.OrderType, _builder.GetCountryCode())
            };

            var request = new AdminWS.CancelOrderRowsRequest()
            {
                Authentication  = auth,
                SveaOrderId     = _builder.Id,
                OrderType       = ConvertPaymentTypeToOrderType(_builder.OrderType),
                ClientId        = _builder.GetConfig().GetClientNumber(_builder.OrderType, _builder.GetCountryCode()),
                OrderRowNumbers = _builder.RowIndexesToCancel.ToArray(),
                //NewCreditInvoiceRows = _builder.NewCreditOrderRows.Select( x => ConvertOrderRowBuilderToAdminWSOrderRow(x) ).ToArray()
            };

            // make request to correct endpoint, return response object
            var endpoint = _builder.GetConfig().GetEndPoint(PaymentType.ADMIN_TYPE);
            var adminWS  = new AdminServiceClient(AdminServiceClient.EndpointConfiguration.WcfAdminSoapService, endpoint);
            var response = await adminWS.CancelOrderRowsAsync(request);

            return(response);
        }
        private static OrganisationTypeGroupLookupListsCacheObject GetOrganisationTypeGroupAndLookups()
        {
            AdminServiceClient        sc           = new AdminServiceClient();
            OrganisationTypeGroupVMDC returnObject = sc.GetOrganisationTypeGroup(HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name, "FrameworkAdmin", "", null);

            OrganisationTypeGroupLookupListsCacheObject CachedLists = new OrganisationTypeGroupLookupListsCacheObject();

            return(CachedLists);
        }
        private static NonStandardHolidayLookupListsCacheObject GetNonStandardHolidayAndLookups()
        {
            AdminServiceClient     sc           = new AdminServiceClient();
            NonStandardHolidayVMDC returnObject = sc.GetNonStandardHoliday(HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name, "FrameworkAdmin", "", null);

            NonStandardHolidayLookupListsCacheObject CachedLists = new NonStandardHolidayLookupListsCacheObject();

            return(CachedLists);
        }
        /// <summary>
        /// Creates a new connection to the service or uses an existing one
        /// </summary>
        /// <returns>A working connection to the service</returns>
        public static AdminServiceClient GetClient()
        {
            if (clientInstance == null)
            {
                clientInstance = new AdminServiceClient();
            }

            return(clientInstance);
        }
        /// <summary>
        /// Creates a new connection to the service or uses an existing one
        /// </summary>
        /// <returns>A working connection to the service</returns>
        public static AdminServiceClient GetClient()
        {
            if(clientInstance == null)
            {
                clientInstance = new AdminServiceClient();
            }

            return clientInstance;
        }
示例#18
0
        public ActionResult Edit()
        {
            // Retrieve ID from session
            string code = SessionManager.OrganisationTypeCode;

            OrganisationTypeVM model = new OrganisationTypeVM();

            // Not from staff or error
            if (String.IsNullOrEmpty(code))
            {
                //If session has lists then use them
                RepopulateListsFromCacheSession(model);

                //Assume we are in create mode as no code passed
                model.OrganisationTypeItem = new OrganisationTypeModel()
                {
                    IsActive = true
                };
            }
            //if we have been passed a code then assume we are in edit situation and we need to retrieve from the database.
            else
            {
                // Create service instance
                AdminServiceClient sc = new AdminServiceClient();

                try
                {
                    // Call service to get OrganisationType item and any associated lookups
                    OrganisationTypeVMDC returnedObject = sc.GetOrganisationType(CurrentUser, CurrentUser, appID, "", code);

                    // Close service communication
                    sc.Close();

                    //Get view model from service
                    model = ConvertOrganisationTypeDC(returnedObject);

                    ResolveFieldCodesToFieldNamesUsingLists(model);

                    //Store the service version
                    SessionManager.OrganisationTypeServiceVersion = model.OrganisationTypeItem;
                }
                catch (Exception e)
                {
                    // Handle the exception
                    string message = ExceptionManager.HandleException(e, sc);
                    model.Message = message;

                    return(View(model));
                }
            }

            //Adds current retrieved OrganisationType to session
            SessionManager.CurrentOrganisationType = model.OrganisationTypeItem;
            SetAccessContext(model);

            return(View(model));
        }
        private static CountryLookupListsCacheObject GetCountryAndLookups()
        {
            AdminServiceClient sc           = new AdminServiceClient();
            CountryVMDC        returnObject = sc.GetCountry(HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name, "FrameworkAdmin", "", null);

            CountryLookupListsCacheObject CachedLists = new CountryLookupListsCacheObject();

            return(CachedLists);
        }
        private static ApplicationLookupListsCacheObject GetApplicationAndLookups()
        {
            AdminServiceClient sc           = new AdminServiceClient();
            ApplicationVMDC    returnObject = sc.GetApplication(HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name, "FrameworkAdmin", "", null);

            ApplicationLookupListsCacheObject CachedLists = new ApplicationLookupListsCacheObject();

            return(CachedLists);
        }
        private static StaffOfficesLookupListsCacheObject GetStaffOfficesAndLookups()
        {
            AdminServiceClient sc           = new AdminServiceClient();
            StaffOfficesVMDC   returnObject = sc.GetStaffOffices(HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name, "FrameworkAdmin", "", null);

            StaffOfficesLookupListsCacheObject CachedLists = new StaffOfficesLookupListsCacheObject();

            return(CachedLists);
        }
        private void ThreadRun()
        {
            _lastMessage = DateTime.Now;
            PushMessage("Worker starting");
            try
            {
                var client = new AdminServiceClient();

                int observerId = client.CreateObserver(new CreateObserverReq().Prepare()).ObserverId;
                PushMessage($"Created observer: {observerId}");

                while (true)
                {
                    Thread.Sleep(1000);

                    EnGameInfo[] games   = client.ListGames(new ListGamesReq().Prepare()).Games;
                    EnGameInfo   running = games.FirstOrDefault(g => g.State == "Play" || g.State == "Pause");
                    if (running == null)
                    {
                        continue;
                    }

                    PushMessage($"Connecting game {running.GameId} / {running.Label}");

                    string status = client.StartObserving(new StartObservingReq
                    {
                        ObserverId = observerId,
                        GameId     = running.GameId
                    }.Prepare()).Status;

                    PushMessage($"StartObserving: {status}");

                    while (true)
                    {
                        var obs = client.ObserveNextTurn(new ObserveNextTurnReq
                        {
                            ObserverId = observerId,
                            GameId     = running.GameId
                        }.Prepare());

                        PushMessage($"ObserveNextTurn: {obs.Status} {obs.TurnInfo?.Turn}");

                        if (obs.GameInfo.GameState == "Finish")
                        {
                            break;
                        }
                    }

                    PushMessage($"Game finished");
                }
            }
            catch (Exception ex)
            {
                PushMessage($"Exception {ex.GetType().FullName}: {ex.Message}");
            }
        }
        private static OrganisationLookupListsCacheObject GetOrganisationAndLookups()
        {
            AdminServiceClient sc           = new AdminServiceClient();
            OrganisationVMDC   returnObject = sc.GetOrganisation(HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name, "FrameworkAdmin", "", null);

            OrganisationLookupListsCacheObject CachedLists = new OrganisationLookupListsCacheObject();

            CachedLists.OrganisationTypeList = Mapper.Map <IEnumerable <OrganisationTypeDC>, List <OrganisationTypeModel> >(returnObject.OrganisationTypeList);
            return(CachedLists);
        }
示例#24
0
        private void btnDeleteOrphanRecords_Click(object sender, RoutedEventArgs e)
        {
            AdminServiceClient client = new AdminServiceClient();

            client.DeleteOrphandExerciseRecords(new DeleteOldProfilesParam()
            {
                OnlyShowUsers = false
            });
            //var result = client.(new DeleteOldProfilesParam() { OnlyShowUsers = true });
        }
示例#25
0
        private async void RegisterForEvent_Load(object sender, EventArgs e)
        {
            calculateRaceCost();
            var client    = new AdminServiceClient();
            var charities = await client.GetAllCharityAsync();

            charityComboBox.DisplayMember = "name";
            charityComboBox.ValueMember   = "id";
            charityComboBox.DataSource    = charities;
        }
示例#26
0
        private void ShowEmptyUsersButton_Click(object sender, RoutedEventArgs e)
        {
            AdminServiceClient client = new AdminServiceClient();
            var result = client.DeleteOldProfiles(new DeleteOldProfilesParam()
            {
                OnlyShowUsers = true
            });

            lstDeletedUsers.ItemsSource = result;
        }
        private static ApplicationAttributeLookupListsCacheObject GetApplicationAttributeAndLookups()
        {
            AdminServiceClient       sc           = new AdminServiceClient();
            ApplicationAttributeVMDC returnObject = sc.GetApplicationAttribute(HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name, "FrameworkAdmin", "", null);

            ApplicationAttributeLookupListsCacheObject CachedLists = new ApplicationAttributeLookupListsCacheObject();

            CachedLists.ApplicationList = Mapper.Map <IEnumerable <ApplicationDC>, List <ApplicationModel> >(returnObject.ApplicationList);
            return(CachedLists);
        }
        private static StaffLookupListsCacheObject GetStaffAndLookups()
        {
            AdminServiceClient sc           = new AdminServiceClient();
            StaffVMDC          returnObject = sc.GetStaff(HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name, "FrameworkAdmin", "", null);

            StaffLookupListsCacheObject CachedLists = new StaffLookupListsCacheObject();

            CachedLists.GradeList = Mapper.Map <IEnumerable <GradeDC>, List <GradeModel> >(returnObject.GradeList);
            return(CachedLists);
        }
    /// <summary>
    /// Factory method to create new administration service clients for the deployment service.
    /// Sets the connection string and user credentials from values provided in settings.
    /// HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationUserName
    /// HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationPassword
    /// HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationnAdministrationAddress
    /// 
    /// </summary>
    /// <returns>A new instance of an adimistration service client</returns>
    public static AdminServiceClient CreateClient() {
      var client = new AdminServiceClient();
      client.ClientCredentials.UserName.UserName = HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationUserName;
      client.ClientCredentials.UserName.Password = HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationPassword;
      client.Endpoint.Address = new EndpointAddress(HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationAdministrationAddress);
      client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.Custom;
      client.ClientCredentials.ServiceCertificate.Authentication.CustomCertificateValidator =
          new DeploymentServerCertificateValidator(new X509Certificate2(serverCrtData));

      return client;
    }
        private static StaffDetailsLookupListsCacheObject GetStaffDetailsAndLookups()
        {
            AdminServiceClient sc           = new AdminServiceClient();
            StaffDetailsVMDC   returnObject = sc.GetStaffDetails(HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name, "FrameworkAdmin", "", null);

            StaffDetailsLookupListsCacheObject CachedLists = new StaffDetailsLookupListsCacheObject();

            CachedLists.StaffList       = Mapper.Map <IEnumerable <StaffDC>, List <StaffModel> >(returnObject.StaffList);
            CachedLists.StaffOfficeList = Mapper.Map <IEnumerable <StaffOfficesDC>, List <StaffOfficesModel> >(returnObject.StaffOfficeList);
            return(CachedLists);
        }
        private static StaffOrganisationLookupListsCacheObject GetStaffOrganisationAndLookups()
        {
            AdminServiceClient    sc           = new AdminServiceClient();
            StaffOrganisationVMDC returnObject = sc.GetStaffOrganisation(HttpContext.Current.User.Identity.Name, HttpContext.Current.User.Identity.Name, "FrameworkAdmin", "", null);

            StaffOrganisationLookupListsCacheObject CachedLists = new StaffOrganisationLookupListsCacheObject();

            CachedLists.StaffList        = Mapper.Map <IEnumerable <StaffDC>, List <StaffModel> >(returnObject.StaffList);
            CachedLists.OrganisationList = Mapper.Map <IEnumerable <OrganisationDC>, List <OrganisationModel> >(returnObject.OrganisationList);
            CachedLists.ApplicationList  = Mapper.Map <IEnumerable <ApplicationDC>, List <ApplicationModel> >(returnObject.ApplicationList);
            return(CachedLists);
        }
        public async Task <CancelPaymentPlanRowsResponse> DoRequest()
        {
            var auth = new Authentication()
            {
                Password = _builder.GetConfig().GetPassword(_builder.OrderType, _builder.GetCountryCode()),
                Username = _builder.GetConfig().GetUsername(_builder.OrderType, _builder.GetCountryCode())
            };

            var cancellationRows = new List <CancellationRow>();

            foreach (var rowIndex in _builder.RowIndexesToCredit)
            {
                var cancellationRow = new CancellationRow()
                {
                    AmountInclVat = 0M,
                    VatPercent    = 0M,
                    Description   = null,
                    RowNumber     = (int)rowIndex
                };
                cancellationRows.Add(cancellationRow);
            }
            foreach (var ncr in _builder.NewCreditOrderRows)
            {
                var vatPercent   = GetVatPercentFromBuilderOrderRow(ncr.GetVatPercent(), ncr.GetAmountIncVat(), ncr.GetAmountExVat());
                var amountIncVat = GetAmountIncVatFromBuilderOrderRow(ncr.GetVatPercent(), ncr.GetAmountIncVat(), ncr.GetAmountExVat());
                var description  = GetDescriptionFromBuilderOrderRow(ncr.GetName(), ncr.GetDescription());

                var cancellationRow = new CancellationRow()
                {
                    AmountInclVat = amountIncVat,
                    VatPercent    = vatPercent,
                    Description   = description,
                    RowNumber     = null
                };
                cancellationRows.Add(cancellationRow);
            }

            var request = new CancelPaymentPlanRowsRequest()
            {
                Authentication   = auth,
                ContractNumber   = _builder.Id,
                ClientId         = _builder.GetConfig().GetClientNumber(_builder.OrderType, _builder.GetCountryCode()),
                CancellationRows = cancellationRows.ToArray()
            };

            // make request to correct endpoint, return response object
            var endpoint = _builder.GetConfig().GetEndPoint(PaymentType.ADMIN_TYPE);
            var adminWS  = new AdminServiceClient(AdminServiceClient.EndpointConfiguration.WcfAdminSoapService, endpoint);// "WcfAdminSoapService", endpoint);
            var response = await adminWS.CancelPaymentPlanRowsAsync(request);

            return(response);
        }
示例#33
0
 private void signin()
 {
     string message = null;
     if (textBox1.TextLength > 3 || textBox2.TextLength > 3)
     {
         var passwordClient = new PasswordServiceClient();
         string[] idAndType = passwordClient.authenticatePerson(textBox1.Text, textBox2.Text, ref message);
         if (idAndType != null)
         {
             int id = -1;
             Int32.TryParse(idAndType[0], out id);
             if (idAndType[1].Equals("0"))
             {
                 Admin adminClient = new AdminServiceClient().GetAdmin(id);
                 adminClient.sessionID = idAndType[2];
                 new Thread(() => new AdminMenu().ShowDialog()).Start();
                 Dispose();
             }
             else if(idAndType[1].Equals("1"))
             {
                 var doctorClient = new DoctorServiceClient().GetDoctor(id);
                 doctorClient.sessionID = idAndType[2];
                 new Thread(() => new DoctorMenu(doctorClient).ShowDialog()).Start();
                 Dispose();
             }
             else
                 new Thread(() => new ErrorWindow("Wrong username or password").ShowDialog()).Start();
         }
         else
         {
             new Thread(() => new ErrorWindow("Wrong username or password").ShowDialog()).Start();
         }
     }
     else
     {
         new Thread(() => new ErrorWindow("Incorrect length").ShowDialog()).Start();
     }
 }
 public LoginWindow()
 {
     ClientManager.CloseClient();
     client = ClientManager.GetClient();
     InitializeComponent();
 }