コード例 #1
0
        internal void Update(long[] rpRawData)
        {
            var rState = (int)rpRawData[0];
            var rExpeditionID = (int)rpRawData[1];
            var rTimeToComplete = rpRawData[2];

            if (rState != 0)
            {
                if (Expedition == null)
                    foreach (var rShip in r_Fleet.Ships)
                        rShip.State |= ShipState.Expedition;

                Expedition = KanColleGame.Current.MasterInfo.Expeditions[rExpeditionID];
                TimeToComplete = new DateTimeOffset?(DateTimeUtil.UnixEpoch.AddMilliseconds(rTimeToComplete));
            }
            else
            {
                if (Expedition != null)
                    foreach (var rShip in r_Fleet.Ships)
                        rShip.State &= ~ShipState.Expedition;

                Expedition = null;
                TimeToComplete = null;
            }
        }
コード例 #2
0
        private RetryConditionHeaderValue(RetryConditionHeaderValue source)
        {
            Contract.Requires(source != null);

            _delta = source._delta;
            _date = source._date;
        }
コード例 #3
0
ファイル: Stopwatch.cs プロジェクト: thomas-parrish/Common
        public void Start()
        {
            if (IsRunning)
                return;

            Started = DateTimeOffset.Now;
        }
コード例 #4
0
 public OnlineDatabaseBackup(string serverName, string databaseName, int state, DateTimeOffset? timestamp)
 {
     State = state;
     Timestamp = timestamp;
     ServerName = serverName;
     DatabaseName = databaseName;
 }
コード例 #5
0
        private RangeConditionHeaderValue(RangeConditionHeaderValue source)
        {
            Debug.Assert(source != null);

            _entityTag = source._entityTag;
            _date = source._date;
        }
コード例 #6
0
ファイル: Time.cs プロジェクト: rrl9000/Overflow.net
 public static void Wait(TimeSpan timeSpan)
 {
     if (!_stoppedAt.HasValue)
         new AutoResetEvent(false).WaitOne(timeSpan);
     else
         _stoppedAt += timeSpan;
 }
コード例 #7
0
 private WarningHeaderValue(WarningHeaderValue source)
 {
     this.code = source.code;
     this.agent = source.agent;
     this.text = source.text;
     this.date = source.date;
 }
コード例 #8
0
ファイル: Time.cs プロジェクト: rrl9000/Overflow.net
            internal Measurement()
            {
                if (_stoppedAt.HasValue)
                    _startedAt = OffsetUtcNow;

                _stopwatch = Stopwatch.StartNew();
            }
コード例 #9
0
ファイル: IndexHandler.cs プロジェクト: robbanp/AzureIndex
        /// <summary>
        /// Check and update folder if it's new
        /// </summary>
        /// <param name="storageInfo">Connection info</param>
        /// <param name="containerName">Container name</param>
        /// <param name="packageFileName">Archive file name</param>
        /// <param name="indexPath">Path to folder</param>
        /// <param name="checkEverySeconds">Number of seconds between blob storage check</param>
        public static void CheckStorage(string storageInfo, string containerName, string packageFileName,
                                        string indexPath, int checkEverySeconds)
        {
            if (LastChecked != null && DateTime.UtcNow.AddSeconds(0 - checkEverySeconds) < LastChecked) //wait xx seconds until next peek in blob storage
            {
                return;
            }
            LastChecked = DateTime.UtcNow;

            var storage = new StorageHandler(storageInfo);
            CloudBlockBlob blob = storage.GetBlob(containerName, packageFileName);

            blob.FetchAttributes();
            DateTimeOffset? modified = blob.Properties.LastModified;
            if (modified > LastModified || LastModified == null)
            {
                string zipPath = Directory.GetParent(indexPath).ToString();
                string archiveDest = Path.Combine(zipPath, packageFileName);
                using (FileStream fileStream = File.OpenWrite(archiveDest))
                {
                    blob.DownloadToStream(fileStream);
                }
                LastModified = modified;
                lock (IndexLock)
                {
                    StorageHandler.ExtractArchive(indexPath + "_tmp", archiveDest);
                    if (Directory.Exists(indexPath))
                    {
                        Directory.Delete(indexPath, true);
                    }
                    Directory.Move(indexPath + "_tmp", indexPath);
                }
                //unlock
            }
        }
コード例 #10
0
        private RetryConditionHeaderValue(RetryConditionHeaderValue source)
        {
            Debug.Assert(source != null);

            _delta = source._delta;
            _date = source._date;
        }
コード例 #11
0
        private RangeConditionHeaderValue(RangeConditionHeaderValue source)
        {
            Contract.Requires(source != null);

            _entityTag = source._entityTag;
            _date = source._date;
        }
コード例 #12
0
ファイル: Timesheet.cs プロジェクト: ninjeff/GitPaid
        public void Visit(WorkEnded evt)
        {
            if (_CurrentWorkBeganTime != null)
                _TimeWorked += evt.EndTime - _CurrentWorkBeganTime.Value;

            _CurrentWorkBeganTime = null;
        }
コード例 #13
0
 public iCalendarResult(string uid = "", DateTimeOffset? datetime = null, TimeSpan? duration = null, string summary = "", string description = "", string location = "") {
     _uid = uid;
     _datetime = datetime;
     _duration = duration;
     _summary = summary;
     _description = description;
     _location = location;
 }
コード例 #14
0
ファイル: InMemoryFile.cs プロジェクト: DotNetIO/DotNetIO
        public InMemoryFile(string filePath)
        {
            Path = new Path(filePath);
            Name = Path.GetFileName(filePath);
            NameWithoutExtension = Path.GetFileNameWithoutExtension(filePath);

            _LastModifiedTimeUtc = null;
        }
コード例 #15
0
ファイル: MilestoneElement.cs プロジェクト: RaineriOS/CodeHub
 public MilestoneElement(int number, string title, int openIssues, int closedIssues, DateTimeOffset? dueDate)
 {
     Number = number;
     _title = title;
     _openIssues = openIssues;
     _closedIssues = closedIssues;
     _dueDate = dueDate;
 }
コード例 #16
0
ファイル: WarningHeaderValue.cs プロジェクト: nuxleus/WCFWeb
        private WarningHeaderValue(WarningHeaderValue source)
        {
            Contract.Requires(source != null);

            this.code = source.code;
            this.agent = source.agent;
            this.text = source.text;
            this.date = source.date;
        }
コード例 #17
0
        private WarningHeaderValue(WarningHeaderValue source)
        {
            Debug.Assert(source != null);

            _code = source._code;
            _agent = source._agent;
            _text = source._text;
            _date = source._date;
        }
コード例 #18
0
 public ReleaseNoteItem(string title, string issueNumber, Uri htmlUrl, string[] tags, DateTimeOffset? resolvedOn, Contributor[] contributors)
 {
     this.title = title;
     this.issueNumber = issueNumber;
     this.htmlUrl = htmlUrl;
     this.tags = tags ?? new string[0];
     this.resolvedOn = resolvedOn;
     this.contributors = contributors;
 }
