public void ExecuteBody(CodeActivityContext context) { LogMessage = "Get Service and In Args"; var service = GetService(context); var postalCode = postalcode.Get(context); var taxableAmount = taxableamount.Get(context); decimal taxRate = new decimal(0.0000); decimal taxAmount = new decimal(0.0000); string returnMessage = string.Empty; bool isSuccess = false; LogMessage = "Check for valid postal code"; if (HelperClass.ValidPostalCode(service, postalCode)) { LogMessage = "Get TaxRate from service and calculate TaxAmount"; taxRate = HelperClass.getTaxRate(service, trace, postalCode, "TaxJar"); taxAmount = taxRate * taxableAmount; // would normally pull in entire Order entity and run based on header and line item info } else { returnMessage = "Invalid Postal Code value or format"; } LogMessage = "Set Out Params"; TaxAmount.Set(context, taxAmount); Message.Set(context, returnMessage); IsSuccess.Set(context, isSuccess); }
public void ExecuteBody(CodeActivityContext context) { LogMessage = "Get Service and In Args"; var service = GetService(context); var postalCode = postalcode.Get(context); decimal taxRate = new decimal(0.0000); string returnMessage = string.Empty; bool isSuccess = false; LogMessage = "Check for valid postal code"; if (HelperClass.ValidPostalCode(service, postalCode)) { LogMessage = "Get TaxRate from service"; taxRate = HelperClass.getTaxRate(service, trace, postalCode, "TaxJar"); } else { returnMessage = "Invalid Postal Code value or format"; } LogMessage = "Set Out Params"; TaxRate.Set(context, taxRate); Message.Set(context, returnMessage); IsSuccess.Set(context, isSuccess); }
/// <summary> /// 获取ajax返回的json字符串 /// </summary> /// <returns></returns> public string GetJsonString(bool isReplace = false) { string json = "{"; json += "\"isSuccess\":" + IsSuccess.ToString().ToLower() + ",\"msg\":\"" + Msg + "\""; if (!string.IsNullOrEmpty(code)) { json += ",\"code\":\"" + code + "\""; } foreach (string key in Attrs.Keys) { string val = Attrs[key]; if (val.ToLower() != "true" && val.ToLower() != "false" && !val.StartsWith("[") && !val.StartsWith("{")) { val = "\"" + val + "\""; } json += ",\"" + key + "\":" + val + ""; } json += "}"; if (isReplace) { return(json.Replace("\\", "\\\\")); } return(json); }
public override int GetHashCode() { unchecked { return((IsSuccess.GetHashCode() * 397) ^ (Errors != null ? Errors.GetHashCode() : 0)); } }
public override int GetHashCode() { int hash = 1; if (Err != 0) { hash ^= Err.GetHashCode(); } if (IsSuccess != false) { hash ^= IsSuccess.GetHashCode(); } if (GateServerIp.Length != 0) { hash ^= GateServerIp.GetHashCode(); } if (GateServerPort != 0) { hash ^= GateServerPort.GetHashCode(); } if (UserId.Length != 0) { hash ^= UserId.GetHashCode(); } if (UserAccount.Length != 0) { hash ^= UserAccount.GetHashCode(); } if (Token.Length != 0) { hash ^= Token.GetHashCode(); } return(hash); }
/// <summary> /// Compares two JSON PATCH results for equality. /// </summary> /// <param name="PatchResult">A JSON PATCH result to compare with.</param> /// <returns>True if both match; False otherwise.</returns> public Boolean Equals(PatchResult <T> PatchResult) => IsSuccess.Equals(PatchResult.IsSuccess) && PatchedData.Equals(PatchResult.PatchedData) && ((ErrorResponse.IsNullOrEmpty() && PatchResult.ErrorResponse.IsNullOrEmpty()) || (ErrorResponse.IsNotNullOrEmpty() && PatchResult.ErrorResponse.IsNotNullOrEmpty() && ErrorResponse.Equals(PatchResult.ErrorResponse)));
/// <summary> /// 获取ajax返回的json字符串 /// </summary> /// <returns></returns> public string ToJsonString() { string json = "{"; json += "\"isSuccess\":" + IsSuccess.ToString().ToLower() + ",\"msg\":\"" + Msg + "\""; if (!string.IsNullOrEmpty(Code)) { json += ",\"code\":\"" + Code + "\""; } foreach (string key in Attr.Keys) { string val = Attr[key]; if (val == null) { val = ""; } if (val != null && val.ToLower() != "true" && val.ToLower() != "false" && !val.StartsWith("[") && !val.StartsWith("{")) { val = "\"" + val + "\""; } json += ",\"" + key + "\":" + val + ""; } json += "}"; return(json); }
public override int GetHashCode() { int hash = 1; if (Controller.Length != 0) { hash ^= Controller.GetHashCode(); } if (Action.Length != 0) { hash ^= Action.GetHashCode(); } if (IsSuccess != false) { hash ^= IsSuccess.GetHashCode(); } if (Message.Length != 0) { hash ^= Message.GetHashCode(); } if (data_ != null) { hash ^= Data.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// Compares two JSON PATCH results for equality. /// </summary> /// <param name="AddOrUpdateResult">A JSON PATCH result to compare with.</param> /// <returns>True if both match; False otherwise.</returns> public Boolean Equals(AddOrUpdateResult <T> AddOrUpdateResult) => IsSuccess.Equals(AddOrUpdateResult.IsSuccess) && Data.Equals(AddOrUpdateResult.Data) && ((!WasCreated.HasValue && !AddOrUpdateResult.WasCreated.HasValue) || (WasCreated.HasValue && AddOrUpdateResult.WasCreated.HasValue && WasCreated.Value.Equals(AddOrUpdateResult.WasCreated.Value))) && ((ErrorResponse.IsNullOrEmpty() && AddOrUpdateResult.ErrorResponse.IsNullOrEmpty()) || (ErrorResponse.IsNotNullOrEmpty() && AddOrUpdateResult.ErrorResponse.IsNotNullOrEmpty() && ErrorResponse.Equals(AddOrUpdateResult.ErrorResponse)));
public override string ToString() { string output = IsSuccess.ToString(); if (!IsSuccess) { output += ": " + Exception.ToString(); } return(output); }
public async Task SearchHandler_ReturnDummyValue() { var handler = new GameInfoApiQueryHandler(); var(IsSuccess, searchResults, ErrorMessage) = await handler.SearchAsync(string.Empty); IsSuccess.ShouldBeTrue(); ErrorMessage.ShouldBeEmpty(); searchResults.ShouldNotBeNull(); }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode() { unchecked { int result = IsSuccess.GetHashCode(); result = (result * 397) ^ StartPosition; result = (result * 397) ^ EndPosition; return(result); } }
public async Task SearchHandler_ReturnRandomValues() { var handler = new SearchAPIQueryHandler(); var(IsSuccess, searchResults, ErrorMessage) = await handler.SearchAsync(string.Empty); IsSuccess.ShouldBeTrue(); ErrorMessage.ShouldBeEmpty(); searchResults.ShouldNotBeEmpty(); }
//hash code trait public override int GetHashCode() { unchecked { var hash = 0; hash = hash * 31 + IsSuccess.GetHashCode(); hash = hash * 31 + HasUpdated.GetHashCode(); hash = hash * 31 + FormattedText.GetHashCode(); return(hash); } }
//pretty print public void Print(PrettyPrinter printer) { printer.Println("RdXamlStylerFormattingResult ("); using (printer.IndentCookie()) { printer.Print("isSuccess = "); IsSuccess.PrintEx(printer); printer.Println(); printer.Print("hasUpdated = "); HasUpdated.PrintEx(printer); printer.Println(); printer.Print("formattedText = "); FormattedText.PrintEx(printer); printer.Println(); } printer.Print(")"); }
public override int GetHashCode() { unchecked { var hashCode = (Message != null ? Message.GetHashCode() : 0); hashCode = (hashCode * 397) ^ IsFailure.GetHashCode(); hashCode = (hashCode * 397) ^ IsSuccess.GetHashCode(); hashCode = (hashCode * 397) ^ (int)ResultCode; return(hashCode); } }
/// <inheritdoc /> public override int GetHashCode() { unchecked { int hashCode = IsSuccess.GetHashCode(); hashCode = (hashCode * 397) ^ (GroupId is null ? 0 : GroupId.GetHashCode()); hashCode = (hashCode * 397) ^ (ErrorMessage is null ? 0 : ErrorMessage.GetHashCode()); hashCode = (hashCode * 397) ^ (StatusMessage is null ? 0 : StatusMessage.GetHashCode()); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = IsSuccess.GetHashCode(); hashCode = (hashCode * 397) ^ (ErrorCode != null ? ErrorCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Value != null ? Value.GetHashCode() : 0); return(hashCode); } }
/// <summary> /// Return the hash code of this object. /// </summary> /// <returns>The hash code of this object.</returns> public override Int32 GetHashCode() { unchecked { return(IsSuccess.GetHashCode() * 5 ^ PatchedData.GetHashCode() * 3 ^ (ErrorResponse.IsNotNullOrEmpty() ? ErrorResponse.GetHashCode() : 0)); } }
public override int GetHashCode() { return(base.GetHashCode() ^ IsSuccess.GetHashCode() ^ State.GetHashCode() ^ Manufacturer.GetHashCode() ^ ModelName.GetHashCode() ^ SerialNumber.GetHashCode() ^ SignalQuality.GetHashCode() ^ Imsi.GetHashCode() ^ Imei.GetHashCode() ^ OperatorName.GetHashCode()); }
protected override void Execute(CodeActivityContext activityContext, IWorkflowContext workflowContext, IOrganizationService crmService, ITracingService tracingService) { try { // Get the Source Record URL string sourceRecordUrl = SourceRecord.Get(activityContext); if (string.IsNullOrEmpty(sourceRecordUrl)) { Message.Set(activityContext, "Source Record URL cannot be empty or null"); return; } // Convert Record URL to ER EntityReference sourceRecordEr = EntityRecordUrlHelpers.ConvertRecordUrLtoEntityReference(sourceRecordUrl, crmService); if (sourceRecordEr == null) { Message.Set(activityContext, "Failed to convert record URL into Entity Reference. Please make sure you provide valid record URL"); return; } var recordId = sourceRecordEr.Id; var annotation_isdocument = true; var query = new QueryExpression(sourceRecordEr.LogicalName); query.Distinct = true; query.ColumnSet.AddColumns("createdon"); query.Criteria.AddCondition($"{sourceRecordEr.LogicalName}id", ConditionOperator.Equal, recordId); var queryAnnotation = query.AddLink("annotation", $"{sourceRecordEr.LogicalName}id", "objectid"); queryAnnotation.EntityAlias = "aa"; queryAnnotation.LinkCriteria.AddCondition("isdocument", ConditionOperator.Equal, annotation_isdocument); queryAnnotation.LinkCriteria.AddCondition("filename", ConditionOperator.NotNull); var results = crmService.RetrieveMultiple(query); if (!results.Entities.Any()) { // No attachments found HasAttachment.Set(activityContext, false); return; } // Attachments found HasAttachment.Set(activityContext, true); IsSuccess.Set(activityContext, true); } catch (Exception ex) { IsSuccess.Set(activityContext, false); Message.Set(activityContext, "An error occurred while check for attachments -" + ex.Message); } }
/// <summary> /// Returns a hash code for the current object. /// Uses a combination of the public properties to calculate the hash. /// </summary> /// <returns>A hash code for the current object.</returns> public override int GetHashCode() { unchecked { var result = Value != null?Value.GetHashCode() : 0; result = (result * 397) ^ IsSuccess.GetHashCode(); result = (result * 397) ^ ResultCode.GetHashCode(); result = (result * 397) ^ NodeOffline.GetHashCode(); result = (result * 397) ^ Done.GetHashCode(); result = (result * 397) ^ Continuation.GetHashCode(); return(result); } }
public override int GetHashCode() { int hash = 1; if (IsSuccess != false) { hash ^= IsSuccess.GetHashCode(); } if (Timestamp != 0L) { hash ^= Timestamp.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (IsSuccess != false) { hash ^= IsSuccess.GetHashCode(); } if (Error.Length != 0) { hash ^= Error.GetHashCode(); } return(hash); }
/// <summary> /// Return the hash code of this object. /// </summary> /// <returns>The hash code of this object.</returns> public override Int32 GetHashCode() { unchecked { return(IsSuccess.GetHashCode() * 7 ^ Data.GetHashCode() * 5 ^ (WasCreated.HasValue ? WasCreated.GetHashCode() * 3 : 0) ^ (ErrorResponse.IsNotNullOrEmpty() ? ErrorResponse.GetHashCode() : 0)); } }
protected override void Execute(CodeActivityContext activityContext, IWorkflowContext workflowContext, IOrganizationService CrmService, ITracingService trace) { try { string userName = UserFullName.Get(activityContext); if (string.IsNullOrWhiteSpace(userName)) { IsSuccess.Set(activityContext, false); Message.Set(activityContext, "User's Full Name is not provided"); return; } var QEsystemuser = new QueryExpression("systemuser"); QEsystemuser.ColumnSet.AddColumns("fullname"); var QEsystemuser_Criteria_0 = new FilterExpression(); QEsystemuser.Criteria.AddFilter(QEsystemuser_Criteria_0); QEsystemuser_Criteria_0.FilterOperator = LogicalOperator.Or; QEsystemuser_Criteria_0.AddCondition("fullname", ConditionOperator.Equal, userName); QEsystemuser_Criteria_0.AddCondition("fullname", ConditionOperator.Equal, ChangeNameOrder(userName)); var results = CrmService.RetrieveMultiple(QEsystemuser); if (results == null || !results.Entities.Any()) { IsSuccess.Set(activityContext, false); Message.Set(activityContext, "User with " + userName + " not found"); return; } if (results.Entities.Count > 1) { IsSuccess.Set(activityContext, false); Message.Set(activityContext, "Multiple users found with same name : " + userName); return; } IsSuccess.Set(activityContext, true); PreparedBy.Set(activityContext, results.Entities.Single().ToEntityReference()); } catch (Exception ex) { IsSuccess.Set(activityContext, false); Message.Set(activityContext, "An error occurred trying to find user : " + ex.Message); } }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendLine("Success" + IsSuccess.ToString()); if (!IsSuccess) { sb.AppendLine("Message: " + Message); } else { foreach (var account in Accounts) { sb.AppendLine("Account: " + account.ToString()); } } return(sb.ToString()); }
protected override void Execute(CodeActivityContext context) { try { trace = this.GetTracingService(context); this.ExecuteBody(context); trace.Trace("Executed body"); } catch (Exception ex) { if (trace != null) { trace.Trace(String.Format("{0} - {1}", LogMessage, ex.Message)); } Message.Set(context, String.Format("{0} - {1}", LogMessage, ex.Message)); IsSuccess.Set(context, false); } }
public override int GetHashCode() { int hash = 1; if (IsSuccess != false) { hash ^= IsSuccess.GetHashCode(); } if (SingUpFailType != global::GamePacket.Proto.AccountFailType.AlDefault) { hash ^= SingUpFailType.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (IsSuccess != false) { hash ^= IsSuccess.GetHashCode(); } if (ResponseMsg.Length != 0) { hash ^= ResponseMsg.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }