Exemple #1
0
        public IHttpActionResult PublishMany(IList <AnuntModel> anunturi)
        {
            foreach (var anunt in anunturi)
            {
                try
                {
                    var dto = new AnuntDto()
                    {
                        Content = anunt.Content,
                        Subject = anunt.Subject,
                        Role    = anunt.Role
                    };

                    var anuntId  = _anuntService.AddAnunt(dto);
                    var pushInfo = new PushInfo()
                    {
                        Id = anuntId, Subject = dto.Subject
                    };
                    _signalRHelper.NotifyAnunturiForRole(pushInfo, dto.Role);
                }
                catch (Exception)
                {
                    // log exception
                }
            }

            return(Ok());
        }
Exemple #2
0
 internal PushInfo Parse(ModelInfo model)
 {
     var rslt = new PushInfo(this);
     rslt.Source = this.Expression.Parse();
     rslt.Target = State.Parse(model);
     return rslt;
 }
Exemple #3
0
        public void setPushInfo(String actionLocKey, int badge, String message, String sound, String payload,
                                String locKey, String locArgs, String launchImage)
        {
            PushInfo.Builder builder = PushInfo.CreateBuilder().SetActionLocKey(actionLocKey).SetBadge(Convert.ToString(badge)).SetMessage(message);

            if (sound != null)
            {
                builder.SetSound(sound);
            }
            if (payload != null)
            {
                builder.SetPayload(payload);
            }
            if (locKey != null)
            {
                builder.SetLocKey(locKey);
            }
            if (locArgs != null)
            {
                builder.SetLocArgs(locArgs);
            }
            if (launchImage != null)
            {
                builder.SetLaunchImage(launchImage);
            }
            pushInfo = builder.Build();
        }
Exemple #4
0
 private void BeginRec(PushInfo pInfo)
 {
     pInfo            = new PushInfo();
     pInfo.计划炉号       = pHelper.PlanRoom;
     pInfo.实际炉号       = pHelper.ActualRoom;
     pInfo.实际推焦时间     = pHelper.ActualPushTime == Convert.ToDateTime("0001-1-1 00:00:00") ? DateTime.Now : pHelper.ActualPushTime;
     pInfo.预定出焦时间     = pHelper.PlanPushTime;
     pInfo.次装煤时间      = pHelper.LastStokingTime;//默认值
     pInfo.规定结焦时间     = pHelper.StandardBurnTime;
     pInfo.计划结焦时间     = pHelper.PlanBurnTime;
     pInfo.实际结焦时间     = pHelper.ActualBurnTime;
     pInfo.时段         = pHelper.Period;
     pInfo.班组         = pHelper.Group;
     pInfo.Push联锁信息   = pHelper.LockInfo;
     pInfo.联锁         = pHelper.Lock;
     pInfo.Push工作车序列  = pHelper.Cars;
     pInfo.Push对中序列   = pHelper.CarsReady;
     pInfo.TAddr      = pHelper.TAddr;
     pInfo.LAddr      = pHelper.LAddr;
     pInfo.XAddr      = pHelper.XAddr;
     pInfo.T炉号        = pHelper.TRoom;
     pInfo.L炉号        = pHelper.LRoom;
     pInfo.X炉号        = pHelper.XRoom;
     pInfo.Push车辆通讯状态 = pHelper.CommStatus;//20170601 通讯状态暂未处理
     pInfo.PlanIndex  = pHelper.PlanIndex;
     pInfo.PlanCount  = pHelper.PlanCount;
     pInfo.BeginTime  = pHelper.BeginTime;
     RecAddr(pInfo, pHelper);
     db.PushInfo.InsertOnSubmit(pInfo);
 }
Exemple #5
0
 private void EndRec(PushInfo pInfo)
 {
     pInfo.Max推焦电流 = pHelper.MaxCur;
     pInfo.Avg推焦电流 = pHelper.AvgCur;
     pInfo.推焦电流    = pHelper.CurArr;
     pInfo.推焦杆长    = pHelper.PoleArr;
     pInfo.EndTime = pHelper.EndTime;
 }
Exemple #6
0
 public CreateOrUpdateUserCommand(string userId, string name, string profileImageUrl, PushInfo pushInfo, string language)
 {
     UserId          = userId ?? throw new ArgumentNullException(nameof(userId));
     Name            = name ?? throw new ArgumentNullException(nameof(name));
     ProfileImageUrl = profileImageUrl;
     PushInfo        = pushInfo;
     Language        = language;
 }