コード例 #19
0
        private WarningHeaderValue(WarningHeaderValue source)
        {
            Contract.Requires(source != null);

            _code = source._code;
            _agent = source._agent;
            _text = source._text;
            _date = source._date;
        }
コード例 #20
0
        protected internal TimeSpanAssertions(DateTimeOffsetAssertions parentAssertions, DateTimeOffset? subject, TimeSpanCondition condition,
            TimeSpan timeSpan)
        {
            this.parentAssertions = parentAssertions;
            this.subject = subject;
            this.timeSpan = timeSpan;

            predicate = predicates[condition];
        }
コード例 #21
0
        public void CreatePersonUsingClientAssignedId()
        {
            var rnd = new Random();
            CrudId = "sprink" + rnd.Next().ToString();

            Versions.Add(tryCreatePatient(client, ResourceFormat.Xml, CrudId));

            CreateDate = DateTimeOffset.Now;
        }
コード例 #22
0
ファイル: Stopwatch.cs プロジェクト: thomas-parrish/Common
        public void Stop()
        {
            if (!IsRunning)
                return;

            Debug.Assert(Started != null, "Started != null");
            _time += (DateTimeOffset.Now - Started.Value);
            Started = null;
        }
コード例 #23
0
 private RecentInvocationEntry(Guid id, string displayTitle, DateTimeOffset? startTime, DateTimeOffset? endTime,
     bool? succeeded, HeartbeatDescriptor heartbeat)
 {
     _id = id;
     _displayTitle = displayTitle;
     _startTime = startTime;
     _endTime = endTime;
     _succeeded = succeeded;
     _heartbeat = heartbeat;
 }
コード例 #24
0
        private void HandleHeartBeat()
        {
            _lastHeard = Context.System.Scheduler.Now;
            Context.System.ActorSelection(Addresses.ConsoleWriter.Path).Tell(new MachineStatus(_machineName, true, _lastHeard, null));

            if (_cancelable != null)
                _cancelable.Cancel();

            _cancelable = Context.System.Scheduler.ScheduleTellOnceCancelable(TimeSpan.FromSeconds(2), Self, new Flatlined(), Self);
        }
コード例 #25
0
ファイル: UserDetails.cs プロジェクト: danieldeb/EventStore
 /// <summary>
 /// create a new <see cref="UserDetails"/> class.
 /// </summary>
 /// <param name="loginName">The login name of the user.</param>
 /// <param name="fullName">The users full name.</param>
 /// <param name="groups">The groups this user is a member if.</param>
 /// <param name="disabled">Is this user disabled or not.</param>
 /// <param name="dateLastUpdated">The datt/time this user was last updated in UTC format.</param>
 /// <param name="links">List of hypermedia links describing actions allowed on user resource.</param>
 public UserDetails(
     string loginName, string fullName, string[] groups, bool disabled, DateTimeOffset? dateLastUpdated, RelLink[] links)
 {
     LoginName = loginName;
     FullName = fullName;
     Groups = groups;
     Disabled = disabled;
     DateLastUpdated = dateLastUpdated;
     Links = links;
 }
コード例 #26
0
 /// <summary>
 /// Azure storage blob constructor
 /// </summary>
 /// <param name="blob">ICloud blob object</param>
 public AzureStorageBlob(ICloudBlob blob)
 {
     Name = blob.Name;
     ICloudBlob = blob;
     BlobType = blob.BlobType;
     Length = blob.Properties.Length;
     ContentType = blob.Properties.ContentType;
     LastModified = blob.Properties.LastModified;
     SnapshotTime = blob.SnapshotTime;
 }
コード例 #27
0
 /// <summary>Initializes a new instance of the <see cref="T:NMasters.Silverlight.Net.Http.Headers.WarningHeaderValue" /> class.</summary>
 /// <param name="code">The specific warning code.</param>
 /// <param name="agent">The host that attached the warning.</param>
 /// <param name="text">A quoted-string containing the warning text.</param>
 /// <param name="date">The date/time stamp of the warning.</param>
 public WarningHeaderValue(int code, string agent, string text, DateTimeOffset date)
 {
     CheckCode(code);
     CheckAgent(agent);
     HeaderUtilities.CheckValidQuotedString(text, "text");
     this.code = code;
     this.agent = agent;
     this.text = text;
     this.date = new DateTimeOffset?(date);
 }
コード例 #28
0
        public WarningHeaderValue(int code, string agent, string text, DateTimeOffset date)
        {
            CheckCode(code);
            CheckAgent(agent);
            HeaderUtilities.CheckValidQuotedString(text, "text");

            _code = code;
            _agent = agent;
            _text = text;
            _date = date;
        }
コード例 #29
0
 DateTimeOffset? ParseDeployAt(string v)
 {
     try
     {
         return DeployAt = DateTimeOffset.Parse(v, CultureInfo.CurrentCulture, DateTimeStyles.AssumeLocal);
     }
     catch (FormatException fex)
     {
         throw new CommandException("Could not convert '" + v + "' to a DateTimeOffset: " + fex.Message);
     }
 }
コード例 #30
0
        public adding_to_existing_scope()
        {
            given_system_package("sauron", "1.0.0");
            given_project_package("one-ring", "1.0.0");
            
            given_dependency("tests", "depends: one-ring");

            DefaultDescriptorTimeStamp = Environment.ScopedDescriptors[string.Empty].File.LastModifiedTimeUtc;
            ScopedDescriptorTimeStamp = Environment.ScopedDescriptors[string.Empty].File.LastModifiedTimeUtc;
            when_executing_command("sauron -scope tests");
        }
コード例 #31
0
        // GET: api/Conversations
        public async Task <IQueryable <ConversationDTO> > GetConversations(DateTimeOffset?from = null)
        {
            UserPreference         prefs      = null;
            ICollection <Category> categories = null;

            // Get user preferences
            if (User.Identity.IsAuthenticated)
            {
                string userId = User.Identity.GetUserId();

                prefs = await db.UserPreferences
                        .Include(x => x.UserCategory.Select(y => y.Category))
                        .Where(x => x.ApplicationUser_Id == userId).SingleOrDefaultAsync();
            }

            int maxPerCategory;

            // Preferences can be null if (a) request is not authenticated or (b) user never set any preferences.
            if (prefs != null)
            {
                categories     = prefs.UserCategory.Select(u => u.Category).ToList();
                maxPerCategory = prefs.ConversationLimit;
            }
            else
            {
                maxPerCategory = DefaultConversationLimit;
            }

            // Add "from" clause if specified
            var q = db.Conversations as IQueryable <Conversation>;

            if (from != null)
            {
                q = q.Where(x => x.DbUpdated >= from.Value);
            }

            // The query to use depends on whether we have valid user preferences.
            // If not, we return all categories by default.
            IEnumerable <AggregatedConversations> results;

            if (categories == null)
            {
                results = (from conv in q
                           group conv by conv.CategoryID into g
                           select new AggregatedConversations
                {
                    Children = (from c in g
                                orderby c.LastUpdated descending
                                select c).Take(maxPerCategory)
                });
            }
            else
            {
                results = (from category in categories
                           join conv in q on category.CategoryID equals conv.CategoryID into g
                           select new AggregatedConversations
                {
                    Children = (from c in g
                                orderby c.LastUpdated descending
                                select c).Take(maxPerCategory)
                });
            }

            // Flatten grouped conversations into a list
            List <Conversation> convos = new List <Conversation>();

            foreach (var r in results)
            {
                convos.AddRange(r.Children);
            }

            return(convos.AsQueryable().Project().To <ConversationDTO>());
        }
