// CutString // #################################################################################### public dynamic CutString(string paramValue, int paramSize, StringDirection paramDirection) { if (!StringsSet) { SetStrings(); } object[] paramArgs = { paramValue, paramSize, paramDirection }; return(ComponentLoader.InvokeMethod(Strings, "CutString", paramArgs)); }
public async Task <dynamic> CutStringAsync(string paramValue, int paramSize, StringDirection paramDirection) { if (!StringsSet) { SetStrings(); } object[] paramArgs = { paramValue, paramSize, paramDirection }; return(await InvokeMethodAsync(Strings, "CutString", paramArgs)); }
public string CutString(string paramValue, int paramSize, StringDirection paramDirection) { string str; int length = paramValue.Length; int cut; if (length > paramSize && paramDirection == StringDirection.Left) { cut = length - paramSize; str = paramValue.Remove(paramSize, cut); } else if (length > paramSize && paramDirection == StringDirection.Right) { cut = paramSize; str = paramValue.Remove(0, cut); } else { str = paramValue; } return(str); }
/// <summary> /// Cut the specified value, size and direction. /// </summary> /// <param name="value">Value.</param> /// <param name="size">Size.</param> /// <param name="direction">Direction.</param> public string Cut(string value, int size, StringDirection direction) { string str; int length = value.Length; int cut; if (length > size && direction == StringDirection.Left) { cut = length - size; str = value.Remove(size, cut); } else if (length > size && direction == StringDirection.Right) { cut = size; str = value.Remove(0, cut); } else { str = value; } return(str); }
public BannedIpQuery WithIpAddress(string value = null, ArgumentEvaluationMode mode = ArgumentEvaluationMode.IgnoreNeutral, StringOperator @operator = StringOperator.Exact, StringDirection direction = StringDirection.SourceToExpected) { switch (mode) { case ArgumentEvaluationMode.IgnoreNeutral: if (Neutrals.Is(value)) { return(this); } break; case ArgumentEvaluationMode.Explicit: break; default: throw new NotSupportedEnumException(mode); } switch (@operator) { case StringOperator.Exact: switch (direction) { case StringDirection.SourceToExpected: case StringDirection.ExpectedToSource: case StringDirection.TwoWay: Entities = Entities.Where(bi => bi.IpAdrress == value); return(this); default: throw new NotSupportedEnumException(direction); } case StringOperator.Contains: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(bi => bi.IpAdrress.Contains(value)); return(this); case StringDirection.ExpectedToSource: Entities = Entities.Where(bi => value.Contains(bi.IpAdrress)); return(this); case StringDirection.TwoWay: Entities = Entities.Where(bi => bi.IpAdrress.Contains(value) || value.Contains(bi.IpAdrress)); return(this); default: throw new NotSupportedEnumException(direction); } case StringOperator.StartsWith: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(bi => bi.IpAdrress.StartsWith(value)); return(this); case StringDirection.ExpectedToSource: Entities = Entities.Where(bi => value.StartsWith(bi.IpAdrress)); return(this); case StringDirection.TwoWay: Entities = Entities.Where(bi => bi.IpAdrress.StartsWith(value) || value.StartsWith(bi.IpAdrress)); return(this); default: throw new NotSupportedEnumException(direction); } case StringOperator.EndsWith: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(bi => bi.IpAdrress.EndsWith(value)); return(this); case StringDirection.ExpectedToSource: Entities = Entities.Where(bi => value.EndsWith(bi.IpAdrress)); return(this); case StringDirection.TwoWay: Entities = Entities.Where(bi => bi.IpAdrress.EndsWith(value) || value.EndsWith(bi.IpAdrress)); return(this); default: throw new NotSupportedEnumException(direction); } default: throw new NotSupportedEnumException(@operator); } }
public TicketResponseQuery WithBody(string value = null, ArgumentEvaluationMode mode = ArgumentEvaluationMode.IgnoreNeutral, StringOperator @operator = StringOperator.Exact, StringDirection direction = StringDirection.SourceToExpected) { switch (mode) { case ArgumentEvaluationMode.IgnoreNeutral: if (Neutrals.Is(value)) { return(this); } break; case ArgumentEvaluationMode.Explicit: break; default: throw new NotSupportedEnumException(mode); } switch (@operator) { case StringOperator.Exact: switch (direction) { case StringDirection.SourceToExpected: case StringDirection.ExpectedToSource: case StringDirection.TwoWay: Entities = Entities.Where(tr => tr.Body == value); return(this); default: throw new NotSupportedEnumException(direction); } case StringOperator.Contains: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(tr => tr.Body.Contains(value)); return(this); case StringDirection.ExpectedToSource: Entities = Entities.Where(tr => value.Contains(tr.Body)); return(this); case StringDirection.TwoWay: Entities = Entities.Where(tr => tr.Body.Contains(value) || value.Contains(tr.Body)); return(this); default: throw new NotSupportedEnumException(direction); } case StringOperator.StartsWith: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(tr => tr.Body.StartsWith(value)); return(this); case StringDirection.ExpectedToSource: Entities = Entities.Where(tr => value.StartsWith(tr.Body)); return(this); case StringDirection.TwoWay: Entities = Entities.Where(tr => tr.Body.StartsWith(value) || value.StartsWith(tr.Body)); return(this); default: throw new NotSupportedEnumException(direction); } case StringOperator.EndsWith: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(tr => tr.Body.EndsWith(value)); return(this); case StringDirection.ExpectedToSource: Entities = Entities.Where(tr => value.EndsWith(tr.Body)); return(this); case StringDirection.TwoWay: Entities = Entities.Where(tr => tr.Body.EndsWith(value) || value.EndsWith(tr.Body)); return(this); default: throw new NotSupportedEnumException(direction); } default: throw new NotSupportedEnumException(@operator); } }
public NewsletterSubscriptionQuery WithEmail(string value = null, ArgumentEvaluationMode mode = ArgumentEvaluationMode.IgnoreNeutral, StringOperator @operator = StringOperator.Exact, StringDirection direction = StringDirection.SourceToExpected) { switch (mode) { case ArgumentEvaluationMode.IgnoreNeutral: if (Neutrals.Is(value)) { return(this); } break; case ArgumentEvaluationMode.Explicit: break; default: throw new NotSupportedEnumException(mode); } switch (@operator) { case StringOperator.Exact: switch (direction) { case StringDirection.SourceToExpected: case StringDirection.ExpectedToSource: case StringDirection.TwoWay: Entities = Entities.Where(ns => ns.Email == value); return(this); default: throw new NotSupportedEnumException(direction); } case StringOperator.Contains: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(ns => ns.Email.Contains(value)); return(this); case StringDirection.ExpectedToSource: Entities = Entities.Where(ns => value.Contains(ns.Email)); return(this); case StringDirection.TwoWay: Entities = Entities.Where(ns => ns.Email.Contains(value) || value.Contains(ns.Email)); return(this); default: throw new NotSupportedEnumException(direction); } case StringOperator.StartsWith: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(ns => ns.Email.StartsWith(value)); return(this); case StringDirection.ExpectedToSource: Entities = Entities.Where(ns => value.StartsWith(ns.Email)); return(this); case StringDirection.TwoWay: Entities = Entities.Where(ns => ns.Email.StartsWith(value) || value.StartsWith(ns.Email)); return(this); default: throw new NotSupportedEnumException(direction); } case StringOperator.EndsWith: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(ns => ns.Email.EndsWith(value)); return(this); case StringDirection.ExpectedToSource: Entities = Entities.Where(ns => value.EndsWith(ns.Email)); return(this); case StringDirection.TwoWay: Entities = Entities.Where(ns => ns.Email.EndsWith(value) || value.EndsWith(ns.Email)); return(this); default: throw new NotSupportedEnumException(direction); } default: throw new NotSupportedEnumException(@operator); } }
public StringOptions(StringHorizontalAlignment horizontalAlignment = StringHorizontalAlignment.Left, StringVerticalAlignment verticalAlignment = StringVerticalAlignment.Top, StringDirection direction = StringDirection.Horizontal) { HorizontalAlignment = horizontalAlignment; VerticalAlignment = verticalAlignment; Direction = direction; }
public EmailAccountQuery WithPassword(string value = null, ArgumentEvaluationMode mode = ArgumentEvaluationMode.IgnoreNeutral, StringOperator @operator = StringOperator.Exact, StringDirection direction = StringDirection.SourceToExpected) { switch (mode) { case ArgumentEvaluationMode.IgnoreNeutral: if (Neutrals.Is(value)) { return(this); } break; case ArgumentEvaluationMode.Explicit: break; default: throw new NotSupportedEnumException(mode); } switch (@operator) { case StringOperator.Exact: switch (direction) { case StringDirection.SourceToExpected: case StringDirection.ExpectedToSource: case StringDirection.TwoWay: Entities = Entities.Where(ea => ea.Password == value); return(this); default: throw new NotSupportedEnumException(direction); } case StringOperator.Contains: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(ea => ea.Password.Contains(value)); return(this); case StringDirection.ExpectedToSource: Entities = Entities.Where(ea => value.Contains(ea.Password)); return(this); case StringDirection.TwoWay: Entities = Entities.Where(ea => ea.Password.Contains(value) || value.Contains(ea.Password)); return(this); default: throw new NotSupportedEnumException(direction); } case StringOperator.StartsWith: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(ea => ea.Password.StartsWith(value)); return(this); case StringDirection.ExpectedToSource: Entities = Entities.Where(ea => value.StartsWith(ea.Password)); return(this); case StringDirection.TwoWay: Entities = Entities.Where(ea => ea.Password.StartsWith(value) || value.StartsWith(ea.Password)); return(this); default: throw new NotSupportedEnumException(direction); } case StringOperator.EndsWith: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(ea => ea.Password.EndsWith(value)); return(this); case StringDirection.ExpectedToSource: Entities = Entities.Where(ea => value.EndsWith(ea.Password)); return(this); case StringDirection.TwoWay: Entities = Entities.Where(ea => ea.Password.EndsWith(value) || value.EndsWith(ea.Password)); return(this); default: throw new NotSupportedEnumException(direction); } default: throw new NotSupportedEnumException(@operator); } }
public PollVotingRecordQuery WithVoterIp(string value = null, ArgumentEvaluationMode mode = ArgumentEvaluationMode.IgnoreNeutral, StringOperator @operator = StringOperator.Exact, StringDirection direction = StringDirection.SourceToExpected) { switch (mode) { case ArgumentEvaluationMode.IgnoreNeutral: if (Neutrals.Is(value)) { return(this); } break; case ArgumentEvaluationMode.Explicit: break; default: throw new NotSupportedEnumException(mode); } switch (@operator) { case StringOperator.Exact: switch (direction) { case StringDirection.SourceToExpected: case StringDirection.ExpectedToSource: case StringDirection.TwoWay: Entities = Entities.Where(pvr => pvr.VoterIp == value); return(this); default: throw new NotSupportedEnumException(direction); } case StringOperator.Contains: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(pvr => pvr.VoterIp.Contains(value)); return(this); case StringDirection.ExpectedToSource: Entities = Entities.Where(pvr => value.Contains(pvr.VoterIp)); return(this); case StringDirection.TwoWay: Entities = Entities.Where(pvr => pvr.VoterIp.Contains(value) || value.Contains(pvr.VoterIp)); return(this); default: throw new NotSupportedEnumException(direction); } case StringOperator.StartsWith: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(pvr => pvr.VoterIp.StartsWith(value)); return(this); case StringDirection.ExpectedToSource: Entities = Entities.Where(pvr => value.StartsWith(pvr.VoterIp)); return(this); case StringDirection.TwoWay: Entities = Entities.Where(pvr => pvr.VoterIp.StartsWith(value) || value.StartsWith(pvr.VoterIp)); return(this); default: throw new NotSupportedEnumException(direction); } case StringOperator.EndsWith: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(pvr => pvr.VoterIp.EndsWith(value)); return(this); case StringDirection.ExpectedToSource: Entities = Entities.Where(pvr => value.EndsWith(pvr.VoterIp)); return(this); case StringDirection.TwoWay: Entities = Entities.Where(pvr => pvr.VoterIp.EndsWith(value) || value.EndsWith(pvr.VoterIp)); return(this); default: throw new NotSupportedEnumException(direction); } default: throw new NotSupportedEnumException(@operator); } }
public TQuery WithMetadataDescription(string value = null, ArgumentEvaluationMode mode = ArgumentEvaluationMode.IgnoreNeutral, StringOperator @operator = StringOperator.Exact, StringDirection direction = StringDirection.SourceToExpected) { switch (mode) { case ArgumentEvaluationMode.IgnoreNeutral: if (Neutrals.Is(value)) { return((TQuery)this); } break; case ArgumentEvaluationMode.Explicit: break; default: throw new NotSupportedEnumException(mode); } switch (@operator) { case StringOperator.Exact: switch (direction) { case StringDirection.SourceToExpected: case StringDirection.ExpectedToSource: case StringDirection.TwoWay: Entities = Entities.Where(uie => uie.Metadata.Description == value); return((TQuery)this); default: throw new NotSupportedEnumException(direction); } case StringOperator.Contains: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(uie => uie.Metadata.Description.Contains(value)); return((TQuery)this); case StringDirection.ExpectedToSource: Entities = Entities.Where(uie => value.Contains(uie.Metadata.Description)); return((TQuery)this); case StringDirection.TwoWay: Entities = Entities.Where(uie => uie.Metadata.Description.Contains(value) || value.Contains(uie.Metadata.Description)); return((TQuery)this); default: throw new NotSupportedEnumException(direction); } case StringOperator.StartsWith: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(uie => uie.Metadata.Description.StartsWith(value)); return((TQuery)this); case StringDirection.ExpectedToSource: Entities = Entities.Where(uie => value.StartsWith(uie.Metadata.Description)); return((TQuery)this); case StringDirection.TwoWay: Entities = Entities.Where(uie => uie.Metadata.Description.StartsWith(value) || value.StartsWith(uie.Metadata.Description)); return((TQuery)this); default: throw new NotSupportedEnumException(direction); } case StringOperator.EndsWith: switch (direction) { case StringDirection.SourceToExpected: Entities = Entities.Where(uie => uie.Metadata.Description.EndsWith(value)); return((TQuery)this); case StringDirection.ExpectedToSource: Entities = Entities.Where(uie => value.EndsWith(uie.Metadata.Description)); return((TQuery)this); case StringDirection.TwoWay: Entities = Entities.Where(uie => uie.Metadata.Description.EndsWith(value) || value.EndsWith(uie.Metadata.Description)); return((TQuery)this); default: throw new NotSupportedEnumException(direction); } default: throw new NotSupportedEnumException(@operator); } }