Exemple #7
0
        internal PushInfo Parse(ModelInfo model)
        {
            var rslt = new PushInfo(this);

            rslt.Source = this.Expression.Parse();
            rslt.Target = State.Parse(model);
            return(rslt);
        }
Exemple #8
0
 private void RecAddr(PushInfo pInfo, PsInfo pHelper)
 {
     pInfo.T1Addr = pHelper.T1Addr;
     pInfo.T2Addr = pHelper.T2Addr;
     pInfo.L1Addr = pHelper.L1Addr;
     pInfo.L2Addr = pHelper.L2Addr;
     pInfo.X1Addr = pHelper.X1Addr;
     pInfo.X2Addr = pHelper.X2Addr;
     pInfo.M1Addr = pHelper.M1Addr;
     pInfo.M2Addr = pHelper.M2Addr;
 }
Exemple #9
0
 public PushInfo getPushInfo()
 {
     if (pushInfo == null)
     {
         pushInfo = PushInfo.CreateBuilder()
                    .SetActionKey("")
                    .SetBadge("")
                    .SetMessage("")
                    .SetSound("")
                    .Build();
     }
     return(pushInfo);
 }
        public PushInfo getPushInfo()
        {
            if (pushInfo == null)
            {
                pushInfo = PushInfo.CreateBuilder()
                        .SetActionKey("")
                        .SetBadge("")
                        .SetMessage("")
                        .SetSound("")
                        .Build();
            }

            return pushInfo;
        }
Exemple #11
0
        private void AssignmentInsertInfo()
        {
            PushInfo pInfo = null;

            if (insert)
            {
                BeginRec(pInfo);
            }
            else
            {
                pInfo = db.PushInfo.FirstOrDefault(p => p.BeginTime == pHelper.BeginTime && p.预定出焦时间 == pHelper.PlanPushTime);
                if (pInfo == null)
                {
                    BeginRec(pInfo);
                }
                EndRec(pInfo);
            }
        }
Exemple #12
0
        public void BellPush()
        {
            CrestronConsole.PrintLine("button push received");

            PushInfo pushinfo = new PushInfo
            {
                type  = "note",
                title = "Doorbell",
                body  = "reply unlock or ignore"
            };

            HttpsClient hsc = new HttpsClient();

            hsc.PeerVerification = false;
            hsc.HostVerification = false;
            HttpsClientRequest  hscr = new HttpsClientRequest();
            HttpsClientResponse hscrs;

            hsc.KeepAlive = true;
            hscr.Url.Parse("https://api.pushbullet.com/v2/pushes");
            //hscr.Header.AddHeader(new HttpsHeader("Access-Token", token));
            hscr.RequestType = Crestron.SimplSharp.Net.Https.RequestType.Post;
            hscr.Header.AddHeader(new HttpsHeader("Content-Type", "application/json"));
            hscr.Header.AddHeader(new HttpsHeader("Authorization", "Bearer " + token));
            hscr.ContentString = JsonConvert.SerializeObject(pushinfo);
            try
            {
                hscrs = hsc.Dispatch(hscr);
                if (hscrs.Code >= 200 && hscrs.Code < 300)
                {
                    // success
                    CrestronConsole.PrintLine("Dispatch worked.");
                    //checkPushes();
                }
                else
                {
                    CrestronConsole.PrintLine("Dispatch server error:" + hscrs.Code);
                }
            }
            catch (Exception e)
            {
                CrestronConsole.PrintLine("Connection error:" + e.ToString());
            }
        }
Exemple #13
0
        public ProcessResult Post([FromBody] PushInfo obj)
        {
            if (obj.Commits.All(q => q.Message.Length > 10))
            {
                return new ProcessResult()
                       {
                           Success = true,
                           Message = "Good job\nDude"
                       }
            }
            ;

            return(new ProcessResult
            {
                Success = false,
                Message = "Sorry but no"
            });
        }
    }