コード例 #32
0
        /// <summary>
        /// 服务商
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="mchId"></param>
        /// <param name="subappid">子商户公众账号ID</param>
        /// <param name="submchid">子商户号</param>
        /// <param name="body"></param>
        /// <param name="outTradeNo"></param>
        /// <param name="totalFee">单位:分</param>
        /// <param name="spbillCreateIp"></param>
        /// <param name="notifyUrl"></param>
        /// <param name="tradeType"></param>
        /// <param name="openid">trade_type=NATIVE时,OpenId应该为null</param>
        /// <param name="subOpenid">用户子标识,不需要则填写null</param>
        /// <param name="key"></param>
        /// <param name="nonceStr"></param>
        /// <param name="deviceInfo">自定义参数,可以为终端设备号(门店号或收银设备ID),PC网页或公众号内支付可以传"WEB",String(32)如:013467007045764</param>
        /// <param name="timeStart">订单生成时间,如果为空,则默认为当前服务器时间</param>
        /// <param name="timeExpire">订单失效时间,留空则不设置失效时间</param>
        /// <param name="detail">商品详细列表</param>
        /// <param name="attach">附加数据</param>
        /// <param name="feeType">符合ISO 4217标准的三位字母代码,默认人民币:CNY</param>
        /// <param name="goodsTag">商品标记,使用代金券或立减优惠功能时需要的参数,说明详见代金券或立减优惠。String(32),如:WXG</param>
        /// <param name="productId">trade_type=NATIVE时(即扫码支付),此参数必传。此参数为二维码中包含的商品ID,商户自行定义。String(32),如:12235413214070356458058</param>
        /// <param name="limitPay">是否限制用户不能使用信用卡支付</param>
        /// <param name="sceneInfo">场景信息。该字段用于上报场景信息,目前支持上报实际门店信息。</param>
        /// <param name="profitSharing">
        /// 是否需要分账
        /// https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=24_3&index=3
        /// https://pay.weixin.qq.com/wiki/doc/api/allocation.php?chapter=26_3
        /// "Y" -- 需要分账, null 或者 "N"-不需要分账,
        /// 服务商需要在 产品中心--特约商户授权产品 申请特约商户授权,
        /// 并且特约商户需要在 产品中心-我授权的商品中给服务商授权才可以使用分账功能;
        /// 普通商户需要 产品中心-我的产品 中开通分账功能;
        /// </param>
        /// <param name="version">统一下单接口参数,参考:https://pay.weixin.qq.com/wiki/doc/api/danpin.php?chapter=9_203&amp;index=6</param>
        public TenPayV3UnifiedorderRequestData(
            string appId, string mchId, string subappid, string submchid, string body, string outTradeNo, int totalFee, string spbillCreateIp,
            string notifyUrl, TenPayV3Type tradeType, string openid, string subOpenid, string key, string nonceStr,
            string deviceInfo = null, DateTimeOffset?timeStart = null, DateTime?timeExpire = null,
            string detail     = null, string attach = null, string feeType = "CNY", string goodsTag = null,
            string productId  = null, bool limitPay = false,
            TenPayV3UnifiedorderRequestData_SceneInfo sceneInfo = null,
            string profitSharing = null, string version = null
            )
        {
            AppId          = appId;
            MchId          = mchId;
            DeviceInfo     = deviceInfo;
            NonceStr       = nonceStr;
            SignType       = "MD5";
            Body           = body ?? "Senparc TenpayV3";
            Detail         = detail;
            Attach         = attach;
            OutTradeNo     = outTradeNo;
            FeeType        = feeType;
            TotalFee       = totalFee;
            SpbillCreateIP = spbillCreateIp;
            TimeStart      = (timeStart ?? SystemTime.Now).ToString("yyyyMMddHHmmss");
            TimeExpire     = timeExpire.HasValue ? timeExpire.Value.ToString("yyyyMMddHHmmss") : null;
            GoodsTag       = goodsTag;
            NotifyUrl      = notifyUrl;
            TradeType      = tradeType;
            ProductId      = productId;
            LimitPay       = limitPay ? "no_credit" : null;
            OpenId         = openid;
            Key            = key;
            SubAppId       = subappid;
            SubMchId       = submchid;
            SubOpenid      = subOpenid;
            SceneInfo      = sceneInfo;
            ProfitSharing  = profitSharing;
            Version        = version;

            #region 设置RequestHandler

            //创建支付应答对象
            PackageRequestHandler = new RequestHandler(null);
            //初始化
            PackageRequestHandler.Init();

            //设置package订单参数
            //以下设置顺序按照官方文档排序,方便维护:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1
            PackageRequestHandler.SetParameterWhenNotNull("version", Version);
            PackageRequestHandler.SetParameter("appid", this.AppId);                             //公众账号ID
            PackageRequestHandler.SetParameter("mch_id", this.MchId);                            //商户号
            PackageRequestHandler.SetParameterWhenNotNull("sub_appid", this.SubAppId);           //子商户公众账号ID
            PackageRequestHandler.SetParameterWhenNotNull("sub_mch_id", this.SubMchId);          //子商户号
            PackageRequestHandler.SetParameterWhenNotNull("device_info", this.DeviceInfo);       //自定义参数
            PackageRequestHandler.SetParameter("nonce_str", this.NonceStr);                      //随机字符串
            PackageRequestHandler.SetParameterWhenNotNull("sign_type", this.SignType);           //签名类型,默认为MD5
            PackageRequestHandler.SetParameter("body", this.Body);                               //商品信息
            PackageRequestHandler.SetParameterWhenNotNull("detail", this.Detail);                //商品详细列表
            PackageRequestHandler.SetParameterWhenNotNull("attach", this.Attach);                //附加数据
            PackageRequestHandler.SetParameter("out_trade_no", this.OutTradeNo);                 //商家订单号
            PackageRequestHandler.SetParameterWhenNotNull("fee_type", this.FeeType);             //符合ISO 4217标准的三位字母代码,默认人民币:CNY
            PackageRequestHandler.SetParameter("total_fee", this.TotalFee.ToString());           //商品金额,以分为单位(money * 100).ToString()
            PackageRequestHandler.SetParameter("spbill_create_ip", this.SpbillCreateIP);         //用户的公网ip,不是商户服务器IP
            PackageRequestHandler.SetParameterWhenNotNull("time_start", this.TimeStart);         //订单生成时间
            PackageRequestHandler.SetParameterWhenNotNull("time_expire", this.TimeExpire);       //订单失效时间
            PackageRequestHandler.SetParameterWhenNotNull("goods_tag", this.GoodsTag);           //商品标记
            PackageRequestHandler.SetParameter("notify_url", this.NotifyUrl);                    //接收财付通通知的URL
            PackageRequestHandler.SetParameter("trade_type", this.TradeType.ToString());         //交易类型
            PackageRequestHandler.SetParameterWhenNotNull("product_id", this.ProductId);         //trade_type=NATIVE时(即扫码支付),此参数必传。
            PackageRequestHandler.SetParameterWhenNotNull("limit_pay", this.LimitPay);           //上传此参数no_credit--可限制用户不能使用信用卡支付
            PackageRequestHandler.SetParameterWhenNotNull("openid", this.OpenId);                //用户的openId,trade_type=JSAPI时(即公众号支付),此参数必传
            PackageRequestHandler.SetParameterWhenNotNull("sub_openid", this.SubOpenid);         //用户子标识
            PackageRequestHandler.SetParameterWhenNotNull("profit_sharing", this.ProfitSharing); //是否需要分账标识
            if (SceneInfo != null)
            {
                PackageRequestHandler.SetParameter("scene_info", SceneInfo.ToString());   //场景信息
            }

            Sign = PackageRequestHandler.CreateMd5Sign("key", this.Key);

            PackageRequestHandler.SetParameter("sign", Sign);                              //签名
            #endregion
        }
