public JsonResult ViewIntegrityChecksColDetMulti( string SPName, string NeededReportParamsFromObjMas, string NeededReportParams, string SelectedReportObjKy) { ApiOperation apiOpr = new ApiOperation(); int UsrKy = HTNSession.UsrKy; int CKy = HTNSession.CKy; List <List <Object> > list = new List <List <Object> >(); list = apiOpr.ViewIntegrityChecksColDetMulti( SPName, HTNSession.Environment, CKy.ToString(), UsrKy.ToString(), NeededReportParamsFromObjMas, NeededReportParams, SelectedReportObjKy ); return(Json(list, JsonRequestBehavior.AllowGet)); }
private Task <LiveOperationResult> ExecuteApiOperation(ApiOperation op, CancellationToken ct) { if (this.Session == null) { throw new LiveConnectException(ApiOperation.ApiClientErrorCode, ResourceHelper.GetString("UserNotLoggedIn")); } var tcs = new TaskCompletionSource <LiveOperationResult>(); op.OperationCompletedCallback = (LiveOperationResult opResult) => { if (opResult.IsCancelled) { tcs.TrySetCanceled(); } else if (opResult.Error != null) { tcs.TrySetException(opResult.Error); } else { tcs.TrySetResult(opResult); } }; ct.Register(op.Cancel); op.Execute(); return(tcs.Task); }
protected override void OnHandledInternal(DataReceivedUnit ou) { ou.SetNextActionItems(); byte[] command = ReceivedAchData.Command; var scheme = (SecuritySchemes)ReceivedAchData.SecurityScheme; bool isSuportedScheme = IsSupportedScheme(_network, command, scheme); if (command != null && command.Length > 1 && isSuportedScheme) { if (command[1] == COMMAND_CLASS_BASIC.BASIC_GET.ID) { ApiOperation sendData = null; var data = new COMMAND_CLASS_BASIC.BASIC_REPORT() { value = Value }; sendData = new SendDataExOperation(ReceivedAchData.DestNodeId, ReceivedAchData.SrcNodeId, data, TxOptions, TxSecOptions, scheme, TxOptions2); ou.SetNextActionItems(sendData); } else if (command[1] == COMMAND_CLASS_BASIC.BASIC_SET.ID) { var basicSetCommand = (COMMAND_CLASS_BASIC.BASIC_SET)command; Value = basicSetCommand.value; } } }
public ApiOperation Convert(Transaction transaction, ApiUser user, List <ApiImportance> importances, List <ApiFrequency> frequencies, List <ApiTag> tags, List <ApiTransactionType> transactionsType, List <ApiTransferType> transfersType) { ApiOperation result; var schematic = FindSchematicInPattern(transaction); if (transaction.Amount < 0) { result = new ApiOperation(null, null, user, -1 * transaction.Amount, transactionsType[1], transfersType[1], null, null, transaction.DateTime.ToString("yyyy-MM-dd"), "", new List <ApiRelTag>().ToArray(), new List <ApiOperationDetails>().ToArray(), transaction.ContractorData + "; " + transaction.Title); } else { result = new ApiOperation(null, null, user, transaction.Amount, transactionsType[0], transfersType[1], null, null, transaction.DateTime.ToString("yyyy-MM-dd"), "", new List <ApiRelTag>().ToArray(), new List <ApiOperationDetails>().ToArray(), transaction.ContractorData + "; " + transaction.Title); } if (schematic != null) { result.Description = schematic.Context.Description; result.Frequency = ConvertStringHelper.ConvertToFrequency(schematic.Context.Frequency, frequencies); result.Importance = ConvertStringHelper.ConvertToImportance(schematic.Context.Importance, importances); var tagsList = new List <ApiRelTag>(); foreach (var tagString in schematic.Context.Tags) { var tag = ConvertStringHelper.ConvertToTag(tagString, tags); if (tag != null) { tagsList.Add(new ApiRelTag(null, tag)); } } result.Tags = tagsList.ToArray(); } return(result); }
public MapController(IConfiguration iconfiguration) { _iconfiguration = iconfiguration; string url = _iconfiguration.GetSection("APIConnectionStrings").GetSection("URI").Value; dbOpr = new ApiOperation(url); }
public override ActionBase SubstituteActionInternal(ApiOperation action) { ActionBase ret = null; if (IsActive) { var sendDataOperation = action as SendDataOperation; if (TransportServiceManagerInfo.MaxCmdSize > 0 && sendDataOperation != null && sendDataOperation.Data != null && sendDataOperation.Data.Length > TransportServiceManagerInfo.MaxCmdSize) { if (sendDataOperation.Data[0] != COMMAND_CLASS_TRANSPORT_SERVICE_V2.ID && sendDataOperation.Data[0] != COMMAND_CLASS_FIRMWARE_UPDATE_MD.ID && !((ApiOperation)action).SubstituteSettings.HasFlag(SubstituteFlags.DenyTransportService)) { byte nodeId = sendDataOperation.NodeId; if (nodeId > 0x00 && nodeId < 0xFF && IsTransportServiceSupported(nodeId)) { ret = new SendDataTransportTask(TransportServiceManagerInfo, nodeId, sendDataOperation.Data, sendDataOperation.TxOptions); } } } } return(ret); }
public RequestParameters( ApiOperation operation, int itemPage = 1) { this.Operation = operation; this.ItemPage = itemPage; }
private Task <LiveOperationResult> ExecuteApiOperation(ApiOperation op, CancellationToken ct) { var tcs = new TaskCompletionSource <LiveOperationResult>(); op.OperationCompletedCallback = (LiveOperationResult opResult) => { if (opResult.IsCancelled) { tcs.TrySetCanceled(); } else if (opResult.Error != null) { tcs.TrySetException(opResult.Error); } else { tcs.TrySetResult(opResult); } }; ct.Register(op.Cancel); op.Execute(); return(tcs.Task); }
public Task <LiveOperationResult> UploadAsync(string path, IFileSource fileSource, OverwriteOption option, IBackgroundTransferProvider btu, CancellationToken ct, IProgress <LiveOperationProgress> progress) { if (string.IsNullOrEmpty(path)) { throw new ArgumentException( "path", String.Format(CultureInfo.CurrentUICulture, ResourceHelper.GetString("UrlInvalid"), "path")); } if (null == fileSource) { throw new ArgumentNullException( "fileSource", String.Format(CultureInfo.CurrentUICulture, ResourceHelper.GetString("InvalidNullParameter"), "fileSource")); } if (null != fileSource && string.IsNullOrEmpty(fileSource.Filename)) { throw new ArgumentException( "fileName", String.Format(CultureInfo.CurrentUICulture, ResourceHelper.GetString("InvalidNullOrEmptyParameter"), "fileName")); } if (null == btu) { btu = new Microsoft.Live.Transfers.BasicTransferProvider(); } ApiOperation op = btu.GetUploadOperation(this, this.GetResourceUri(path, ApiMethod.Upload), fileSource, option, progress, syncContext); return(this.ExecuteApiOperation(op, ct)); }
public bool isValidBackEndUserLogedin(ApiOperation operations) { if (_cookie != null) { try { /* Lets Read the cookie and try to dcrypt data stored int the cookie * Then Lets Load the User From Db and authenticate.... */ string userId = StringCipher.Decrypt(_cookie.Values["UsrId"], AppSettings.EncKey); string password = StringCipher.Decrypt(_cookie.Values["userAuthMeth"], AppSettings.EncKey); // User user = operations.GetUserByUserName(194,) // return user.AuthenticateUser(password); } catch (Exception exp) { /// Something went wrong... /// Lets Unset The Cookie; UnsetCookie(); return(false); } } return(false); }
private ApiOperation GetApiOperation(string path, ApiMethod method, string body) { if (path == null) { throw new ArgumentNullException("path"); } if (string.IsNullOrWhiteSpace(path)) { throw new ArgumentException("path"); } if (IsAbsolutePath(path)) { throw new ArgumentException( String.Format(CultureInfo.CurrentUICulture, ResourceHelper.GetString("RelativeUrlRequired"), "path"), "path"); } Uri apiUri = this.GetResourceUri(path, method); if (this.Session == null) { throw new LiveConnectException(ApiOperation.ApiClientErrorCode, ResourceHelper.GetString("UserNotLoggedIn")); } ApiOperation operation = null; switch (method) { case ApiMethod.Get: case ApiMethod.Delete: operation = new ApiOperation(this, apiUri, method, null, null); break; case ApiMethod.Post: case ApiMethod.Put: case ApiMethod.Copy: case ApiMethod.Move: if (body == null) { throw new ArgumentNullException("body"); } if (string.IsNullOrWhiteSpace(body)) { throw new ArgumentException("body"); } operation = new ApiWriteOperation(this, apiUri, method, body, null); break; default: Debug.Assert(false, "method not suppported."); break; } return(operation); }
public void ToFile() { var area = FocusOnSegmentName.EnsureFirstCharacterToUpper(); var resultName = ApiOperation.GetOperationName() + NameConstants.ContractResult; var file = DirectoryInfoHelper.GetCsFileNameForContract(ApiProjectOptions.PathForContracts, area, NameConstants.ContractResults, resultName); ToFile(new FileInfo(file)); }
public void ToFile() { var area = FocusOnSegmentName.EnsureFirstCharacterToUpper(); var interfaceName = "I" + ApiOperation.GetOperationName() + NameConstants.ContractHandler; var file = DirectoryInfoHelper.GetCsFileNameForContract(ApiProjectOptions.PathForContracts, area, NameConstants.ContractInterfaces, interfaceName); ToFile(new FileInfo(file)); }
public LogKeyValueItem ToFile() { var area = FocusOnSegmentName.EnsureFirstCharacterToUpper(); var endpointName = ApiOperation.GetOperationName() + NameConstants.Endpoint; var file = Util.GetCsFileNameForContract(ApiProjectOptions.PathForEndpoints, area, endpointName); return(TextFileHelper.Save(file, ToCodeAsString())); }
private SetLearnModeSecureOperation(SecurityManagerInfo securityManagerInfo, ApiOperation learnMode, Action resetSecurityCallback, int timeoutMs) : base(false, learnMode.SerialApiCommands, false) { _timeoutMs = timeoutMs; _securityManagerInfo = securityManagerInfo; _learnMode = learnMode; _resetSecurityCallback = resetSecurityCallback; _previousHomeId = _securityManagerInfo.Network.HomeId; }
public LogKeyValueItem ToFile() { var area = FocusOnSegmentName.EnsureFirstCharacterToUpper(); var parameterName = ApiOperation.GetOperationName() + NameConstants.ContractParameters; var file = UseOwnFolder ? Util.GetCsFileNameForContract(ApiProjectOptions.PathForContracts, area, NameConstants.ContractParameters, parameterName) : Util.GetCsFileNameForContract(ApiProjectOptions.PathForContracts, area, parameterName); return(TextFileHelper.Save(file, ToCodeAsString())); }
public JsonResult AdrKyToItm_SelectMob(int AdrKy) { int CKy = HTNSession.CKy; int UsrKy = HTNSession.UsrKy; ApiOperation apiOpr = new ApiOperation(); List <AdrUnit> list = new List <AdrUnit>(); list = apiOpr.AdrKyToItm_SelectMob(HTNSession.Environment, CKy, UsrKy, AdrKy); return(Json(list, JsonRequestBehavior.AllowGet)); }
public JsonResult PrjTaskLocMob(int ObjKy, int TrnTypKy, int PreKy, int PrjKy) { int CKy = HTNSession.CKy; int UsrKy = HTNSession.UsrKy; ApiOperation apiOpr = new ApiOperation(); List <PrjTaskLocMob> list = new List <PrjTaskLocMob>(); list = apiOpr.PrjTaskLocMob(HTNSession.Environment, CKy, UsrKy, ObjKy, TrnTypKy, PreKy, PrjKy); return(Json(list, JsonRequestBehavior.AllowGet)); }
public JsonResult SubConPopUp(int refItmTrnKy) { int CKy = HTNSession.CKy; int UsrKy = HTNSession.UsrKy; ApiOperation apiOpr = new ApiOperation(); List <ResDetailPop> list = new List <ResDetailPop>(); list = apiOpr.SubConPopUp(HTNSession.Environment, CKy, UsrKy, refItmTrnKy); return(Json(list, JsonRequestBehavior.AllowGet)); }
public ActionResult Patients() { int pharmacyId = GetPharmacyId(); ApiOperation recipeOp = ApiOperation.GetInstance(); patientList = recipeOp.GetPatients("/getpatientsforpharmacy", new Dictionary <string, string> { { "PharmacyId", pharmacyId.ToString() } }); return(View(patientList)); }
public void TestExecute() { WebRequestFactory.Current = new TestWebRequestFactory(); LiveConnectClient connectClient = new LiveConnectClient(new LiveConnectSession()); Uri requestUri = new Uri("http://foo.com"); ApiMethod apiMethod = ApiMethod.Copy; string body = string.Empty; SynchronizationContextWrapper syncContextWrapper = SynchronizationContextWrapper.Current; var apiOperation = new ApiOperation(connectClient, requestUri, apiMethod, body, syncContextWrapper); }
public void ToFile() { var area = FocusOnSegmentName.EnsureFirstCharacterToUpper(); var parameterName = ApiOperation.GetOperationName() + NameConstants.ContractParameters; var file = IsForClient ? DirectoryInfoHelper.GetCsFileNameForContract(ApiProjectOptions.PathForContracts, area, NameConstants.ClientRequestParameters, parameterName) : UseOwnFolder ? DirectoryInfoHelper.GetCsFileNameForContract(ApiProjectOptions.PathForContracts, area, NameConstants.ContractParameters, parameterName) : DirectoryInfoHelper.GetCsFileNameForContract(ApiProjectOptions.PathForContracts, area, parameterName); ToFile(new FileInfo(file)); }
public IActionResult Post([FromBody] ApiOperation operation) { //TODO: validators try { _repository.UpdateOperationComplex(operation); return(Created($"api/operations/{1}", operation)); //TODO: not hardcode 1 } catch (Exception) { return(BadRequest("Failed")); } }
public ActionResult Recipes() { int doctorId = GetDoctorID(); ApiOperation recipeOp = ApiOperation.GetInstance(); recipesList = recipeOp.GetRecipes("/getmedicinesfordoctor", new Dictionary <string, string> { { "doctorId", doctorId.ToString() } }); return(View(recipesList)); }
public ActionResult Recipes(bool isDelivered = false) { int pharmacyId = GetPharmacyId(); int delivered = isDelivered ? 1 : 0; ApiOperation recipeOp = ApiOperation.GetInstance(); recipeList = recipeOp.GetRecipes("/getmedicinesforpharmacy", new Dictionary <string, string> { { "PharmacyID", pharmacyId.ToString() }, { "IsDelivered", delivered.ToString() } }); return(View(recipeList)); }
public ActionResult WriteRecipe(FormCollection form) { ApiOperation reOP = ApiOperation.GetInstance(); string doctorId = GetDoctorID().ToString(); var result = ApiConnect.Post("/createrecipefordoctor", new Dictionary <string, string> { { "doctorId", doctorId.ToString() }, { "tcNo", form["txtTcNo"] } }); if (Convert.ToInt16(result.Result) == -1) { ToastrService.AddToUserQueue(new Toastr("Hasta Bulunamadı", "Reçete Yazılamadı.", ToastrType.Error)); return(RedirectToAction("Recipes", "Doctor")); } int i = Convert.ToInt32(form["counter"]); for (int j = 1; j <= i; j++) { string medName, medType, medUsage; medName = form["txtMedName" + j]; medType = form["txtMedType" + j]; medUsage = form["txtMedUsage" + j]; var result2 = ApiConnect.Post("/addmedicinetorecipefordoctor", new Dictionary <string, string> { { "medName", medName }, { "medType", medType }, { "medUsage", medUsage } }); } if (Convert.ToInt32(result.Result) == 0) { ToastrService.AddToUserQueue(new Toastr("Reçete Başarılı Bir Şekilde Eklendi", "Reçete Yazıldı.", ToastrType.Success)); return(RedirectToAction("Recipes", "Doctor", new { @id = doctorId })); } else { ToastrService.AddToUserQueue(new Toastr("Reçete Eklenemedi", "Reçete Yazılamadı.", ToastrType.Error)); } return(null); }
public bool GenerateCode() { var resultTypeName = ApiOperation.GetOperationName() + NameConstants.ContractResult; // Create compilationUnit var compilationUnit = SyntaxFactory.CompilationUnit(); // Create a namespace var @namespace = SyntaxProjectFactory.CreateNamespace( ApiProjectOptions, NameConstants.Contracts, FocusOnSegmentName); // Create class var classDeclaration = SyntaxClassDeclarationFactory.CreateWithInheritClassTypeAndSuppressMessageAttributeByCheckId( resultTypeName, "ResultBase", 1062, "Should not throw ArgumentNullExceptions from implicit operators.") .AddGeneratedCodeAttribute(ApiProjectOptions.ToolName, ApiProjectOptions.ToolVersion.ToString()) .WithLeadingTrivia(SyntaxDocumentationFactory.CreateForResults(ApiOperation, FocusOnSegmentName)); // Create members var memberDeclarations = CreateMembers(resultTypeName); // Add members to class classDeclaration = memberDeclarations.Aggregate( classDeclaration, (current, memberDeclaration) => current.AddMembers(memberDeclaration)); // Add using statement to compilationUnit compilationUnit = compilationUnit.AddUsingStatements( ProjectContractResultFactory.CreateUsingList( ApiOperation.Responses, ApiProjectOptions.ApiOptions.Generator.Response.UseProblemDetailsAsDefaultBody)); // Add the class to the namespace. @namespace = @namespace.AddMembers(classDeclaration); // Add namespace to compilationUnit compilationUnit = compilationUnit.AddMembers(@namespace); // Set code property Code = compilationUnit; return(true); }
public ActionResult Recipes(bool isDelivered = false) { int delivered = isDelivered ? 1: 0; ViewData["delivered"] = delivered.ToString(); int patientId = GetPatientId(); ApiOperation recipeOp = ApiOperation.GetInstance(); recipesList = recipeOp.GetRecipes("/getmedicinesforpatient", new Dictionary <string, string> { { "PatientId", patientId.ToString() }, { "IsDelivered", delivered.ToString() } }); return(View(recipesList)); }
public ApiOperation[] CreateOperation(ApiDescription apiDesc) { var responseClass = CalculateResponseClass(apiDesc.ActionDescriptor.ReturnType); var remarks = _docProvider.GetRemarks(apiDesc.ActionDescriptor); var parameters = _parameterFactory.CreateParameters(apiDesc.ParameterDescriptions, apiDesc.RelativePath); var rApiOperation = new ApiOperation() { httpMethod = apiDesc.HttpMethod.ToString(), nickname = apiDesc.ActionDescriptor.ActionName, responseClass = responseClass, summary = apiDesc.Documentation, notes = remarks, parameters = parameters }; return(new[] { rApiOperation }); }
public ApiOperation ConvertToApiEntity(DalOperation dataEntity) { var frequency = _frequencies.First(f => f.Id == dataEntity.FrequencyId); var importance = _importances.First(f => f.Id == dataEntity.ImportanceId); var transferType = _transferTypes.First(f => f.Id == dataEntity.TransferTypeId); var transactionType = _transactionTypes.First(f => f.Id == dataEntity.TransactionTypeId); var dalTags = _dalRelations.Where(t => t.OperationId == dataEntity.Id); var tags = tagMapper.ConvertToApiEntitiesCollection(dalTags).ToArray(); var dalDetails = _dalDetails.Where(d => d.OperationId == dataEntity.Id); var details = new OperationDetailsMapper().ConvertToApiEntitiesCollection(dalDetails).ToArray(); var result = new ApiOperation(dataEntity.Id, dataEntity.ParentId, _user, dataEntity.Amount, transactionType, transferType, frequency, importance, dataEntity.Date, dataEntity.ReceiptPath, tags, details, dataEntity.Description); result.IsDirty = dataEntity.IsDirty; result.IsMarkForDeletion = dataEntity.IsMarkForDeletion; return(result); }
protected override void OnHandledInternal(DataReceivedUnit ou) { ou.SetNextActionItems(); byte nodeId = ReceivedAchData.SrcNodeId; byte[] command = ReceivedAchData.Command; var scheme = (SecuritySchemes)ReceivedAchData.SecurityScheme; bool isSuportedScheme = IsSupportedScheme(_network, command, scheme); if (command != null && command.Length > 1 && isSuportedScheme) { if (command[1] == COMMAND_CLASS_VERSION.VERSION_GET.ID) { ApiOperation sendData = null; var data = new COMMAND_CLASS_VERSION.VERSION_REPORT(); sendData = new SendDataExOperation(nodeId, data, TxOptions, TxSecOptions, scheme, TxOptions2); ou.SetNextActionItems(sendData); } } }
private BoxcarApiResult MakeRequest(ApiOperation operation, string email, string fromName, string message, string id, string sourceUrl, string iconUrl) { BoxcarApiResult result = new BoxcarApiResult(); try { string url = string.Empty; switch (operation) { case ApiOperation.SUBSCRIBE: url = string.Format(URLFORMAT, _ApiKey, "subscribe"); break; case ApiOperation.CREATE: url = string.Format(URLFORMAT, _ApiKey, ""); break; case ApiOperation.BROADCAST: url = string.Format(URLFORMAT, _ApiKey, "broadcast"); break; } NameValueCollection data = new NameValueCollection(); data.Add("token", _ApiKey); data.Add("secret", _ApiSecret); if (!string.IsNullOrEmpty(email)) { data.Add("email", email); } if (!string.IsNullOrEmpty(message)) { data.Add("notification[message]", message); } if (!string.IsNullOrEmpty(fromName)) { data.Add("notification[from_screen_name]", fromName); } if (!string.IsNullOrEmpty(id)) { data.Add("notification[from_remote_service_id]", id); } if (!string.IsNullOrEmpty(sourceUrl)) { data.Add("notification[source_url]", sourceUrl); } if (!string.IsNullOrEmpty(iconUrl)) { data.Add("notification[icon_url]", iconUrl); } WebClient client = new WebClient(); client.Headers.Add(HttpRequestHeader.UserAgent, USERAGENT); byte[] response = client.UploadValues(url, "POST", data); string responseStr = System.Text.Encoding.UTF8.GetString(response); result.Success = true; result.Response = responseStr; } catch (System.Net.WebException webex) { result.Success = false; result.Code = Convert.ToInt32(webex.Response.Headers["Status"]); switch (result.Code) { case 400: result.Description = "Incorrect parameters passed"; break; case 401: result.Description = "Request failed (possible causes: invalid token, or user has not added the service, or notification id sent twice)"; break; case 403: result.Description = "Request failed (General)"; break; case 404: result.Description = "User not found"; break; default: result.Description = "Unknown response"; break; } } catch (Exception ex) { result.Success = false; result.Code = -1; result.Description = "Unknown Error : " + ex.Message; } return result; }