本文整理汇总了C#中ServiceClient类的典型用法代码示例。如果您正苦于以下问题:C# ServiceClient类的具体用法?C# ServiceClient怎么用?C# ServiceClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceClient类属于命名空间,在下文中一共展示了ServiceClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetListGruArtAufEinSprache
//
// GruArtAufEinSprache
//
public static List<GruArtAufEinSprache> GetListGruArtAufEinSprache(GruArtAufEinzelnutzen GruArtAufEinzelnutzen)
{
using (WZNTServices.ServiceClient Client = new ServiceClient())
{
return Client.ReadGruArtAufEinSpracheList(GruArtAufEinzelnutzen).ToList();
}
}
示例2: Session_Start
public void Session_Start(object sender, EventArgs e)
{
ServiceClient sc = new ServiceClient();
sc.Open();
Session["ServiceClient"] = sc;
Session["AuthStatus"] = false;
}
示例3: WorkflowExtensionsBehaviorAddsExtension
public void WorkflowExtensionsBehaviorAddsExtension()
{
WorkflowServiceTestHost host = null;
// TODO: Test with multiple extensions
// TODO: Test with bad config file entries
var serviceEndpoint1 = ServiceTest.GetUniqueEndpointAddress();
using (host = WorkflowServiceTestHost.Open("ServiceExtensionTest.xamlx", serviceEndpoint1))
{
try
{
var proxy = new ServiceClient(ServiceTest.Pipe, serviceEndpoint1);
try
{
proxy.GetData(1);
proxy.Close();
}
catch (Exception)
{
proxy.Abort();
throw;
}
}
finally
{
if (host != null)
{
host.Tracking.Trace();
}
}
}
}
示例4: Index
public ActionResult Index()
{
var client = new ServiceClient();
client.Add(new Company {Id = 5, Name = "ABC Company", Address = "1234 Main Street"});
return View();
}
示例5: FileCollector
public FileCollector(CacheManager cacheManager, FilesModel xmlString)
{
_cacheManager = cacheManager;
// Create a required files object
_requiredFiles = new RequiredFiles();
foreach (var item in xmlString.Items)
{
_requiredFiles.Files.Add(item);
}
// Get the key for later use
hardwareKey = new HardwareKey();
// Make a new filelist collection
_files = new Collection<RequiredFileModel>();
// Create a webservice call
xmdsFile = new ServiceClient();
// Start up the Xmds Service Object
//xmdsFile.Credentials = null;
//xmdsFile.Url = Properties.Settings.Default.Client_xmds_xmds;
//xmdsFile.UseDefaultCredentials = false;
// Hook onto the xmds file complete event
xmdsFile.GetFileCompleted += (XmdsFileGetFileCompleted);
}
示例6: btnAddItem_Click
private void btnAddItem_Click(object sender, EventArgs e)
{
IService service = new ServiceClient();
int id = Int32.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString());
Item = service.GetItemFromID(id);
this.Close();
}
示例7: ObtenerAppsSuscripcion
public static IList<IList<string>> ObtenerAppsSuscripcion()
{
using (ServiceClient SCliente = new ServiceClient())
{
return SCliente.ObtenerAppsSuscripcion();
}
}
示例8: GetAllTransactionsForUser
private static IEnumerable<TransactionInfo> GetAllTransactionsForUser(int window, int userId, int group, ServiceClient sc)
{
var Costs = sc.GetSplitCosts(group, userId, window).ToList();
var Payments = sc.GetSplitPayments(group, userId, window).ToList();
var allSplits = Costs.Union(Payments);
return allSplits;
}
示例9: Actualizar
public void Actualizar(string Nombre, string Apellido, string Contrasegna)
{
using (ServiceClient SCliente = new ServiceClient())
{
SCliente.ActualizarDeveloper(Nombre, Apellido, this.Correo, Contrasegna);
}
}
示例10: IncrementServiceShouldIncrementData
public void IncrementServiceShouldIncrementData()
{
// Arrange
const int InitialData = 1;
const int ExpectedData = 2;
WorkflowServiceTestHost host = null;
try
{
var address = ServiceTest.GetUniqueEndpointAddress();
using (host = WorkflowServiceTestHost.Open("IncrementService.xamlx", address))
{
var proxy = new ServiceClient(ServiceTest.Pipe, address);
int? value = InitialData;
proxy.Increment(ref value);
Assert.AreEqual(ExpectedData, value, "Increment did not correctly increment the value");
}
// The host must be closed before asserting tracking
// Explicitly call host.Close or exit the using block to do this.
// Assert that the Assign activity was executed with an argument named "Value" which contains the value 2
host.Tracking.Assert.ExistsArgValue("Assign", ActivityInstanceState.Closed, "Value", 2);
}
finally
{
if (host != null)
{
host.Tracking.Trace();
}
}
}
示例11: Create
public ActionResult Create(FormCollection collection) {
try {
ServiceReference.JediWS jedi = new JediWS();
List<CaracteristiqueWS> caracList = new List<CaracteristiqueWS>();
using(ServiceReference.ServiceClient service = new ServiceClient()) {
service.getCaracteristiques().ForEach(x => {
if(x.Type == ServiceReference.ETypeCaracteristiqueWS.Jedi) {
caracList.Add(x);
}
});
/* Item1. sur le champs du jedi parce que on a un tuple */
jedi.Id = 0; // Car creation
jedi.Nom = Convert.ToString(collection.Get("Item1.Nom"));
jedi.IsSith = Convert.ToBoolean(collection.Get("Item1.IsSith") != "false"); // Pour que ca marche bien
jedi.Caracteristiques = new List<CaracteristiqueWS>(); // Pour init
string[] checkboxes = collection.GetValues("caracteristiques");
if(checkboxes != null) {
foreach(string s in checkboxes) {
//On a que les ids des box selected, on ajoute les caracteristiques
Int32 caracId = Convert.ToInt32(s);
jedi.Caracteristiques.Add(caracList.First(x => x.Id == caracId));
}
}
service.addJedi(jedi); // Ajout du jedi
}
return RedirectToAction("Index"); // Retour a l'index
} catch {
return RedirectToAction("Index");
}
}
示例12: InsertGruSysStandort
public static void InsertGruSysStandort(List<GruSysStandort> List)
{
using (WZNTServices.ServiceClient Client = new ServiceClient())
{
Client.CreateGruSysStandortList(List.ToArray());
}
}
示例13: InsertGruSysAPiJobl
public static void InsertGruSysAPiJobl(List<GruSysAPiJobl> List)
{
using (WZNTServices.ServiceClient Client = new ServiceClient())
{
Client.CreateGruSysAPiJoblList(List.ToArray());
}
}
示例14: InsertGruArtAufEinzelnutzen
public static void InsertGruArtAufEinzelnutzen(List<GruArtAufEinzelnutzen> List)
{
using (WZNTServices.ServiceClient Client = new ServiceClient())
{
Client.CreateGruArtAufEinzelnutzenList(List.ToArray());
}
}
示例15: RunAsync
public async override Task RunAsync(AuthorizationData authorizationData)
{
try
{
Service = new ServiceClient<ICustomerManagementService>(authorizationData);
var getUserResponse = await GetUserAsync(null);
var user = getUserResponse.User;
// Search for the Bing Ads accounts that the user can access.
var accounts = await SearchAccountsByUserIdAsync(user.Id);
// Optionally if you are enabled for Final Urls, you can update each account with a tracking template.
var accountFCM = new List<KeyValuePair<string, string>>();
accountFCM.Add(new KeyValuePair<string, string>(
"TrackingUrlTemplate",
"http://tracker.example.com/?season={_season}&promocode={_promocode}&u={lpurl}"));
OutputStatusMessage("The user can access the following Bing Ads accounts: \n");
foreach (var account in accounts)
{
OutputAccount(account);
// Optionally you can find out which pilot features the customer is able to use.
// Each account could belong to a different customer, so use the customer ID in each account.
var featurePilotFlags = await GetCustomerPilotFeaturesAsync((long)account.ParentCustomerId);
OutputStatusMessage("Customer Pilot flags:");
OutputStatusMessage(string.Join("; ", featurePilotFlags.Select(flag => string.Format("{0}", flag))));
// Optionally if you are enabled for Final Urls, you can update each account with a tracking template.
// The pilot flag value for Final Urls is 194.
if (featurePilotFlags.Any(pilotFlag => pilotFlag == 194))
{
account.ForwardCompatibilityMap = accountFCM;
await UpdateAccountAsync(account);
OutputStatusMessage(string.Format("Updated the account with a TrackingUrlTemplate: {0}\n",
accountFCM.ToArray().SingleOrDefault(keyValuePair => keyValuePair.Key == "TrackingUrlTemplate").Value));
}
}
}
// Catch authentication exceptions
catch (OAuthTokenRequestException ex)
{
OutputStatusMessage(string.Format("Couldn't get OAuth tokens. Error: {0}. Description: {1}", ex.Details.Error, ex.Details.Description));
}
// Catch Customer Management service exceptions
catch (FaultException<Microsoft.BingAds.CustomerManagement.AdApiFaultDetail> ex)
{
OutputStatusMessage(string.Join("; ", ex.Detail.Errors.Select(error => string.Format("{0}: {1}", error.Code, error.Message))));
}
catch (FaultException<Microsoft.BingAds.CustomerManagement.ApiFault> ex)
{
OutputStatusMessage(string.Join("; ", ex.Detail.OperationErrors.Select(error => string.Format("{0}: {1}", error.Code, error.Message))));
}
catch (Exception ex)
{
OutputStatusMessage(ex.Message);
}
}