コード例 #33
0
        async Task <ContactList> IHubSpotListClient.GetContactsRecentlyAddedToListAsync(long listId, IReadOnlyList <IProperty> properties, PropertyMode propertyMode, FormSubmissionMode formSubmissionMode, bool showListMemberships, int count, long?contactOffset, DateTimeOffset?timeOffset)
        {
            if (count > 100)
            {
                throw new ArgumentOutOfRangeException(nameof(count), "Up to 100 contacts can be requested at the same time");
            }

            var builder = new HttpQueryStringBuilder();

            builder.AddProperties(properties);
            builder.AddPropertyMode(propertyMode);
            builder.AddFormSubmissionMode(formSubmissionMode);
            builder.AddShowListMemberships(showListMemberships);
            builder.Add("count", count.ToString());
            builder.Add("vidOffset", contactOffset);

            if (timeOffset.HasValue)
            {
                builder.Add("timeOffset", timeOffset.Value.ToUnixTimeMilliseconds().ToString());
            }

            var list = await _client.GetAsync <ContactList>($"/contacts/v1/lists/{listId}/contacts/recent", builder.BuildQuery());

            return(list);
        }
コード例 #34
0
 internal ManagedInstanceOperation(string id, string name, string type, string managedInstanceName, string operation, string operationFriendlyName, int?percentComplete, DateTimeOffset?startTime, ManagementOperationState?state, int?errorCode, string errorDescription, int?errorSeverity, bool?isUserError, DateTimeOffset?estimatedCompletionTime, string description, bool?isCancellable, ManagedInstanceOperationParametersPair operationParameters, ManagedInstanceOperationSteps operationSteps) : base(id, name, type)
 {
     ManagedInstanceName   = managedInstanceName;
     Operation             = operation;
     OperationFriendlyName = operationFriendlyName;
     PercentComplete       = percentComplete;
     StartTime             = startTime;
     State                   = state;
     ErrorCode               = errorCode;
     ErrorDescription        = errorDescription;
     ErrorSeverity           = errorSeverity;
     IsUserError             = isUserError;
     EstimatedCompletionTime = estimatedCompletionTime;
     Description             = description;
     IsCancellable           = isCancellable;
     OperationParameters     = operationParameters;
     OperationSteps          = operationSteps;
 }
コード例 #35
0
 /// <inheritdoc />
 public GetInfluencersDescriptor Start(DateTimeOffset?end) => Assign(a => a.Start = end);
コード例 #36
0
 public static IValitRule <TObject, DateTimeOffset?> IsSameAs <TObject>(this IValitRule <TObject, DateTimeOffset?> rule, DateTimeOffset?dateTimeOffset) where TObject : class
 => rule.Satisfies(p => p.HasValue && dateTimeOffset.HasValue && p.Value == dateTimeOffset.Value).WithDefaultMessage(ErrorMessages.IsSameAs, dateTimeOffset);
コード例 #37
0
 internal CloudBlob(string blobName, DateTimeOffset?snapshotTime, CloudBlobContainer container)
 {
     throw new System.NotImplementedException();
 }
コード例 #38
0
 public CloudBlob(StorageUri blobAbsoluteUri, DateTimeOffset?snapshotTime, StorageCredentials credentials)
 {
     throw new System.NotImplementedException();
 }
コード例 #39
0
 protected override IdentityUserWithGenerics CreateTestUser(string namePrefix   = "", string email = "", string phoneNumber = "",
                                                            bool lockoutEnabled = false, DateTimeOffset?lockoutEnd = default(DateTimeOffset?), bool useNamePrefixAsUserName = false)
 {
     return(new IdentityUserWithGenerics
     {
         UserName = useNamePrefixAsUserName ? namePrefix : string.Format(CultureInfo.InvariantCulture, "{0}{1}", namePrefix, Guid.NewGuid()),
         Email = email,
         PhoneNumber = phoneNumber,
         LockoutEnabled = lockoutEnabled,
         LockoutEnd = lockoutEnd
     });
 }
コード例 #40
0
        public static void WriteProp(this BinaryWriter writer, ref int count, string key, DateTimeOffset?value)
        {
            if (value.HasValue)
            {
                writer.Write(key);
                writer.Write(value.Value.ToString("o"));

                count++;
            }
        }
