public ActionResult SetInfoClient(InfoClient info) { info.no = (int)NOCLIENT; InfoCommande.InfoClient = info; return(new HttpStatusCodeResult(HttpStatusCode.OK)); }
public void UserInfo_0通常データ() { var ret = InfoClient.ParseInfoData(TestHelper.Load(@"Images/Users/Info/default.xml")); Assert.AreEqual(2u, ret.UserId); Assert.AreEqual("戀塚", ret.UserName); }
static void Main(string[] args) { //Krok 1: Utworzenie instancji WCF proxy. InfoClient klient1 = new InfoClient("WSHttpBinding_IInfo1"); Isrv112Client klient2 = new Isrv112Client("WSHttpBinding_Isrv1121"); Service1Client klient3 = new Service1Client("WSHttpBinding_IService1"); // Krok 2: Wywolanie operacji uslugi. string result = klient1.getInfo("Lebiedowska", "Emilia", 242473); int result1 = klient2.oper112(3.9F, 242473, "Lebiedowska"); int result2 = klient2.oper112(3.9F, 242473, "Lebiedowska"); Console.WriteLine("Wynik dla 1 endpointa: " + result); Console.WriteLine("Wynik dla 2 endpointa: " + result1); Console.WriteLine("Wynik dla 3 endpointa z lokalnego serwera: " + result2); // Krok 3: Zamknięcie klienta zamyka polaczenie i czysci zasoby klient1.Close(); klient2.Close(); klient3.Close(); }
public void LockClient(int index) { InfoClient client = arrClient[index]; client.stateClient = "WAITING"; client.client.Send(ConvertToByte("LockClient!")); }
/// <summary> /// Creates a new <see cref="ApiClient"/> object. /// </summary> /// <param name="loggerFactory">The logger factory for the API client. Can be <see langword="null"/>.</param> private ApiClient(ILoggerFactory loggerFactory) { _logger = loggerFactory?.CreateLogger <ApiClient>(); Info = new InfoClient(this); Tags = new TagsClient(this); Snapshot = new SnapshotSubscriptionClient(this, loggerFactory); TagConfiguration = new TagConfigurationClient(this); }
public ActionResult Create() { InfoClientContext db = new InfoClientContext(); ViewBag.StateList = db.StateList; var model = new InfoClient(); return(View(model)); }
/// <summary> /// Méthode principale du process qui appelle les différents contrôles. /// </summary> public new void ExecuteMainProcess() { /*RamdlTool ramdlTool = new RamdlTool(CLIENT_ID, Decimal.ToInt32(WORKFLOW_ID)); * ramdlTool.AnalyseMdbRAMDL();*/ List <IControle> listControl = ListControls.listOfMockControl; string GlobalResult = ParamAppli.StatutOk; sRapport = string.Empty; RapportProcess.Name = this.LibProcess; RapportProcess.Debut = DateTime.Now; RapportProcess.IdClient = CLIENT_ID; RapportProcess.Source = new List <Rapport.Source>(); Rapport.Source RapportSource = new Rapport.Source(); RapportSource.Name = "IdRapport - ProcessAnalyseImpact"; RapportSource.Controle = new List <RControle>(); RapportProcess.Source.Add(RapportSource); RapportProcess.Fin = DateTime.Now; RapportProcess.Result = ParamAppli.TranscoSatut[GlobalResult]; //Si le contrôle est ok on génère les lignes d'historique pour signifier que le workflow est lancé PNPU_H_WORKFLOW historicWorkflow = new PNPU_H_WORKFLOW(); PNPU_H_STEP historicStep = new PNPU_H_STEP(); historicWorkflow.CLIENT_ID = this.CLIENT_ID; historicWorkflow.LAUNCHING_DATE = RapportProcess.Debut; historicWorkflow.WORKFLOW_ID = this.WORKFLOW_ID; InfoClient client = RequestTool.getClientsById(this.CLIENT_ID); historicStep.ID_PROCESS = this.PROCESS_ID; historicStep.ITERATION = 1; historicStep.WORKFLOW_ID = this.WORKFLOW_ID; historicStep.CLIENT_ID = this.CLIENT_ID; historicStep.CLIENT_NAME = client.CLIENT_NAME; historicStep.USER_ID = "PNPUADM"; historicStep.TYPOLOGY = "SAAS DEDIE"; historicStep.LAUNCHING_DATE = RapportProcess.Debut; historicStep.ENDING_DATE = RapportProcess.Fin; historicStep.ID_STATUT = GlobalResult; historicStep.ID_STATUT = GlobalResult; GenerateHistoric(historicWorkflow, historicStep); if (GlobalResult == ParamAppli.StatutOk) { int NextProcess = RequestTool.GetNextProcess(WORKFLOW_ID, ParamAppli.ProcessAnalyseImpact); LauncherViaDIspatcher.LaunchProcess(NextProcess, decimal.ToInt32(this.WORKFLOW_ID), this.CLIENT_ID); } }
public ActionResult Create(InfoClient model) { InfoClientContext db = new InfoClientContext(); if (ModelState.IsValid) { db.InfoClients.Add(model); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.StateList = db.StateList; return(View(model)); }
public void UserInfo_3中国語データ() { var ret = InfoClient.ParseInfoData(TestHelper.Load(@"Users/UserInfo/repo-zh-tw.html")); Assert.AreEqual("ℳກ੮ວܬ୧", ret.Name); Assert.AreEqual(20929324u, ret.Id); Assert.AreEqual("原宿", ret.JoinedVersion); Assert.IsTrue(ret.IsPremium); Assert.AreEqual(( ushort )0, ret.FavoriteCount); Assert.AreEqual(( ushort )85, ret.StampCount); Assert.AreEqual(( ushort )2, ret.NicoruCount); Assert.AreEqual(0u, ret.Points); Assert.AreEqual(0u, ret.CreatorScore); }
private static CounterCreationDataCollection CreateCounterCreationDataCollection(KeyValuePair <string, Dictionary <string, string> > item) { //"#Memory used_memory 1234" var ccdc = new CounterCreationDataCollection(); foreach (var classitem in item.Value) { var subitems = InfoClient.GetSubItems(classitem.Value); CounterCreationData data1 = new CounterCreationData(classitem.Key, classitem.Key, PerformanceCounterType.NumberOfItems32); ccdc.Add(data1); } if (ccdc.Count == 0) { return(null); } return(ccdc); }
public bool PaymentNetFee(string nameClient) { InfoClient currentClient = GetInfoClient(nameClient, USING); if (currentClient == null) { return(false); } try { currentClient.client.Send(ConvertToByte("Payment")); currentClient.stateClient = wait; currentClient.startTime = new DateTime(); return(true); } catch { return(false); } }
public bool UsingWithGuess(string nameClient) { InfoClient currentClient = GetInfoClient(nameClient, wait); if (currentClient == null) { return(false); } try { currentClient.client.Send(ConvertToByte("UseClient")); currentClient.stateClient = USING; currentClient.startTime = DateTime.Now; return(true); } catch { return(false); } }
private void Initialize(IPictureparkServiceSettings settings, HttpClient httpClient) { Output = new OutputClient(settings, httpClient); OutputFormat = new OutputFormatClient(settings, httpClient); BusinessProcess = new BusinessProcessClient(settings, httpClient); DocumentHistory = new DocumentHistoryClient(settings, httpClient); JsonSchema = new JsonSchemaClient(settings, httpClient); ContentPermissionSet = new ContentPermissionSetClient(settings, httpClient); SchemaPermissionSet = new SchemaPermissionSetClient(settings, httpClient); Share = new ShareClient(settings, httpClient); User = new UserClient(settings, httpClient); UserRole = new UserRoleClient(settings, httpClient); Info = new InfoClient(settings, httpClient); Schema = new SchemaClient(Info, BusinessProcess, settings, httpClient); Transfer = new TransferClient((BusinessProcessClient)BusinessProcess, settings, httpClient); ListItem = new ListItemClient((BusinessProcessClient)BusinessProcess, settings, httpClient); LiveStream = new LiveStreamClient(settings, httpClient); Content = new ContentClient((BusinessProcessClient)BusinessProcess, settings, httpClient); Profile = new ProfileClient(settings, httpClient); SchemaTransfer = new SchemaTransferClient(settings, httpClient); Channel = new ChannelClient(settings, httpClient); }
//private static void UpdatePC(Dictionary<string, Dictionary<string, string>> data, bool setupCounter = false) //{ // foreach (var cat in data) // { // var catname = CategoryNamePrefix + cat.Key; // if (!AllPCC.ContainsKey(catname)) // { // continue; // } // var pcc = AllPCC[catname]; // //var allcounters = pcc.GetCounters().ToDictionary(a => a.CounterName); // PerformanceCounter[] allcounters; // //if (setupCounter) // //{ // allcounters = allCounters.Where(a => a.Value.CategoryName == catname).Select(a => a.Value).ToArray(); // //} // //else // //{ // // allcounters = pcc.GetCounters(InstanceName); // //} // var allitems = cat.Value; // for (int i = 0; i < allcounters.Length; i++) // { // var pc = allcounters[i]; // string strval = null; // if (cat.Value.TryGetValue(pc.CounterName, out strval)) // { // double v; // pc.ReadOnly = false; // if (setupCounter) // { // pc.InstanceName = InstanceName; // } // try // { // if (InfoClient.StringToNumber(strval, out v)) // { // pc.RawValue = (long)v; // } // else // { // pc.RawValue = 0; // } // } // catch (Exception ex) // { // System.Diagnostics.Debug.Assert(false, pc.CounterName); // } // } // else // { // System.Diagnostics.Debug.Assert(false, pc.CounterName); // } // } // } //} private static void UpdatePC(Dictionary <string, Dictionary <string, string> > data) { foreach (var cat in data) { var catname = CategoryNamePrefix + cat.Key; if (!AllPCC.ContainsKey(catname)) { continue; } foreach (var item in cat.Value) { PerformanceCounter pc; if (allCounters.TryGetValue(item.Key, out pc)) { string strval = item.Value; double v; try { if (InfoClient.StringToNumber(strval, out v)) { pc.RawValue = (long)v; } else { pc.RawValue = 0; } } catch (Exception ex) { System.Diagnostics.Debug.Assert(false, pc.CounterName); } } else { //do nothing } } } }
public float TotalPrice(int index) { InfoClient client = arrClient[index]; if (client.stateClient == "MEMBER USING") { return(0); } TimeSpan time = DateTime.Now.Subtract(client.startTime); client.stateClient = "WAITING"; client.client.Send(ConvertToByte("PAYMENT")); float total = 0; string useTime = time.ToString(); float priceperminutes = 100; int minutes = ChangeUseTimeToMinutes(useTime); if (minutes == 0 || minutes < 20) { return(2000); } total = total + minutes * priceperminutes; return(total); }
/// <summary> /// Méthode principale du process qui appelle les différents contrôles. /// </summary> public new void ExecuteMainProcess() { List <IControle> listControl = new List <IControle>(); string GlobalResult = ParamAppli.StatutOk; string SourceResult = ParamAppli.StatutOk; string statutControle; listMDB = new List <string>(); sRapport = string.Empty; string[] tMDB = null; RControle RapportControle; Rapport.Source RapportSource; string[] listClientId = CLIENT_ID.Split(','); //POUR TEST /*this.CLIENT_ID = "101";*/ this.STANDARD = true; //this.TYPOLOGY = ParamAppli.ListeInfoClient[listClientId.First()].TYPOLOGY; Logger.Log(this, ParamAppli.StatutInfo, " Debut du process " + this.ToString()); RapportProcess.Name = this.LibProcess; RapportProcess.Debut = DateTime.Now; RapportProcess.IdClient = CLIENT_ID; RapportProcess.Source = new List <Rapport.Source>(); PNPUTools.GereMDBDansBDD gereMDBDansBDD = new PNPUTools.GereMDBDansBDD(); gereMDBDansBDD.ExtraitFichiersMDBBDD(ref tMDB, WORKFLOW_ID, ParamAppli.DossierTemporaire, ParamAppli.ConnectionStringBaseAppli); foreach (String sFichier in tMDB) { listMDB.Add(sFichier); } GetListControle(ref listControl); foreach (string sMDB in listMDB) { MDBCourant = sMDB; RapportSource = new Rapport.Source(); RapportSource.Name = System.IO.Path.GetFileName(sMDB); RapportSource.Controle = new List <RControle>(); SourceResult = ParamAppli.StatutOk; foreach (IControle controle in listControl) { RapportControle = new RControle(); RapportControle.Name = controle.GetLibControle(); RapportControle.Tooltip = controle.GetTooltipControle(); RapportControle.Message = new List <string>(); RapportControleCourant = RapportControle; Logger.Log(this, controle, ParamAppli.StatutInfo, "Début du contrôle " + controle.ToString()); statutControle = controle.MakeControl(); Logger.Log(this, controle, statutControle, "Fin du contrôle " + controle.ToString()); //ERROR > WARNING > OK if (GlobalResult != ParamAppli.StatutError && statutControle == ParamAppli.StatutError) { GlobalResult = statutControle; } else if (GlobalResult != ParamAppli.StatutError && statutControle == ParamAppli.StatutWarning) { GlobalResult = statutControle; } if (SourceResult != ParamAppli.StatutError && statutControle == ParamAppli.StatutError) { SourceResult = statutControle; } else if (SourceResult != ParamAppli.StatutError && statutControle == ParamAppli.StatutWarning) { SourceResult = statutControle; } RapportControle.Result = ParamAppli.TranscoSatut[statutControle]; RapportSource.Controle.Add(RapportControle); } RapportSource.Result = ParamAppli.TranscoSatut[SourceResult]; RapportProcess.Source.Add(RapportSource); } // Le controle des dépendance est à part puisqu'il traite tous les mdb en une fois ControleDependancesMDB cdmControleDependancesMDB = new ControleDependancesMDB(this); RapportSource = new Rapport.Source(); RapportSource.Name = "Contrôle des dépendances inter packages"; RapportSource.Controle = new List <RControle>(); RapportControle = new RControle(); RapportControle.Name = cdmControleDependancesMDB.ToString(); RapportControle.Message = new List <string>(); RapportControleCourant = RapportControle; Logger.Log(this, cdmControleDependancesMDB, ParamAppli.StatutInfo, "Début du contrôle " + cdmControleDependancesMDB.ToString()); statutControle = cdmControleDependancesMDB.MakeControl(); Logger.Log(this, cdmControleDependancesMDB, statutControle, "Fin du contrôle " + cdmControleDependancesMDB.ToString()); RapportControle.Result = ParamAppli.TranscoSatut[statutControle]; //RapportSource2.Controle.Add(RapportControle2); RapportProcess.Source.Add(RapportSource); // Génération du fichier CSV des dépendances StreamWriter swFichierDep = new StreamWriter(Path.Combine(ParamAppli.DossierTemporaire, this.WORKFLOW_ID.ToString("000000") + "_DEPENDANCES.csv")); foreach (string sLig in RapportControle.Message) { swFichierDep.WriteLine(sLig); } swFichierDep.Close(); // Je supprime les messages pour qu'ils ne sortent pas dans le report JSON RapportControle.Message.Clear(); RapportSource.Result = RapportControle.Result; // Recherche des dépendances avec les tâches CCT sur la base de référence ControleRechercheDependancesRef crdrControleRechercheDependancesRef = new ControleRechercheDependancesRef(this); RapportSource = new Rapport.Source(); RapportSource.Name = "Recherche des dépendances avec les tâches CCT sur la base de référence"; RapportSource.Controle = new List <RControle>(); RapportControle = new RControle(); RapportControle.Name = cdmControleDependancesMDB.ToString(); RapportControle.Message = new List <string>(); RapportControleCourant = RapportControle; Logger.Log(this, crdrControleRechercheDependancesRef, ParamAppli.StatutInfo, "Début du contrôle " + crdrControleRechercheDependancesRef.ToString()); statutControle = crdrControleRechercheDependancesRef.MakeControl(); Logger.Log(this, crdrControleRechercheDependancesRef, statutControle, "Fin du contrôle " + crdrControleRechercheDependancesRef.ToString()); RapportControle.Result = ParamAppli.TranscoSatut[statutControle]; //RapportSource2.Controle.Add(RapportControle2); RapportProcess.Source.Add(RapportSource); // Je supprime les messages pour qu'ils ne sortent pas dans le report JSON RapportControle.Message.Clear(); RapportSource.Result = RapportControle.Result; RapportProcess.Fin = DateTime.Now; RapportProcess.Result = ParamAppli.TranscoSatut[GlobalResult]; Logger.Log(this, GlobalResult, "Fin du process " + this.ToString()); //Si le contrôle est ok on génère les lignes d'historique pour signifier que le workflow est lancé //string[] listClientId = new string[] { "DASSAULT SYSTEME", "SANEF", "DRT", "GALILEO", "IQERA", "ICL", "CAMAIEU", "DANONE", "HOLDER", "OCP", "UNICANCER", "VEOLIA" }; //string[] listClientId = new string[] { "111" };//{ "DASSAULT SYSTEME", "SANEF", "DRT", "GALILEO", "IQERA", "ICL", "CAMAIEU", "DANONE", "HOLDER", "OCP", "UNICANCER", "VEOLIA" }; PNPU_H_WORKFLOW historicWorkflow = new PNPU_H_WORKFLOW(); historicWorkflow.CLIENT_ID = this.CLIENT_ID; historicWorkflow.LAUNCHING_DATE = RapportProcess.Debut; historicWorkflow.ENDING_DATE = new DateTime(1800, 1, 1); historicWorkflow.STATUT_GLOBAL = "IN PROGRESS"; historicWorkflow.WORKFLOW_ID = this.WORKFLOW_ID; RequestTool.CreateUpdateWorkflowHistoric(historicWorkflow); foreach (string clientId in listClientId) { InfoClient client = RequestTool.getClientsById(clientId); PNPU_H_STEP historicStep = new PNPU_H_STEP(); historicStep.ID_PROCESS = this.PROCESS_ID; historicStep.ITERATION = 1; historicStep.WORKFLOW_ID = this.WORKFLOW_ID; historicStep.CLIENT_ID = clientId; historicStep.CLIENT_NAME = client.CLIENT_NAME; historicStep.USER_ID = "PNPUADM"; historicStep.LAUNCHING_DATE = RapportProcess.Debut; historicStep.ENDING_DATE = RapportProcess.Fin; historicStep.TYPOLOGY = "SAAS DEDIE"; historicStep.ID_STATUT = GlobalResult; RequestTool.CreateUpdateStepHistoric(historicStep); } // TEST ajout MDB //gereMDBDansBDD.AjouteFichiersMDBBDD(new string[] { "D:\\PNPU\\Tests_RAMDL\\test.mdb" }, WORKFLOW_ID, ParamAppli.DossierTemporaire, ParamAppli.ConnectionStringBaseAppli, CLIENT_ID,1); int NextProcess = RequestTool.GetNextProcess(WORKFLOW_ID, ParamAppli.ProcessControlePacks); foreach (string clienId in listClientId) { LauncherViaDIspatcher.LaunchProcess(NextProcess, decimal.ToInt32(this.WORKFLOW_ID), clienId); } }
/// <summary> /// Méthode principale du process qui appelle les différents contrôles. /// </summary> public new void ExecuteMainProcess() { List <IControle> listControl = ListControls.listOfMockControl; string GlobalResult = ParamAppli.StatutOk; sRapport = string.Empty; RapportProcess.Name = this.ToString(); RapportProcess.Debut = DateTime.Now; RapportProcess.IdClient = CLIENT_ID; RapportProcess.Source = new List <Rapport.Source>(); Rapport.Source RapportSource = new Rapport.Source(); RapportSource.Name = "IdRapport - ProcessMock"; RapportSource.Controle = new List <RControle>(); foreach (IControle controle in listControl) { controle.SetProcessControle(this); RControle RapportControle = new RControle(); RapportControle.Name = controle.GetLibControle(); RapportControle.Tooltip = controle.GetTooltipControle(); RapportControle.Message = new List <string>(); RapportControleCourant = RapportControle; string statutControle = controle.MakeControl(); //ERROR > WARNING > OK if (GlobalResult != ParamAppli.StatutError && statutControle == ParamAppli.StatutError) { GlobalResult = statutControle; } else if (GlobalResult != ParamAppli.StatutError && statutControle == ParamAppli.StatutWarning) { GlobalResult = statutControle; } RapportControle.Result = ParamAppli.TranscoSatut[statutControle]; RapportSource.Controle.Add(RapportControle); } RapportProcess.Source.Add(RapportSource); RapportProcess.Fin = DateTime.Now; //Si le contrôle est ok on génère les lignes d'historique pour signifier que le workflow est lancé PNPU_H_WORKFLOW historicWorkflow = new PNPU_H_WORKFLOW(); PNPU_H_STEP historicStep = new PNPU_H_STEP(); historicWorkflow.CLIENT_ID = this.CLIENT_ID; historicWorkflow.LAUNCHING_DATE = RapportProcess.Debut; historicWorkflow.WORKFLOW_ID = this.WORKFLOW_ID; InfoClient client = RequestTool.getClientsById(this.CLIENT_ID); historicStep.ID_PROCESS = this.PROCESS_ID; historicStep.ITERATION = 1; historicStep.WORKFLOW_ID = this.WORKFLOW_ID; historicStep.CLIENT_ID = this.CLIENT_ID; historicStep.CLIENT_NAME = client.CLIENT_NAME; historicStep.USER_ID = "PNPUADM"; historicStep.TYPOLOGY = "SAAS DEDIE"; historicStep.LAUNCHING_DATE = RapportProcess.Debut; historicStep.ENDING_DATE = RapportProcess.Fin; historicStep.ID_STATUT = GlobalResult; GenerateHistoric(historicWorkflow, historicStep); if (GlobalResult == ParamAppli.StatutOk) { int NextProcess = RequestTool.GetNextProcess(WORKFLOW_ID, -1); LauncherViaDIspatcher.LaunchProcess(NextProcess, decimal.ToInt32(this.WORKFLOW_ID), this.CLIENT_ID); } }