Exemple #14
0
        public IHttpActionResult Publish(AnuntModel model)
        {
            if (ModelState.IsValid)
            {
                var dto = new AnuntDto()
                {
                    Content = model.Content,
                    Subject = model.Subject,
                    Role    = model.Role
                };

                var anuntId  = _anuntService.AddAnunt(dto);
                var pushInfo = new PushInfo()
                {
                    Id = anuntId, Subject = dto.Subject
                };
                _signalRHelper.NotifyAnunturiForRole(pushInfo, dto.Role);

                return(Ok());
            }

            return(BadRequest());
        }
        public void setPushInfo(String actionLocKey, int badge, String message, String sound, String payload,
            String locKey, String locArgs, String launchImage)
        {
            PushInfo.Builder builder = PushInfo.CreateBuilder().SetActionLocKey(actionLocKey).SetBadge(Convert.ToString(badge)).SetMessage(message);

            if (sound != null)
            {
                builder.SetSound(sound);
            }
            if (payload != null)
            {
                builder.SetPayload(payload);
            }
            if (locKey != null)
            {
                builder.SetLocKey(locKey);
            }
            if (locArgs != null)
            {
                builder.SetLocArgs(locArgs);
            }
            if (launchImage != null)
            {
                builder.SetLaunchImage(launchImage);
            }
            pushInfo = builder.Build();
        }
Exemple #16
0
 private void ReceivePush(PushInfo pushInfo)
 {
     Pushes.Insert(0, pushInfo);
     AudioHelper.PlayNotification();
 }
Exemple #17
0
 public User(string id, string name, int?weight, Gender gender, string profileImageUrl, PushInfo pushInfo, List <UserInfo> friends, Venue.Venue currentVenue, string language, DateTime lastOnline, List <FriendRequest> friendRequests, List <Guid> invitations)
 {
     this.Id                     = id ?? throw new ArgumentNullException(nameof(id));
     this.Name                   = name ?? throw new ArgumentNullException(nameof(name));
     this.Weight                 = weight;
     this.Gender                 = gender;
     this.ProfileImageUrl        = profileImageUrl;
     this.PushInfo               = pushInfo;
     this._friends               = friends ?? new List <UserInfo>();
     this.CurrentVenue           = currentVenue;
     this.Language               = language ?? Constants.DefaultLanguage;
     this.LastOnline             = lastOnline;
     this._pendingFriendRequests = friendRequests ?? new List <FriendRequest>();
     this._invitations           = invitations ?? new List <Guid>();
 }
Exemple #18
0
        public void Deploy(string deployer)
        {
            var         tracer     = _traceFactory.GetTracer();
            IDisposable deployStep = null;

            try
            {
                deployStep = tracer.Step("Deploy");
                PushInfo pushInfo = _serverRepository.GetPushInfo();

                // Something went wrong here since we weren't able to
                if (pushInfo == null || !pushInfo.Branch.IsMaster)
                {
                    if (pushInfo == null)
                    {
                        tracer.TraceWarning("Push info was null. Post receive hook didn't execute correctly");
                    }
                    else
                    {
                        tracer.Trace("Non-master branch deployed {0}", pushInfo.Branch.Name);

                        _globalLogger.Log(Resources.Log_NonMasterBranchPushed, pushInfo.Branch.Name);
                    }

                    ReportCompleted();
                    deployStep.Dispose();
                    return;
                }

                // Get the pushed branch's id
                string id = pushInfo.Branch.Id;
                // If nothing changed then do nothing
                if (IsActive(id))
                {
                    tracer.Trace("Deployment '{0}' already active", id);

                    _globalLogger.Log(Resources.Log_DeploymentAlreadyActive, id);

                    ReportCompleted();
                    deployStep.Dispose();
                    return;
                }

                ILogger logger = CreateAndPopulateStatusFile(tracer, id, deployer);

                using (tracer.Step("Update to " + pushInfo.Branch.Name))
                {
                    logger.Log(Resources.Log_UpdatingBranch, pushInfo.Branch.Name);

                    using (var progressWriter = new ProgressWriter())
                    {
                        progressWriter.Start();
                        // Update to the default branch
                        _serverRepository.Update();
                    }
                }

                Build(id, tracer, deployStep);
            }
            catch (Exception ex)
            {
                _globalLogger.Log(ex);

                tracer.TraceError(ex);

                if (deployStep != null)
                {
                    deployStep.Dispose();
                }

                ReportCompleted();
            }
        }