コード例 #41
0
ファイル: Tracer.cs プロジェクト: yusufozturk/dd-trace-dotnet
        /// <summary>
        /// Creates a new <see cref="Span"/> with the specified parameters.
        /// </summary>
        /// <param name="operationName">The span's operation name</param>
        /// <param name="parent">The span's parent</param>
        /// <param name="serviceName">The span's service name</param>
        /// <param name="startTime">An explicit start time for that span</param>
        /// <param name="ignoreActiveScope">If set the span will not be a child of the currently active span</param>
        /// <returns>The newly created span</returns>
        public Span StartSpan(string operationName, ISpanContext parent = null, string serviceName = null, DateTimeOffset?startTime = null, bool ignoreActiveScope = false)
        {
            if (parent == null && !ignoreActiveScope)
            {
                parent = _scopeManager.Active?.Span?.Context;
            }

            ITraceContext traceContext;

            // try to get the trace context (from local spans) or
            // sampling priority (from propagated spans),
            // otherwise start a new trace context
            if (parent is SpanContext parentSpanContext)
            {
                traceContext = parentSpanContext.TraceContext ??
                               new TraceContext(this)
                {
                    SamplingPriority = parentSpanContext.SamplingPriority
                };
            }
            else
            {
                traceContext = new TraceContext(this);
            }

            var finalServiceName = serviceName ?? parent?.ServiceName ?? DefaultServiceName;
            var spanContext      = new SpanContext(parent, traceContext, finalServiceName);

            var span = new Span(spanContext, startTime)
            {
                OperationName = operationName,
            };

            // Apply any global tags
            if (Settings.GlobalTags.Count > 0)
            {
                foreach (var entry in Settings.GlobalTags)
                {
                    span.SetTag(entry.Key, entry.Value);
                }
            }

            // automatically add the "env" tag if defined, taking precedence over an "env" tag set from a global tag
            var env = Settings.Environment;

            if (!string.IsNullOrWhiteSpace(env))
            {
                span.SetTag(Tags.Env, env);
            }

            // automatically add the "version" tag if defined, taking precedence over an "version" tag set from a global tag
            var version = Settings.ServiceVersion;

            if (!string.IsNullOrWhiteSpace(version) && string.Equals(finalServiceName, DefaultServiceName))
            {
                span.SetTag(Tags.Version, version);
            }

            traceContext.AddSpan(span);
            return(span);
        }
コード例 #42
0
        public async Task <IEnumerable <EventEntry> > GetEvents(DateTimeOffset?start = null, DateTimeOffset?end = null)
        {
            var builder = new StringBuilder($"SELECT TOP {_options.SelectLimit} * FROM {_options.EventsTableName} WHERE Not Id IS NULL");

            if (start.HasValue)
            {
                builder.Append(" AND TimeStamp >= \'" + start + "\'");
            }
            if (end.HasValue)
            {
                builder.Append(" AND TimeStamp <= \'" + end + "\'");
            }
            if (String.IsNullOrWhiteSpace(_environment.Title))
            {
                builder.Append(" AND ApplicationName is NULL");
            }
            else
            {
                builder.Append(" AND ApplicationName = \'" + _environment.Title + "\'");
            }
            if (String.IsNullOrWhiteSpace(_environment.Environment))
            {
                builder.Append(" AND Environment is NULL");
            }
            else
            {
                builder.Append(" AND Environment = \'" + _environment.Environment + "\'");
            }

            using (var connection = new SqlConnection(_options.ConnectionString))
            {
                connection.Open();

                using (var command = new SqlCommand(builder.ToString(), connection))
                {
                    using (var reader = await command.ExecuteReaderAsync())
                    {
                        using (var table = this.CreateTable())
                        {
                            table.Load(reader);
                            return(table.Rows.OfType <DataRow>()
                                   .Select(e => new EventEntry
                            {
                                Id = e["EntryId"].GetValue <string>(),
                                ApplicationName = e["ApplicationName"].GetValue <string>(),
                                Body = e["Body"].GetValue <string>(),
                                EnvironmentName = e["Environment"].GetValue <string>(),
                                MessageType = e["EventType"].GetValue <string>(),
                                Name = e["Name"].GetValue <string>(),
                                RequestId = e["RequestId"].GetValue <string>(),
                                TimeStamp = e["TimeStamp"].GetValue <DateTimeOffset>(),
                            }));
                        }
                    }
                }
            }
        }
コード例 #43
0
 internal ServiceBusSubscriptionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, long?messageCount, DateTimeOffset?createdAt, DateTimeOffset?accessedAt, DateTimeOffset?updatedAt, MessageCountDetails countDetails, TimeSpan?lockDuration, bool?requiresSession, TimeSpan?defaultMessageTimeToLive, bool?deadLetteringOnFilterEvaluationExceptions, bool?deadLetteringOnMessageExpiration, TimeSpan?duplicateDetectionHistoryTimeWindow, int?maxDeliveryCount, EntityStatus?status, bool?enableBatchedOperations, TimeSpan?autoDeleteOnIdle, string forwardTo, string forwardDeadLetteredMessagesTo, bool?isClientAffine, ServiceBusClientAffineProperties clientAffineProperties) : base(id, name, resourceType, systemData)
 {
     MessageCount             = messageCount;
     CreatedAt                = createdAt;
     AccessedAt               = accessedAt;
     UpdatedAt                = updatedAt;
     CountDetails             = countDetails;
     LockDuration             = lockDuration;
     RequiresSession          = requiresSession;
     DefaultMessageTimeToLive = defaultMessageTimeToLive;
     DeadLetteringOnFilterEvaluationExceptions = deadLetteringOnFilterEvaluationExceptions;
     DeadLetteringOnMessageExpiration          = deadLetteringOnMessageExpiration;
     DuplicateDetectionHistoryTimeWindow       = duplicateDetectionHistoryTimeWindow;
     MaxDeliveryCount              = maxDeliveryCount;
     Status                        = status;
     EnableBatchedOperations       = enableBatchedOperations;
     AutoDeleteOnIdle              = autoDeleteOnIdle;
     ForwardTo                     = forwardTo;
     ForwardDeadLetteredMessagesTo = forwardDeadLetteredMessagesTo;
     IsClientAffine                = isClientAffine;
     ClientAffineProperties        = clientAffineProperties;
 }
コード例 #44
0
 internal ConnectionMonitorResultProperties(ConnectionMonitorSource source, ConnectionMonitorDestination destination, bool?autoStart, int?monitoringIntervalInSeconds, IList <ConnectionMonitorEndpoint> endpoints, IList <ConnectionMonitorTestConfiguration> testConfigurations, IList <ConnectionMonitorTestGroup> testGroups, IList <ConnectionMonitorOutput> outputs, string notes, ProvisioningState?provisioningState, DateTimeOffset?startTime, string monitoringStatus, ConnectionMonitorType?connectionMonitorType) : base(source, destination, autoStart, monitoringIntervalInSeconds, endpoints, testConfigurations, testGroups, outputs, notes)
 {
     ProvisioningState     = provisioningState;
     StartTime             = startTime;
     MonitoringStatus      = monitoringStatus;
     ConnectionMonitorType = connectionMonitorType;
 }
コード例 #45
0
 public void SetPropertiesFrom(IDatabaseSinceParameter entity, Realms.Realm realm)
 {
     Id    = entity.Id;
     Since = entity.Since;
 }
コード例 #46
0
ファイル: ICache.cs プロジェクト: yxb1987/Platformus
 public CacheEntryOptions(DateTimeOffset?absoluteExpiration = null, TimeSpan?slidingExpiration = null, CacheEntryPriority priority = CacheEntryPriority.Normal)
 {
     this.AbsoluteExpiration = absoluteExpiration;
     this.SlidingExpiration  = slidingExpiration;
     this.Priority           = priority;
 }
