public void TestEquals() { var str = new StringEnum("IMAP4rev1"); var str2 = str; Assert.IsTrue(str.Equals(str2)); Assert.IsTrue(str.Equals("IMAP4REV1")); Assert.IsTrue(str.Equals("imap4rev1")); Assert.IsTrue(str.Equals(new StringEnum("IMAP4rev1"))); Assert.IsTrue(str.Equals(new StringEnum("IMAP4REV1"))); Assert.IsTrue(str.Equals(new StringEnum("imap4rev1"))); var str3 = new StringEnum("IMAP4"); Assert.IsFalse(str.Equals(null)); Assert.IsFalse(str.Equals(str3)); Assert.IsFalse(str.Equals("IMAP4")); Assert.IsFalse(str.Equals("imap4")); Assert.IsFalse(str.Equals(new StringEnum("IMAP4"))); Assert.IsFalse(str.Equals(new StringEnum("imap4"))); Assert.IsFalse(str.Equals(ImapCapability.Imap4Rev1)); Assert.IsFalse(str.Equals(new ImapCapability("IMAP4rev1"))); Assert.IsFalse(str.Equals(new ImapCapability("IMAP4REV1"))); Assert.IsFalse(str.Equals(new ImapCapability("imap4rev1"))); }
public void TestOpEquality() { var str = new StringEnum("IMAP4rev1"); var c = str; Assert.IsTrue(str == c); Assert.IsTrue(c == str); Assert.IsTrue(str == new StringEnum("IMAP4rev1")); Assert.IsTrue(str == new StringEnum("IMAP4REV1")); Assert.IsTrue(str == new StringEnum("imap4rev1")); Assert.IsTrue(new StringEnum("IMAP4rev1") == str); Assert.IsTrue(new StringEnum("IMAP4REV1") == str); Assert.IsTrue(new StringEnum("imap4rev1") == str); c = new StringEnum("IMAP4"); Assert.IsFalse(str == c); Assert.IsFalse(c == str); Assert.IsFalse(str == null); Assert.IsFalse(null == str); Assert.IsFalse(str == new StringEnum("IMAP4")); Assert.IsFalse(str == new StringEnum("imap4")); Assert.IsFalse(new StringEnum("IMAP4") == str); Assert.IsFalse(new StringEnum("imap4") == str); Assert.IsFalse(str == new ImapCapability("IMAP4rev1")); Assert.IsFalse(str == new ImapCapability("IMAP4REV1")); Assert.IsFalse(str == new ImapCapability("imap4rev1")); }
public static string GetString(StringEnum stringEnum, params object[] args) { // get the identifier string ident = stringEnum.ToString(); // get the string from resources using the current ui culture string format = s_resources.GetString(ident, CultureInfo.CurrentUICulture); if (format != null) { // if we have an array of args if (args != null && args.Length > 0) { // format the string with the args format = string.Format(CultureInfo.CurrentCulture, format, args); } } else { // just use the identifier as a last-ditch default format = ident; } return format; }
public LiveEntryFilter(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "isLive": this._IsLive = (NullableBoolean)ParseEnum(typeof(NullableBoolean), propertyNode.InnerText); continue; case "isRecordedEntryIdEmpty": this._IsRecordedEntryIdEmpty = (NullableBoolean)ParseEnum(typeof(NullableBoolean), propertyNode.InnerText); continue; case "hasMediaServerHostname": this._HasMediaServerHostname = propertyNode.InnerText; continue; case "orderBy": this._OrderBy = (LiveEntryOrderBy)StringEnum.Parse(typeof(LiveEntryOrderBy), propertyNode.InnerText); continue; } } }
public HouseholdDevice(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "householdId": this._HouseholdId = ParseInt(propertyNode.InnerText); continue; case "udid": this._Udid = propertyNode.InnerText; continue; case "name": this._Name = propertyNode.InnerText; continue; case "brand": this._Brand = propertyNode.InnerText; continue; case "brandId": this._BrandId = ParseInt(propertyNode.InnerText); continue; case "activatedOn": this._ActivatedOn = ParseLong(propertyNode.InnerText); continue; case "status": this._Status = (DeviceStatus)StringEnum.Parse(typeof(DeviceStatus), propertyNode.InnerText); continue; } } }
public CategoryUserFilter(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "categoryDirectMembers": this._CategoryDirectMembers = ParseBool(propertyNode.InnerText); continue; case "freeText": this._FreeText = propertyNode.InnerText; continue; case "relatedGroupsByUserId": this._RelatedGroupsByUserId = propertyNode.InnerText; continue; case "orderBy": this._OrderBy = (CategoryUserOrderBy)StringEnum.Parse(typeof(CategoryUserOrderBy), propertyNode.InnerText); continue; } } }
/// <summary> /// Processes the events. /// </summary> private void ProcessEvents() { while (true) { EventAction action = null; lock (eventLock) { if (eventQueue.Count > 0) { PriorityQueueItem <EventAction, EventPriority> eventItem = eventQueue.Dequeue(); action = eventItem.Value; if (action == null) { return; } } } if (action != null) { log.Info(string.Format("Processing events {0} from {1}", action.Notification, action.Computer)); // Start processing events EventNotificationType notificationType = (EventNotificationType)StringEnum.Parse(typeof(EventNotificationType), action.Notification); if (notificationType == EventNotificationType.NewMessage) { log.Info("New messages arrived"); RefreshMessageView(ViewAction.RefreshInbox); } } else { eventTrigger.WaitOne(); // wait for events } } }
public AssetStatisticsQuery(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "assetIdIn": this._AssetIdIn = propertyNode.InnerText; continue; case "assetTypeEqual": this._AssetTypeEqual = (AssetType)StringEnum.Parse(typeof(AssetType), propertyNode.InnerText); continue; case "startDateGreaterThanOrEqual": this._StartDateGreaterThanOrEqual = ParseLong(propertyNode.InnerText); continue; case "endDateGreaterThanOrEqual": this._EndDateGreaterThanOrEqual = ParseLong(propertyNode.InnerText); continue; } } }
public void TestMethod1() { NongHyupApi.ApiClient apiMap = new NongHyupApi.ApiClient("http://localhost:9999/NonghyupApi/"); var now = DateTime.Now; OpenFinAccountARSSender sender = new OpenFinAccountARSSender { Header = new NongHyupApi.Models.SenderHeader { ApiNm = StringEnum.GetStringValue(NongHyupApi.ApiNmCode.CheckOpenFinAccount), Trtm = now.ConvertDateToString(ConvertFormat.YYYYMMDD), Tsymd = now.ConvertDateToString(ConvertFormat.HHMMSS), Iscd = "000058", FintechApsno = "002", ApiSvcCd = "DrtrA", IsTuno = "201510120000000001", }, DrtrRgyn = "Y", BrdtBrno = "19661010", Tlno = "01011112222", Csnm = "홍길동", CmcmDscd = StringEnum.GetStringValue(CmcmDscdCode.SKT), GndrDscd = "M", NtfrDscd = "1", SelfCrtcDmndYn = "Y" }; //var json = apiMap.GenerateJson<OpenFinAccountARSSender>(sender); //var result = apiMap.Client<NongHyupApi.Models.ReceiveHeader>(json); var result = apiMap.Client <OpenFinAccountARSSender, OpenFinAccountARSReceiver>(sender); if (result != null) { } }
public BulkUploadBaseFilter(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "uploadedOnGreaterThanOrEqual": this._UploadedOnGreaterThanOrEqual = ParseInt(propertyNode.InnerText); continue; case "uploadedOnLessThanOrEqual": this._UploadedOnLessThanOrEqual = ParseInt(propertyNode.InnerText); continue; case "uploadedOnEqual": this._UploadedOnEqual = ParseInt(propertyNode.InnerText); continue; case "statusIn": this._StatusIn = propertyNode.InnerText; continue; case "statusEqual": this._StatusEqual = (BatchJobStatus)ParseEnum(typeof(BatchJobStatus), propertyNode.InnerText); continue; case "bulkUploadObjectTypeEqual": this._BulkUploadObjectTypeEqual = (BulkUploadObjectType)StringEnum.Parse(typeof(BulkUploadObjectType), propertyNode.InnerText); continue; case "bulkUploadObjectTypeIn": this._BulkUploadObjectTypeIn = propertyNode.InnerText; continue; } } }
public override Expression VisitRelational(QLParser.RelationalContext context) { Expression left = context.expr(0).Accept(this); Expression right = context.expr(1).Accept(this); Operation operation = StringEnum.GetEnumerationValue <Operation>(context.GetChild(1).GetText()); switch (operation) { case Operation.GreaterThan: return(new GreaterThan(operation, left, right, context.GetTextPosition())); case Operation.GreaterThanOrEqualTo: return(new GreaterThanOrEqualTo(operation, left, right, context.GetTextPosition())); case Operation.LessThan: return(new LessThan(operation, left, right, context.GetTextPosition())); case Operation.LessThanOrEqualTo: return(new LessThanOrEqualTo(operation, left, right, context.GetTextPosition())); default: throw new NotSupportedException("Unexpected operator symbol encountered."); } }
public EntryScheduleEventFilter(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "parentCategoryIdsLike": this._ParentCategoryIdsLike = propertyNode.InnerText; continue; case "parentCategoryIdsMultiLikeOr": this._ParentCategoryIdsMultiLikeOr = propertyNode.InnerText; continue; case "parentCategoryIdsMultiLikeAnd": this._ParentCategoryIdsMultiLikeAnd = propertyNode.InnerText; continue; case "orderBy": this._OrderBy = (EntryScheduleEventOrderBy)StringEnum.Parse(typeof(EntryScheduleEventOrderBy), propertyNode.InnerText); continue; } } }
public AssetHistoryFilter(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "typeIn": this._TypeIn = propertyNode.InnerText; continue; case "assetIdIn": this._AssetIdIn = propertyNode.InnerText; continue; case "statusEqual": this._StatusEqual = (WatchStatus)StringEnum.Parse(typeof(WatchStatus), propertyNode.InnerText); continue; case "orderBy": this._OrderBy = (AssetHistoryOrderBy)StringEnum.Parse(typeof(AssetHistoryOrderBy), propertyNode.InnerText); continue; } } }
public UserAssetRule(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "id": this._Id = ParseLong(propertyNode.InnerText); continue; case "ruleType": this._RuleType = (RuleType)StringEnum.Parse(typeof(RuleType), propertyNode.InnerText); continue; case "name": this._Name = propertyNode.InnerText; continue; case "description": this._Description = propertyNode.InnerText; continue; } } }
public AttachmentAsset(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "filename": this._Filename = propertyNode.InnerText; continue; case "title": this._Title = propertyNode.InnerText; continue; case "format": this._Format = (AttachmentType)StringEnum.Parse(typeof(AttachmentType), propertyNode.InnerText); continue; case "status": this._Status = (AttachmentAssetStatus)ParseEnum(typeof(AttachmentAssetStatus), propertyNode.InnerText); continue; } } }
public static string GetString(StringEnum stringEnum, params object[] args) { // get the identifier string ident = stringEnum.ToString(); // get the string from resources using the current ui culture string format = s_resources.GetString(ident, CultureInfo.CurrentUICulture); if (format != null) { // if we have an array of args if (args != null && args.Length > 0) { // format the string with the args format = string.Format(CultureInfo.CurrentCulture, format, args); } } else { // just use the identifier as a last-ditch default format = ident; } return(format); }
public void StringEnum_Equals_Null() { StringEnum <SimpleEnum> first = SimpleEnum.First; StringEnum <SimpleEnum> second = "second"; StringEnum <SimpleEnum> third = "invalid"; StringEnum <SimpleEnum> fourth = null; Assert.AreNotEqual(first, null); Assert.AreNotEqual(second, null); Assert.AreNotEqual(third, null); Assert.AreEqual(fourth, null); Assert.IsFalse(first == null); Assert.IsFalse(second == null); Assert.IsFalse(third == null); Assert.IsFalse(fourth != null); Assert.IsTrue(first != null); Assert.IsTrue(second != null); Assert.IsTrue(third != null); Assert.IsTrue(fourth == null); Assert.ReferenceEquals(fourth, null); Assert.IsFalse(first.Equals(null)); }
//초기화 public async void GetAutoCoinSetting() { try { using (RequestTradingCoinAutoTradeSelModel req = new RequestTradingCoinAutoTradeSelModel()) { req.userEmail = MainViewModel.LoginDataModel.userEmail; using (ResponseTradingCoinAutoTradeSelModel res = await WebApiLib.AsyncCall <ResponseTradingCoinAutoTradeSelModel, RequestTradingCoinAutoTradeSelModel>(req)) { ResponseTradingCoinAutoTradeSelDataModel catTemp = res.data; SelCoin = StringEnum.ToEnum <EnumLib.ExchangeCurrencyCode>(catTemp.selCnKndCd).ToString(); ChgCoin = StringEnum.ToEnum <EnumLib.ExchangeCurrencyCode>(catTemp.chgCnKndCd).ToString(); CoinAutoTradeContent = catTemp; } } } catch (Exception ex) { SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace); } }
public HttpNotification(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "object": this._Object = ObjectFactory.Create <ObjectBase>(propertyNode); continue; case "eventObjectType": this._EventObjectType = (EventNotificationEventObjectType)StringEnum.Parse(typeof(EventNotificationEventObjectType), propertyNode.InnerText); continue; case "eventNotificationJobId": this._EventNotificationJobId = ParseLong(propertyNode.InnerText); continue; case "templateId": this._TemplateId = ParseInt(propertyNode.InnerText); continue; case "templateName": this._TemplateName = propertyNode.InnerText; continue; case "templateSystemName": this._TemplateSystemName = propertyNode.InnerText; continue; case "eventType": this._EventType = (EventNotificationEventType)StringEnum.Parse(typeof(EventNotificationEventType), propertyNode.InnerText); continue; } } }
protected AutoTradingPopAdditionalServiceViewModel() { try { coinList = new List <AutoTradingCoinList>(); coinList.Add(ViewModelSource.Create(() => new AutoTradingCoinList() { coinNm = CommonLib.StandardCurcyNm, coinCd = StringEnum.GetStringValue(EnumLib.ExchangeCurrencyCode.KRW), isCheck = true })); foreach (ResponseGetMkCoinListListtModel item in MainViewModel.CoinList.KRW) { coinList.Add(ViewModelSource.Create(() => new AutoTradingCoinList() { coinNm = item.curcyNm, coinCd = item.curcyCd, isCheck = true })); } ImageSet(); } catch (Exception ex) { SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace); } }
private void Init_Form() { #region Default setting //Gets your enum names and adds it to a string array Array enumNames = Enum.GetValues(typeof(Lib.Script_Type)); //Creates an ArrayList ArrayList myScriptTypes = new ArrayList(); //Loop through your string array and poppulates the ArrayList foreach (Lib.Script_Type myScriptType in enumNames) { myScriptTypes.Add(new { Value = StringEnum.GetStringValue(myScriptType), Name = myScriptType.ToString() }); } //Bind the ArrayList to your DropDownList droplist_Script_Type.DataSource = myScriptTypes; droplist_Script_Type.DataTextField = "Name"; droplist_Script_Type.DataValueField = "Value"; droplist_Script_Type.DataBind(); #endregion }
public TranscriptAsset(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "accuracy": this._Accuracy = ParseFloat(propertyNode.InnerText); continue; case "humanVerified": this._HumanVerified = (NullableBoolean)ParseEnum(typeof(NullableBoolean), propertyNode.InnerText); continue; case "language": this._Language = (Language)StringEnum.Parse(typeof(Language), propertyNode.InnerText); continue; case "providerType": this._ProviderType = (TranscriptProviderType)StringEnum.Parse(typeof(TranscriptProviderType), propertyNode.InnerText); continue; } } }
public TransactionHistoryFilter(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "entityReferenceEqual": this._EntityReferenceEqual = (EntityReferenceBy)StringEnum.Parse(typeof(EntityReferenceBy), propertyNode.InnerText); continue; case "startDateGreaterThanOrEqual": this._StartDateGreaterThanOrEqual = ParseInt(propertyNode.InnerText); continue; case "endDateLessThanOrEqual": this._EndDateLessThanOrEqual = ParseInt(propertyNode.InnerText); continue; case "orderBy": this._OrderBy = (TransactionHistoryOrderBy)StringEnum.Parse(typeof(TransactionHistoryOrderBy), propertyNode.InnerText); continue; } } }
public EntitlementFilter(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "entitlementTypeEqual": this._EntitlementTypeEqual = (TransactionType)StringEnum.Parse(typeof(TransactionType), propertyNode.InnerText); continue; case "entityReferenceEqual": this._EntityReferenceEqual = (EntityReferenceBy)StringEnum.Parse(typeof(EntityReferenceBy), propertyNode.InnerText); continue; case "isExpiredEqual": this._IsExpiredEqual = ParseBool(propertyNode.InnerText); continue; case "orderBy": this._OrderBy = (EntitlementOrderBy)StringEnum.Parse(typeof(EntitlementOrderBy), propertyNode.InnerText); continue; } } }
public PaymentGatewayBaseProfile(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "id": this._Id = ParseInt(propertyNode.InnerText); continue; case "name": this._Name = propertyNode.InnerText; continue; case "isDefault": this._IsDefault = ParseBool(propertyNode.InnerText); continue; case "selectedBy": this._SelectedBy = (HouseholdPaymentGatewaySelectedBy)StringEnum.Parse(typeof(HouseholdPaymentGatewaySelectedBy), propertyNode.InnerText); continue; } } }
public InboxMessageFilter(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "typeIn": this._TypeIn = propertyNode.InnerText; continue; case "createdAtGreaterThanOrEqual": this._CreatedAtGreaterThanOrEqual = ParseLong(propertyNode.InnerText); continue; case "createdAtLessThanOrEqual": this._CreatedAtLessThanOrEqual = ParseLong(propertyNode.InnerText); continue; case "orderBy": this._OrderBy = (InboxMessageOrderBy)StringEnum.Parse(typeof(InboxMessageOrderBy), propertyNode.InnerText); continue; } } }
/// <summary> /// Update the quality and sellin properties of Baclstage items /// </summary> private void UpdateBackstageItems() { // Add 1 unit to quality and minus 1 unit from sellin Items .Where(item => item.Name == StringEnum.GetStringValue(ItemNameEnum.Backstage) && item.Quality < 50) .ToList() .ForEach(item => { item.Quality++; item.SellIn--; }); // Add 1 more unit to quality if sellin 10 days or less (it means add 2 unit to quality) Items .Where(item => item.Name == StringEnum.GetStringValue(ItemNameEnum.Backstage) && item.SellIn < 11 && item.Quality < 50) .ToList() .ForEach(item => item.Quality++); // Add 1 more unit to quality if sellin 5 days or less (it means add 3 unit to quality) Items .Where(item => item.Name == StringEnum.GetStringValue(ItemNameEnum.Backstage) && item.SellIn < 6 && item.Quality < 50) .ToList() .ForEach(item => item.Quality++); // Drop quality to 0 if the sellin less than 0 Items .Where(item => item.SellIn < 0 && item.Name == StringEnum.GetStringValue(ItemNameEnum.Backstage)) .ToList() .ForEach(item => item.Quality = 0); }
public CuePointFilter(XmlElement node) : base(node) { foreach (XmlElement propertyNode in node.ChildNodes) { switch (propertyNode.Name) { case "freeText": this._FreeText = propertyNode.InnerText; continue; case "userIdEqualCurrent": this._UserIdEqualCurrent = (NullableBoolean)ParseEnum(typeof(NullableBoolean), propertyNode.InnerText); continue; case "userIdCurrent": this._UserIdCurrent = (NullableBoolean)ParseEnum(typeof(NullableBoolean), propertyNode.InnerText); continue; case "orderBy": this._OrderBy = (CuePointOrderBy)StringEnum.Parse(typeof(CuePointOrderBy), propertyNode.InnerText); continue; } } }
public IntradayData GetIntraDayTimeSeries(IntradayResourceType timeSeriesResourceType, DateTime dayAndStartTime, TimeSpan intraDayTimeSpan) { string requestUrl = null; if (intraDayTimeSpan > new TimeSpan(0, 1, 0) && //the timespan is greater than a minute dayAndStartTime.Day == dayAndStartTime.Add(intraDayTimeSpan).Day //adding the timespan doesn't go in to the next day ) { requestUrl = string.Format("/1/user/-{0}/date/{1}/1d/time/{2}/{3}.xml", StringEnum.GetStringValue(timeSeriesResourceType), dayAndStartTime.ToString("yyyy-MM-dd"), dayAndStartTime.ToString("HH:mm"), dayAndStartTime.Add(intraDayTimeSpan).ToString("HH:mm")); } else //just get the today data, there was a date specified but the timerange was likely too large or negative { requestUrl = string.Format("/1/user/-{0}/date/{1}/1d.xml", StringEnum.GetStringValue(timeSeriesResourceType), dayAndStartTime.ToString("yyyy-MM-dd")); } // /1/user/-/activities/calories/date/2011-07-05/1d/time/12:20/12:45.xml RestRequest request = new RestRequest(requestUrl); request.OnBeforeDeserialization = resp => { XDocument doc = XDocument.Parse(resp.Content); //find the name of the 2nd level element that contains "-intraday" and set it as the rootElement to start parsing through var rootElement = doc.Descendants("result").FirstOrDefault().Descendants().Where(t => t.Name.LocalName.Contains("-intraday")).FirstOrDefault(); request.RootElement = rootElement.Name.LocalName; //foreach (XElement link in links) //{ //RemoveDuplicateElement(link, "category"); //RemoveDuplicateElement(link, "click-commission"); //RemoveDuplicateElement(link, "creative-height"); //RemoveDuplicateElement(link, "creative-width"); //} }; //request.RootElement = timeSeriesResourceType.GetRootElement(); var response = restClient.Execute <IntradayData>(request); HandleResponseCode(response.StatusCode); //after the deserialization, need to set the date parts correctly for (int i = 0; i < response.Data.DataSet.Count; i++) { //the serializing gets the time right, but we have to set the explicit time part from passed in response.Data.DataSet[i].Time = new DateTime( dayAndStartTime.Year, dayAndStartTime.Month, dayAndStartTime.Day, response.Data.DataSet[i].Time.Hour, response.Data.DataSet[i].Time.Minute, response.Data.DataSet[i].Time.Second); } return(response.Data); }
/// <summary> /// Get TimeSeries data for another user accessible with this user's credentials /// </summary> /// <param name="timeSeriesResourceType"></param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="userId"></param> /// <returns></returns> public TimeSeriesDataListInt GetTimeSeriesInt(TimeSeriesResourceType timeSeriesResourceType, DateTime baseDate, string endDateOrPeriod, string userId) { string userSignifier = "-"; //used for current user if (!string.IsNullOrWhiteSpace(userId)) { userSignifier = userId; } string requestUrl = string.Format("/1/user/{0}{1}/date/{2}/{3}.xml", userSignifier, StringEnum.GetStringValue(timeSeriesResourceType), baseDate.ToString("yyyy-MM-dd"), endDateOrPeriod); RestRequest request = new RestRequest(requestUrl); request.OnBeforeDeserialization = resp => { XDocument doc = XDocument.Parse(resp.Content); //IEnumerable<XElement> links = doc.Descendants("result"); var rootElement = doc.Descendants("result").FirstOrDefault().Descendants().FirstOrDefault(); request.RootElement = rootElement.Name.LocalName; //foreach (XElement link in links) //{ //RemoveDuplicateElement(link, "category"); //RemoveDuplicateElement(link, "click-commission"); //RemoveDuplicateElement(link, "creative-height"); //RemoveDuplicateElement(link, "creative-width"); //} }; //request.RootElement = timeSeriesResourceType.GetRootElement(); var response = restClient.Execute <TimeSeriesDataListInt>(request); HandleResponseCode(response.StatusCode); /* */ return(response.Data); }
public TimeSeriesDataListInt GetTimeSeriesInt(TimeSeriesResourceType timeSeriesResourceType, DateTime endDate, DateRangePeriod period, string userId) { return(GetTimeSeriesInt(timeSeriesResourceType, endDate, StringEnum.GetStringValue(period), userId)); }
private void ReportError(int severity, StringEnum errorNumber, params object[] arguments) { // guide: 0 == syntax error // 1 == the programmer probably did not intend to do this // 2 == this can lead to problems in the future. // 3 == this can lead to performance problems // 4 == this is just not right string message = CssStringMgr.GetString(errorNumber, arguments); CssParserException exc = new CssParserException( (int)errorNumber, severity, (m_currentToken != null) ? m_currentToken.Context.Start.Line : 0, (m_currentToken != null) ? m_currentToken.Context.Start.Char : 0, message ); // but warnings we want to just report and carry on OnCssError(exc); }
public void Constructor_Should_Save_Value_Passed() { var e = new StringEnum("33f"); Assert.AreSame(e.Value, "33f"); }
private void UpdateValue(PropertyDescriptor thisProperty, XPathNavigator current, String value, Object onObject) { if (!(thisProperty.Converter is ArrayConverter)) { // set value if (value.Length > 0) { if (thisProperty.Converter is EnumConverter) // enums are a special case { StringEnum stringEnum = new StringEnum(thisProperty.PropertyType); Boolean pass = stringEnum.IsStringDefined(value); if (!pass) // normal case, no string value { thisProperty.SetValue(onObject, thisProperty.Converter.ConvertFromString(value)); } else // string value, reverse to the enum value { thisProperty.SetValue(onObject, thisProperty.Converter.ConvertFromString(stringEnum.GetEnumValue(value))); } } else // everyone else { thisProperty.SetValue(onObject, thisProperty.Converter.ConvertFromString(value)); } } else { if (thisProperty.PropertyType == typeof(String)) // replace with empty string { thisProperty.SetValue(onObject, thisProperty.Converter.ConvertFromString(String.Empty)); } } } else { if (thisProperty.Converter is ArrayConverter) { // select collection children XPathNodeIterator collectionChildren = current.Select("Parameter"); int index = 0; Type elementType = thisProperty.PropertyType.GetElementType(); Array newValue = Array.CreateInstance(elementType, collectionChildren.Count); foreach (XPathNavigator collectionChild in collectionChildren) { String xmlValue = collectionChild.GetAttribute(ConfigFileConstants.Value, ""); Object result = Convert.ChangeType(xmlValue, elementType); newValue.SetValue(result, index); index++; } thisProperty.SetValue(onObject, newValue); } } }
/// <summary> /// Setups the message settings. /// </summary> public void SetupMessageSettings() { // First option is any channels if (cboChannel.Items.Count > 0) cboChannel.Items.Clear(); cboChannel.Items.Add(Resources.AnyChannels); // Load all channels foreach (GatewayConfig g in GatewayConfig.All().OrderBy(gw => gw.Id)) { cboChannel.Items.Add(string.Join(GuiHelper.FieldSplitter, new string[]{g.Id, g.ComPort})); } cboChannel.SelectedIndex = 0; // Load message format cboMessageFormat.Items.Clear(); StringEnum e = new StringEnum(typeof(MessageFormat)); foreach (string s in e.GetStringValues()) { cboMessageFormat.Items.Add(s); } cboMessageFormat.SelectedIndex = 0; // Load message status report cboStatusReport.Items.Clear(); e = new StringEnum(typeof(MessageStatusReport)); foreach (string s in e.GetStringValues()) { cboStatusReport.Items.Add(s); } cboStatusReport.SelectedIndex = 0; // Load message type cboMessageType.Items.Clear(); e = new StringEnum(typeof(OutgoingMessageType)); foreach (string s in e.GetStringValues()) { cboMessageType.Items.Add(s); } cboMessageType.SelectedIndex = 0; // Load priority cboPriority.Items.Clear(); cboPriority.Items.AddRange(EnumMatcher.MessagePriority.Keys.ToArray()); cboPriority.SelectedIndex = 1; cboMessageClass.Items.Clear(); cboMessageClass.Items.AddRange(EnumMatcher.MessageClass.Keys.ToArray()); cboMessageClass.SelectedIndex = 0; npdQuantity.Value = 1; dtpScheduleTime.Value = DateTime.Now; //txtMessageContent.Text = string.Empty; // WAP push signal cboWapPushSignal.Items.Clear(); cboWapPushSignal.Items.AddRange(EnumMatcher.ServiceIndication.Keys.ToArray()); cboWapPushSignal.SelectedIndex = 0; if (this.Message != null) { PresetMessageDetails(this.Message); } }
public async void GetCoinAddressYn() { try { using (RequestCoinAddressTableModel req = new RequestCoinAddressTableModel()) { req.userEmail = MainViewModel.LoginDataModel.userEmail; using (ResponseCoinAddressTableModel res = await WebApiLib.AsyncCall <ResponseCoinAddressTableModel, RequestCoinAddressTableModel>(req)) { if (res != null) { CoinAddressHeight = 45; ObservableCollection <ResponseCoinAddressTableListModel> delTemp = new ObservableCollection <ResponseCoinAddressTableListModel>(); foreach (var item in res.data.list) { if (item.curcyCd.Equals(StringEnum.GetStringValue(EnumLib.ExchangeCurrencyCode.KRW)) || item.curcyCd.Equals(EnumLib.ExchangeCurrencyCode.DestinationTag)) { delTemp.Add(item); } if (item.accNo.Equals(string.Empty)) { item.accNo = NonAddress; } else if (!item.destiTag.Equals(string.Empty)) { string sTag = string.Empty; if (item.curcyCd.Equals(StringEnum.GetStringValue(EnumLib.ExchangeCurrencyCode.XRP))) { sTag = "DestinationTag : "; } else if (item.curcyCd.Equals(StringEnum.GetStringValue(EnumLib.ExchangeCurrencyCode.VSTC)) || item.curcyCd.Equals(StringEnum.GetStringValue(EnumLib.ExchangeCurrencyCode.XEM))) { sTag = "Message : "; } else if (item.curcyCd.Equals(StringEnum.GetStringValue(EnumLib.ExchangeCurrencyCode.XLM)) || item.curcyCd.Equals(StringEnum.GetStringValue(EnumLib.ExchangeCurrencyCode.EOS))) { sTag = "Memo : "; } item.accNo = $"{item.accNo + " (" + sTag + item.destiTag + ")"}"; } CoinAddressHeight += 30; } if (delTemp != null) { foreach (ResponseCoinAddressTableListModel temp in delTemp) { res.data.list.Remove(temp); CoinAddressHeight -= 30; } } CoinAddressValue = res.data.list; } } } } catch (Exception ex) { SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace); } }
public void GetAsset() { try { TotAsset = 0; coinTotAsset = 0; AssetValue = new ObservableCollection <ResponseMainAssetListModel>(); AssetHeight = 53; string CommonFloat = "n0"; foreach (ResponseMainAssetListModel item in MainViewModel.Asset) { if (item.trLimtAmt > 0) { item.trLimtColor = "Red"; } else { item.trLimtColor = "Black"; } if (item.curcyCd.Equals(StringEnum.GetStringValue(EnumLib.ExchangeCurrencyCode.KRW))) { item.curcyNm = CommonLib.StandardCurcyNm; CommonFloat = "n" + MainViewModel.CoinData.CashDecimal; item.posCn = item.posCnPrc.ToString(CommonFloat); item.impCn = item.impCnPrc.ToString(CommonFloat); item.totCn = item.kwdPrc.ToString(CommonFloat); item.trustCn = item.trustPrc.ToString(CommonFloat); item.trLimtCn = item.trLimtAmt.ToString(CommonFloat); UsdAsset = item; TotAsset += UsdAsset.kwdPrc; item.ExchangeVisible = System.Windows.Visibility.Collapsed; } else { item.curcyNm = StringEnum.ToEnum <EnumLib.ExchangeCurrencyCode>(item.curcyCd).ToString(); //ResponseCoinListModel cl = MainViewModel.CoinData.list.Where(w => w.CoinCode == item.curcyCd).FirstOrDefault(); CommonFloat = "n0"; coinTotAsset = item.kwdPrc; TotAsset += item.kwdPrc; item.posCn = item.posCnAmt.ToString("#,0.00000000"); item.impCn = item.impCnAmt.ToString("#,0.00000000"); item.totCn = item.totCoinAmt.ToString("#,0.00000000"); item.trustCn = item.trustAmt.ToString("#,0.00000000"); item.trLimtCn = item.trLimtAmt.ToString("#,0.00000000"); if (item.posCnPrc > 0) { item.posExchange = "( " + "≈" + item.posCnPrc.ToString(CommonFloat) + " " + CommonLib.StandardCurcyNm + ")"; } else { item.posExchange = "( " + item.posCnPrc.ToString(CommonFloat) + " " + CommonLib.StandardCurcyNm + ")"; } if (item.impCnPrc > 0) { item.impExchange = "( " + "≈" + item.impCnPrc.ToString(CommonFloat) + " " + CommonLib.StandardCurcyNm + ")"; } else { item.impExchange = "( " + item.impCnPrc.ToString(CommonFloat) + " " + CommonLib.StandardCurcyNm + ")"; } if (item.kwdPrc > 0) { item.totExchange = "( " + "≈" + item.kwdPrc.ToString(CommonFloat) + " " + CommonLib.StandardCurcyNm + ")"; } else { item.totExchange = "( " + item.kwdPrc.ToString(CommonFloat) + " " + CommonLib.StandardCurcyNm + ")"; } if (item.trustPrc > 0) { item.trustExchange = "( " + "≈" + item.trustPrc.ToString(CommonFloat) + " " + CommonLib.StandardCurcyNm + ")"; } else { item.trustExchange = "( " + item.trustPrc.ToString(CommonFloat) + " " + CommonLib.StandardCurcyNm + ")"; } item.ExchangeVisible = System.Windows.Visibility.Visible; } AssetValue.Add(item); AssetHeight += 35; } } catch (Exception ex) { SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace); } }
/// <summary> /// Initializes a new instance of the <see cref="PageDirection"/> class. /// </summary> /// <param name="majorOrder">The major order that the rectangular array should be traversed.</param> /// <param name="minorOrder">The minor order that the rectangular array should be traversed.</param> public PageDirection(HorizontalDirection majorOrder, VerticalDirection minorOrder) { this.majorOrder = majorOrder; this.minorOrder = minorOrder; Validate(); }