コード例 #47
0
        public static IQueryable <CarePackage> FilterApprovableCarePackages(this IQueryable <CarePackage> packages,
                                                                            Guid?serviceUserId, string serviceUserName, PackageStatus?packageStatus, PackageType?packageType,
                                                                            Guid?approverId, DateTimeOffset?fromDate, DateTimeOffset?toDate, PackageStatus[] statusesToInclude)
        {
            var    searchTerms      = serviceUserName?.Split(' ').ToList();
            string searchTermFirst  = searchTerms?.First();
            string searchTermSecond = searchTerms != null && searchTerms.Count > 1 ? searchTerms[1] : null;

            return(packages.Where(package => (serviceUserId == null || package.ServiceUserId.Equals(serviceUserId)) &&
                                  (String.IsNullOrEmpty(serviceUserName) ||
                                   package.ServiceUser.FirstName.ToLower().Contains(searchTermFirst.ToLower()) ||
                                   package.ServiceUser.LastName.ToLower().Contains(searchTermFirst.ToLower()) ||
                                   package.ServiceUser.HackneyId.Equals(searchTermFirst)
                                  ) &&
                                  (searchTermSecond != null
                                                 ? package.ServiceUser.LastName.ToLower()
                                   .Contains(searchTermSecond.ToLower())
                                                 : package.Equals(package)) &&
                                  ((packageStatus == null && statusesToInclude.Contains(package.Status) ||
                                    package.Status.Equals(packageStatus))) &&
                                  (packageType == null || package.PackageType.Equals(packageType)) &&
                                  (approverId == null || package.ApproverId.Equals(approverId)) &&
                                  (fromDate == null ||
                                   package.Details.FirstOrDefault(d => d.Type == PackageDetailType.CoreCost)
                                   .StartDate >= fromDate) &&
                                  (toDate == null ||
                                   package.Details.FirstOrDefault(d => d.Type == PackageDetailType.CoreCost)
                                   .EndDate <= toDate)));           // TODO: VK: Review end date (can be empty)
        }
コード例 #48
0
        public async Task <IActionResult> ImportData(int portalId, [FromBody] ImportDataRequestModel model)
        {
            try
            {
                string storageConnectionString = _config["ConnectionStrings:AzureStorageConnection"];

                // Check whether the connection string can be parsed.
                if (!CloudStorageAccount.TryParse(storageConnectionString, out CloudStorageAccount storageAccount))
                {
                    throw new Exception("Storage account connection issue.");
                }

                // Create the CloudBlobClient that represents the Blob storage endpoint for the storage account.
                CloudBlobClient          cloudBlobClient = storageAccount.CreateCloudBlobClient();
                CloudBlobContainer       container       = cloudBlobClient.GetContainerReference(model.ContainerName);
                CloudBlob                blob            = container.GetBlobReference(model.Filename);
                Dictionary <int, string> headers         = new Dictionary <int, string>();
                Dictionary <int, string> errors          = new Dictionary <int, string>();
                int lineNumber = 0;

                await using (Stream stream = await blob.OpenReadAsync())
                {
                    using StreamReader reader = new StreamReader(stream);
                    while (!reader.EndOfStream)
                    {
                        string line = reader.ReadLine();

                        if (line == null)
                        {
                            continue;
                        }

                        string[] cols = line.Split(',');

                        if (lineNumber == 0)
                        {
                            // set headers
                            for (int i = 0; i < cols.Length; i++)
                            {
                                headers.Add(i, cols[i]);
                            }
                        }
                        else
                        {
                            try
                            {
                                // import data
                                switch (model.ImportType)
                                {
                                case ImportType.Cabins:
                                    CabinModel cabinModel = new CabinModel
                                    {
                                        Name      = GetColumnValue(model.Headers, headers, cols, "Name"),
                                        CreatedBy = model.CreatedBy,
                                        IsActive  = true
                                    };

                                    await _cabinRepository.CreateCabin(portalId, cabinModel);

                                    break;

                                case ImportType.Coupons:
                                    string expirationDateValue = GetColumnValue(model.Headers, headers, cols,
                                                                                "ExpirationDate");
                                    DateTimeOffset?expirationDate = null;

                                    if (expirationDateValue != null)
                                    {
                                        DateTimeOffset.TryParse(expirationDateValue,
                                                                out DateTimeOffset actualExpirationDate);

                                        expirationDate = actualExpirationDate;
                                    }

                                    CouponModel couponModel = new CouponModel
                                    {
                                        Name           = GetColumnValue(model.Headers, headers, cols, "Name"),
                                        Code           = GetColumnValue(model.Headers, headers, cols, "Code"),
                                        ExpirationDate = expirationDate,
                                        CreatedBy      = model.CreatedBy,
                                        IsActive       = true
                                    };

                                    await _couponRepository.CreateCoupon(portalId, couponModel);

                                    break;

                                default:
                                    throw new ArgumentException("The import type is required.");
                                }
                            }
                            catch (Exception ex)
                            {
                                errors.Add(lineNumber, ex.Message);
                            }
                        }

                        lineNumber++;
                    }
                }

                List <ImportError> importErrors = new List <ImportError>();

                if (errors.Any())
                {
                    importErrors.AddRange(errors.Select(error => new ImportError
                    {
                        LineNumber = error.Key, Message = error.Value
                    }));
                }
                else
                {
                    await container.DeleteAsync();
                }

                return(Ok(new ImportResponseModel
                {
                    Errors = importErrors
                }));
            }
            catch (ArgumentException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
コード例 #49
0
 internal StaticSiteBuildARMResourceData(ResourceIdentifier id, string name, ResourceType type, string kind, string buildId, string sourceBranch, string pullRequestTitle, string hostname, DateTimeOffset?createdTimeUtc, DateTimeOffset?lastUpdatedOn, BuildStatus?status, IReadOnlyList <Models.StaticSiteUserProvidedFunctionApp> userProvidedFunctionApps) : base(id, name, type, kind)
 {
     BuildId                  = buildId;
     SourceBranch             = sourceBranch;
     PullRequestTitle         = pullRequestTitle;
     Hostname                 = hostname;
     CreatedTimeUtc           = createdTimeUtc;
     LastUpdatedOn            = lastUpdatedOn;
     Status                   = status;
     UserProvidedFunctionApps = userProvidedFunctionApps;
 }
コード例 #50
0
        public static IQueryable <CarePackage> FilterBrokerViewPackages(this IQueryable <CarePackage> packages,
                                                                        Guid?serviceUserId, string serviceUserName, PackageStatus?status, Guid?brokerId,
                                                                        DateTimeOffset?fromDate, DateTimeOffset?toDate)
        {
            var    searchTerms      = serviceUserName?.Split(' ').ToList();
            string searchTermFirst  = searchTerms?.First();
            string searchTermSecond = searchTerms != null && searchTerms.Count > 1 ? searchTerms[1] : null;

            return(packages.Where(package => (serviceUserId == null || package.ServiceUserId.Equals(serviceUserId)) &&
                                  (String.IsNullOrEmpty(searchTermFirst) ||
                                   package.ServiceUser.FirstName.ToLower().Contains(searchTermFirst.ToLower()) ||
                                   package.ServiceUser.LastName.ToLower().Contains(searchTermFirst.ToLower()) ||
                                   package.ServiceUser.HackneyId.ToString().Equals(searchTermFirst)
                                  ) &&
                                  (searchTermSecond != null
                                                 ? package.ServiceUser.LastName.ToLower()
                                   .Contains(searchTermSecond.ToLower())
                                                 : package.Equals(package)) &&
                                  (status == null || package.Status.Equals(status)) &&
                                  (brokerId == null || package.BrokerId.Equals(brokerId)) &&
                                  (fromDate == null ||
                                   package.Details
                                   .FirstOrDefault(d => d.Type == PackageDetailType.CoreCost)
                                   .StartDate >= fromDate) &&
                                  (toDate == null ||
                                   package.Details
                                   .FirstOrDefault(d => d.Type == PackageDetailType.CoreCost)
                                   .EndDate <= toDate)));
        }
コード例 #51
0
 internal RestoreDetailsInternal(string status, string statusDetails, KeyVaultServiceError error, string jobId, DateTimeOffset?startTime, DateTimeOffset?endTime)
 {
     Status        = status;
     StatusDetails = statusDetails;
     Error         = error;
     JobId         = jobId;
     StartTime     = startTime;
     EndTime       = endTime;
 }
コード例 #52
0
 public static IQueryable <Payrun> FilterPayRunList(this IQueryable <Payrun> payRuns, string searchTerm,
                                                    PayrunType?payrunType, PayrunStatus?payrunStatus, DateTimeOffset?dateFrom,
                                                    DateTimeOffset?dateTo) =>
 payRuns.Where(e => (
                   (searchTerm == null || e.Number.ToLower().Contains(searchTerm.ToLower())) &&
                   (payrunType == null || e.Type.Equals(payrunType)) &&
                   (payrunStatus == null || e.Status.Equals(payrunStatus)) &&
                   (dateFrom == null || e.DateCreated >= dateFrom) &&
                   (dateTo == null || e.DateCreated <= dateTo)
                   ));
コード例 #53
0
 internal SiteConfig(int?numberOfWorkers, IList <string> defaultDocuments, string netFrameworkVersion, string phpVersion, string pythonVersion, string nodeVersion, string powerShellVersion, string linuxFxVersion, string windowsFxVersion, bool?requestTracingEnabled, DateTimeOffset?requestTracingExpirationTime, bool?remoteDebuggingEnabled, string remoteDebuggingVersion, bool?httpLoggingEnabled, bool?acrUseManagedIdentityCreds, string acrUserManagedIdentityID, int?logsDirectorySizeLimit, bool?detailedErrorLoggingEnabled, string publishingUsername, IList <NameValuePair> appSettings, IList <ConnStringInfo> connectionStrings, SiteMachineKey machineKey, IList <HandlerMapping> handlerMappings, string documentRoot, ScmType?scmType, bool?use32BitWorkerProcess, bool?webSocketsEnabled, bool?alwaysOn, string javaVersion, string javaContainer, string javaContainerVersion, string appCommandLine, ManagedPipelineMode?managedPipelineMode, IList <VirtualApplication> virtualApplications, SiteLoadBalancing?loadBalancing, Experiments experiments, SiteLimits limits, bool?autoHealEnabled, AutoHealRules autoHealRules, string tracingOptions, string vnetName, bool?vnetRouteAllEnabled, int?vnetPrivatePortsCount, CorsSettings cors, PushSettings push, ApiDefinitionInfo apiDefinition, ApiManagementConfig apiManagementConfig, string autoSwapSlotName, bool?localMySqlEnabled, int?managedServiceIdentityId, int?xManagedServiceIdentityId, string keyVaultReferenceIdentity, IList <IpSecurityRestriction> ipSecurityRestrictions, IList <IpSecurityRestriction> scmIpSecurityRestrictions, bool?scmIpSecurityRestrictionsUseMain, bool?http20Enabled, FtpsState?ftpsState, int?preWarmedInstanceCount, int?functionAppScaleLimit, string healthCheckPath, bool?functionsRuntimeScaleMonitoringEnabled, string websiteTimeZone, int?minimumElasticInstanceCount, IDictionary <string, AzureStorageInfoValue> azureStorageAccounts, string publicNetworkAccess)
 {
     NumberOfWorkers              = numberOfWorkers;
     DefaultDocuments             = defaultDocuments;
     NetFrameworkVersion          = netFrameworkVersion;
     PhpVersion                   = phpVersion;
     PythonVersion                = pythonVersion;
     NodeVersion                  = nodeVersion;
     PowerShellVersion            = powerShellVersion;
     LinuxFxVersion               = linuxFxVersion;
     WindowsFxVersion             = windowsFxVersion;
     RequestTracingEnabled        = requestTracingEnabled;
     RequestTracingExpirationTime = requestTracingExpirationTime;
     RemoteDebuggingEnabled       = remoteDebuggingEnabled;
     RemoteDebuggingVersion       = remoteDebuggingVersion;
     HttpLoggingEnabled           = httpLoggingEnabled;
     AcrUseManagedIdentityCreds   = acrUseManagedIdentityCreds;
     AcrUserManagedIdentityID     = acrUserManagedIdentityID;
     LogsDirectorySizeLimit       = logsDirectorySizeLimit;
     DetailedErrorLoggingEnabled  = detailedErrorLoggingEnabled;
     PublishingUsername           = publishingUsername;
     AppSettings                  = appSettings;
     ConnectionStrings            = connectionStrings;
     MachineKey                   = machineKey;
     HandlerMappings              = handlerMappings;
     DocumentRoot                 = documentRoot;
     ScmType = scmType;
     Use32BitWorkerProcess = use32BitWorkerProcess;
     WebSocketsEnabled     = webSocketsEnabled;
     AlwaysOn             = alwaysOn;
     JavaVersion          = javaVersion;
     JavaContainer        = javaContainer;
     JavaContainerVersion = javaContainerVersion;
     AppCommandLine       = appCommandLine;
     ManagedPipelineMode  = managedPipelineMode;
     VirtualApplications  = virtualApplications;
     LoadBalancing        = loadBalancing;
     Experiments          = experiments;
     Limits                = limits;
     AutoHealEnabled       = autoHealEnabled;
     AutoHealRules         = autoHealRules;
     TracingOptions        = tracingOptions;
     VnetName              = vnetName;
     VnetRouteAllEnabled   = vnetRouteAllEnabled;
     VnetPrivatePortsCount = vnetPrivatePortsCount;
     Cors                                   = cors;
     Push                                   = push;
     ApiDefinition                          = apiDefinition;
     ApiManagementConfig                    = apiManagementConfig;
     AutoSwapSlotName                       = autoSwapSlotName;
     LocalMySqlEnabled                      = localMySqlEnabled;
     ManagedServiceIdentityId               = managedServiceIdentityId;
     XManagedServiceIdentityId              = xManagedServiceIdentityId;
     KeyVaultReferenceIdentity              = keyVaultReferenceIdentity;
     IpSecurityRestrictions                 = ipSecurityRestrictions;
     ScmIpSecurityRestrictions              = scmIpSecurityRestrictions;
     ScmIpSecurityRestrictionsUseMain       = scmIpSecurityRestrictionsUseMain;
     Http20Enabled                          = http20Enabled;
     FtpsState                              = ftpsState;
     PreWarmedInstanceCount                 = preWarmedInstanceCount;
     FunctionAppScaleLimit                  = functionAppScaleLimit;
     HealthCheckPath                        = healthCheckPath;
     FunctionsRuntimeScaleMonitoringEnabled = functionsRuntimeScaleMonitoringEnabled;
     WebsiteTimeZone                        = websiteTimeZone;
     MinimumElasticInstanceCount            = minimumElasticInstanceCount;
     AzureStorageAccounts                   = azureStorageAccounts;
     PublicNetworkAccess                    = publicNetworkAccess;
 }
コード例 #54
0
        public static IEnumerable <DateTime> GetNextFiringTimes(this ITrigger trigger, DateTimeOffset?after = null, DateTimeOffset?before = null)
        {
            var temp = trigger.Clone();

            after = after ?? DateTimeOffset.Now;
            var next = temp.GetFireTimeAfter(after);

            before = before ?? next.Value.AddYears(1);

            while (next.HasValue && next.Value < before)
            {
                var dt = next.Value.LocalDateTime;
                yield return(dt);

                next = temp.GetFireTimeAfter(next.Value);
            }
        }
コード例 #55
0
 internal IndexerExecutionResult(IndexerExecutionStatus status, string errorMessage, DateTimeOffset?startTime, DateTimeOffset?endTime, IReadOnlyList <SearchIndexerError> errors, IReadOnlyList <SearchIndexerWarning> warnings, int itemCount, int failedItemCount, string initialTrackingState, string finalTrackingState)
 {
     Status               = status;
     ErrorMessage         = errorMessage;
     StartTime            = startTime;
     EndTime              = endTime;
     Errors               = errors;
     Warnings             = warnings;
     ItemCount            = itemCount;
     FailedItemCount      = failedItemCount;
     InitialTrackingState = initialTrackingState;
     FinalTrackingState   = finalTrackingState;
 }
コード例 #56
0
 internal LogSearchRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string kind, string etag, string createdWithApiVersion, bool?isLegacyLogAnalyticsRule, string description, string displayName, bool?autoMitigate, Enabled?enabled, DateTimeOffset?lastUpdatedOn, ProvisioningState?provisioningState, MonitorSource source, MonitorSchedule schedule, MonitorAction action) : base(id, name, resourceType, systemData, tags, location, kind, etag)
 {
     CreatedWithApiVersion    = createdWithApiVersion;
     IsLegacyLogAnalyticsRule = isLegacyLogAnalyticsRule;
     Description       = description;
     DisplayName       = displayName;
     AutoMitigate      = autoMitigate;
     Enabled           = enabled;
     LastUpdatedOn     = lastUpdatedOn;
     ProvisioningState = provisioningState;
     Source            = source;
     Schedule          = schedule;
     Action            = action;
 }
コード例 #57
0
 internal FileGetPropertiesFromTaskOptions(int?timeout, Guid?clientRequestId, bool?returnClientRequestId, DateTimeOffset?ocpDate, DateTimeOffset?ifModifiedSince, DateTimeOffset?ifUnmodifiedSince)
 {
     Timeout               = timeout;
     ClientRequestId       = clientRequestId;
     ReturnClientRequestId = returnClientRequestId;
     OcpDate               = ocpDate;
     IfModifiedSince       = ifModifiedSince;
     IfUnmodifiedSince     = ifUnmodifiedSince;
 }
コード例 #58
0
        public async Task SendMessageAsync(AMQPMessage messageBody, DateTimeOffset?whenToRun = null)
        {
            // whenToRun is not supported with RabbitMQ!

            SenderLink senderLink;
            bool       error;

            do
            {
                senderLink = _senderLink;
                error      = false;

                if (CancellationToken.IsCancellationRequested)
                {
                    throw new Exception("AMQP cancellation is requested, can not send message");
                }

                try
                {
                    if (senderLink == null || senderLink.IsClosed)
                    {
                        await InitializeAsync().ConfigureAwait(false);
                    }

                    global::Amqp.Message message = new global::Amqp.Message(JsonConvert.SerializeObject(messageBody))
                    {
                        Header = new global::Amqp.Framing.Header()
                        {
                            Durable = true
                        }
                    };

                    await senderLink.SendAsync(message, TimeSpan.FromSeconds(10)).ConfigureAwait(false);
                }
                catch (AmqpException e)
                {
                    error = true;

                    await semaphore.WaitAsync().ConfigureAwait(false);

                    try
                    {
                        if (senderLink == _senderLink)
                        {
                            // nobody else handled this before

                            if (!CancellationToken.IsCancellationRequested)
                            {
                                Console.WriteLine($"AMQP exception in sender link for address {Address}: {e}");
                            }

                            await CloseAsync().ConfigureAwait(false);
                        }
                    }
                    catch (Exception e2)
                    {
                        throw e2;
                    }
                    finally
                    {
                        semaphore.Release();
                    }
                }
            } while (error);
        }
コード例 #59
0
 /// <inheritdoc />
 public GetInfluencersDescriptor End(DateTimeOffset?end) => Assign(a => a.End = end);
コード例 #60
0
ファイル: Tracer.cs プロジェクト: yusufozturk/dd-trace-dotnet
        /// <summary>
        /// This is a shortcut for <see cref="StartSpan(string, ISpanContext, string, DateTimeOffset?, bool)"/>
        /// and <see cref="ActivateSpan(Span, bool)"/>, it creates a new span with the given parameters and makes it active.
        /// </summary>
        /// <param name="operationName">The span's operation name</param>
        /// <param name="parent">The span's parent</param>
        /// <param name="serviceName">The span's service name</param>
        /// <param name="startTime">An explicit start time for that span</param>
        /// <param name="ignoreActiveScope">If set the span will not be a child of the currently active span</param>
        /// <param name="finishOnClose">If set to false, closing the returned scope will not close the enclosed span </param>
        /// <returns>A scope wrapping the newly created span</returns>
        public Scope StartActive(string operationName, ISpanContext parent = null, string serviceName = null, DateTimeOffset?startTime = null, bool ignoreActiveScope = false, bool finishOnClose = true)
        {
            var span = StartSpan(operationName, parent, serviceName, startTime, ignoreActiveScope);

            return(_scopeManager.Activate(span, finishOnClose));
        }