示例#1
0
        public override async Task OnActionAsync(L2Player player)
        {
            await player.SendMessageAsync(AsString());

            //    TimeSpan ts = dtstart - DateTime.Now;
            //    player.sendMessage($"timems {(ts.TotalMilliseconds)}");
            bool newtarget = false;

            if (player.Target == null)
            {
                player.Target = this;
                newtarget     = true;
            }
            else
            {
                if (player.Target.ObjectId != ObjectId)
                {
                    player.Target = this;
                    newtarget     = true;
                }
            }

            if (newtarget)
            {
                await player.SendPacketAsync(new MyTargetSelected(ObjectId, player.Level - Template.Level));

                StatusUpdate su = new StatusUpdate(this);
                su.Add(StatusUpdate.CurHp, (int)CharStatus.CurrentHp);
                su.Add(StatusUpdate.MaxHp, (int)MaxHp);
                await player.SendPacketAsync(su);
            }
        }
        public JsonResult ChangeUserIdStatus()
        {
            string currentuser     = Session["CurrentUserID"].ToString();
            string currentusername = Session["DomainUserName"].ToString();

            string userid    = Request["UserId"];
            string newstatus = Request["NewStatus"];

            Params param = new Params()
            {
                Parameter = new Dictionary <string, string>()
            };

            param.RequestTransType = "ChangeIBILoginByUserId";
            param.Parameter.Add("userId", userid);
            param.Parameter.Add("newStatus", newstatus);
            param.Parameter.Add("agentId", currentusername);

            string start = DateTime.Now.ToString();

            ChangeStatusResult    result    = StatusUpdate.LoginIBI(param);
            ChangeStatusUpdatedBy updatedby = new ChangeStatusUpdatedBy
            {
                ID   = currentuser,
                Name = currentusername
            };

            result.UpdatedBy = updatedby;

            string stop = DateTime.Now.ToString();

            ChangeStatusLog.Write(param, result, start, stop);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public IActionResult UpdateTaskStatus([FromBody] StatusUpdate requestParam)
        {
            try
            {
                var task    = _taskRepository.Get(requestParam.taskId);
                var subTask = _subTaskRepository.GetAll(requestParam.taskId);
                if (subTask.Count() == 0 && task != null)
                {
                    task.State = requestParam.status;
                    _taskRepository.Save();
                    return(StatusCode(StatusCodes.Status202Accepted));
                }
                else
                {
                    if (task == null)
                    {
                        _logger.LogWarning($"There is no task with ID {requestParam.taskId}");
                    }
                    else
                    {
                        _logger.LogWarning($"There are no Subtasks Under The Task ID {requestParam.taskId}");
                    }

                    return(StatusCode(StatusCodes.Status304NotModified));
                }
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, ex));
            }
        }
示例#4
0
        internal void SaveStatusUpdate(String statusContent, int range)
        {
            if (!_userSession.LoggedIn)
            {
                // _view.Message("Chưa đăng nhập");
                return;
            }
            int accountID;
            int senderID;

            senderID  = _userSession.CurrentUser.AccountID;
            accountID = _webContext.AccountID;
            if (accountID <= 0)
            {
                accountID = senderID;
            }

            StatusUpdate status;

            status                   = new StatusUpdate();
            status.AccountID         = accountID;
            status.SenderID          = senderID;
            status.Status            = statusContent;
            status.VisibilityLevelID = range;

            IStatusUpdateService _statusUpdateService;

            _statusUpdateService = new StatusUpdateService();
            _statusUpdateService.SaveStatusUpdate(status);
            LogUtil.Logger.Writeln("SaveStatusUpdate: " + statusContent);
            _view.LoadStatus(GetStatusToShow(account));
        }
示例#5
0
        public LocalizationReader(string mapFolder, List <Province> provinceList, StatusUpdate su)
        {
            DirectoryInfo locFolder = new DirectoryInfo(Path.Combine(mapFolder, "..\\Localisation"));

            if (locFolder.Exists)
            {
                // first, check for the new YML localization (EUIV)
                FileInfo[] ymlFile = locFolder.GetFiles("prov_names_l_english.yml");
                if (ymlFile.Count() == 1)
                {
                    ReadYML(ymlFile[0], provinceList, su);
                    return;
                }

                // no relevant YML...read all the CSVs instead
                FileInfo[] locFiles   = locFolder.GetFiles("*.csv");
                int        fileIndex  = 0;
                double     fileFactor = 1.0 / locFiles.Count();
                foreach (FileInfo fi in locFiles)
                {
                    ReadCSV(fi, provinceList, su, fileFactor, fileIndex);
                    ++fileIndex;
                }
            }
            else
            {
                locFolder = new DirectoryInfo(Path.Combine(mapFolder, "..\\localization\\english"));
                FileInfo[] ymlFile = locFolder.GetFiles("provincenames_l_english.yml");
                if (ymlFile.Count() == 1)
                {
                    ReadYML(ymlFile[0], provinceList, su);
                    return;
                }
            }
        }
示例#6
0
        private void ReadCSV(FileInfo File, List <Province> provinceList, StatusUpdate su, double fileFactor, int fileIndex)
        {
            StreamReader sr = new StreamReader(File.FullName, Encoding.GetEncoding(1252));

            sr.ReadLine();             // discard first line
            while (!sr.EndOfStream)
            {
                string   locEntry  = sr.ReadLine();
                string[] locTokens = locEntry.Split(';');
                if (locTokens[0].StartsWith("PROV"))
                {
                    int provNum = 0;
                    if (int.TryParse(locTokens[0].Substring(4), out provNum))
                    {
                        foreach (Province p in provinceList)
                        {
                            if (p.ID == provNum)
                            {
                                p.name = locTokens[1];
                                break;
                            }
                        }
                    }
                }

                su(100.0 * fileFactor * (fileIndex + (double)sr.BaseStream.Position / sr.BaseStream.Length));
            }
            sr.Close();
        }
示例#7
0
        /// <summary>
        /// Originally this would update each related StatusUpdate, and the entries in ProjectPhase, but this was commented
        /// out since the ProjectPhase table is not currently in use. Instead, each StatusUpdate which came from the associated
        /// ProjectUpdate is modified with the new PhaseID
        /// </summary>
        /// <param name="update">An representative StatusUpdate, it is only used to get ProjectUpdateID</param>
        /// <param name="newPhase">An integer representing the new PhaseID</param>
        /// <returns>True or False to indicate success or failure</returns>
        public bool ChangeProjectUpdatePhase(StatusUpdate update, int newPhase)
        {
            if (update == null || newPhase < 0 || newPhase > Enum.GetNames(typeof(Phases)).Length)
            {
                return(false);
            }

            //int oldPhase = update.PhaseID.Value;
            //Guid projectID = update.ProjectID;
            //string updateKey = update.UpdateKey;
            Guid projectUpdateID = update.ProjectUpdateID;
            var  updates         = context.StatusUpdates.Where(u => u.ProjectUpdateID == projectUpdateID);

            foreach (StatusUpdate statusUpdate in updates)
            {
                statusUpdate.PhaseID = newPhase;

                ////__also update any related entries in ProjectPhase table
                //ProjectPhase pp = context.ProjectPhases.FirstOrDefault(p => p.ProjectID == projectID
                //                                                            && p.UpdateKey == updateKey);
                //if (pp != null) pp.PhaseID = newPhase;
            }
            context.SaveChanges();
            return(true);
        }
示例#8
0
        public IHttpActionResult AddItemToOrder(long userId, long productId)
        {
            var cart = db.Orders.FirstOrDefault(it => it.StatusUpdates.Count == 1 && it.UserID == userId);

            if (cart == null)
            {
                var user = db.Users.FirstOrDefault(it => it.UserID == userId);
                if (user == null)
                {
                    return(NotFound());
                }

                var status = new StatusUpdate
                {
                    Date   = DateTime.Now,
                    Status = Status.Cart
                };

                var newOrder = new Core.Model.Order {
                    User = user
                };
                newOrder.StatusUpdates.Add(status);
                db.Orders.Add(newOrder);
                db.SaveChanges();

                cart = db.Orders.FirstOrDefault(it => it.StatusUpdates.Count == 1 && it.UserID == userId);
            }

            if (cart.ConvertToDTO().Status != Status.Cart)
            {
                return(Ok("Order is already completed"));
            }

            var product = db.Products.FirstOrDefault(it => it.ProductId == productId);

            if (cart == null)
            {
                return(NotFound());
            }

            var orderItem = cart.OrderItems.FirstOrDefault(it => it.ProductId == productId);

            if (orderItem != null)
            {
                orderItem.Count++;
                db.SaveChanges();
                return(Ok(new { order = cart.ConvertToDTO() }));
            }

            var newOrderItem = new BB.Core.Model.OrderItem();

            newOrderItem.Order        = cart;
            newOrderItem.Product      = product;
            newOrderItem.Count        = 1;
            newOrderItem.PricePerItem = product.Price;
            db.OrderItems.Add(newOrderItem);
            db.SaveChanges();

            return(Ok(new { order = cart.ConvertToDTO() }));
        }
		void GetInfo(){
			SetContentView (Resource.Layout.EditText);
			Button btn = FindViewById<Button> (Resource.Id.SumbitShare);
			btn.Click += delegate
			{
				var sdCardPath = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
				var filePath = System.IO.Path.Combine(sdCardPath, "test.png");

				ThreadPool.QueueUserWorkItem(state =>
					{
						try
						{
							EditText context = FindViewById<EditText>(Resource.Id.TextShare);
							string textShare = context.Text;
							var  f =  new Java.IO.File(filePath);
							StatusUpdate updStatus = new StatusUpdate(textShare);
							updStatus.SetMedia(f);
							twitter.UpdateStatus(updStatus);

						}
						catch (Java.Lang.Exception ex)
						{
							Console.WriteLine(ex);
						}
					});
			};
		}
示例#10
0
        private async Task RunStatusMonitorAsync(CancellationToken token)
        {
            try
            {
                while (!token.IsCancellationRequested)
                {
                    string eth0, wlan0, hostName;
                    GetNetworkProperties(out eth0, out wlan0, out hostName);

                    BrainHatServerStatus status = new BrainHatServerStatus()
                    {
                        HostName     = hostName,
                        Eth0Address  = eth0,
                        Wlan0Address = wlan0,
                        TimeStamp    = DateTimeOffset.UtcNow,
                    };

                    StatusUpdate?.Invoke(this, new BrainHatStatusEventArgs(status));

                    await Task.Delay(2000);
                }
            }
            catch (OperationCanceledException)
            { }
            catch (Exception e)
            {
                Log?.Invoke(this, new LogEventArgs(this, "RunStatusMonitorAsync", e, LogLevel.ERROR));
            }
        }
示例#11
0
        //delete status update
        public void DeleteStatusUpdate(int id)
        {
            StatusUpdate statusUpdate = _db.StatusUpdates.Find(id);

            _db.StatusUpdates.Remove(statusUpdate);
            _db.SaveChanges();
        }
        private void ReadCSV(FileInfo File, List<Province> provinceList, StatusUpdate su, double fileFactor, int fileIndex)
        {
            StreamReader sr = new StreamReader(File.FullName, Encoding.GetEncoding(1252));
            sr.ReadLine(); // discard first line
            while (!sr.EndOfStream)
            {
                string locEntry = sr.ReadLine();
                string[] locTokens = locEntry.Split(';');
                if (locTokens[0].StartsWith("PROV"))
                {
                    int provNum = 0;
                    if (int.TryParse(locTokens[0].Substring(4), out provNum))
                    {
                        foreach (Province p in provinceList)
                        {
                            if (p.ID == provNum)
                            {
                                p.name = locTokens[1];
                                break;
                            }
                        }
                    }
                }

                su(100.0 * fileFactor * (fileIndex + (double)sr.BaseStream.Position / sr.BaseStream.Length));
            }
            sr.Close();
        }
示例#13
0
        /// <summary>
        /// Start a task.
        /// </summary>
        public void Start()
        {
            if (IsRunning || IsFinished)
            {
                return;
            }
            IsRunning = true;

            CurrentSegment = -1;
            if (startThread != null)
            {
                startThread.Abort();
            }
            startThread = new Thread(delegate()
            {
                while (!Analysis())
                {
                    for (int i = 5; i > 0; i--)
                    {
                        StatusUpdate?.Invoke(this, 0, i, Status.AnalysisFailed);
                        Thread.Sleep(1000);
                    }
                }
                CurrentSegment = 0;
                Segments[CurrentSegment].Start();
                StartProgressMonitor();
                startThread = null;
            });
            startThread.Start();
        }
示例#14
0
        private void ReadYML(FileInfo File, List <Province> provinceList, StatusUpdate su)
        {
            StreamReader sr = new StreamReader(File.FullName, Encoding.UTF8);

            sr.ReadLine(); // discard first line
            while (!sr.EndOfStream)
            {
                string   locEntry  = sr.ReadLine();
                string[] locTokens = locEntry.Split(':');
                if (locTokens[0].StartsWith(" PROV"))
                {
                    int provNum = 0;
                    if (int.TryParse(locTokens[0].Substring(5), out provNum))
                    {
                        foreach (Province p in provinceList)
                        {
                            if (p.ID == provNum)
                            {
                                p.name = locTokens[1].Trim().Trim('\"');
                                break;
                            }
                        }
                    }
                }

                su(100.0 * ((double)sr.BaseStream.Position / sr.BaseStream.Length));
            }
            sr.Close();
        }
示例#15
0
 //create a status update
 public void CreateStatusUpdate(StatusUpdate statusUpdate)
 {
     _db.StatusUpdates.Add(statusUpdate);
     statusUpdate.createDate = DateTime.Now;
     alertService.AddStatusUpdateAlert(statusUpdate);
     _db.SaveChanges();
 }
示例#16
0
        public async Task TestUpdateStatus()
        {
            var toAdd = SampleTransactions()[0];

            DbContext.Transaction.Add(toAdd);
            DbContext.SaveChanges();

            var controller = new TransactionsController(DbContext);

            //change the transaction status from Completed to Pending
            var statusUpdate = new StatusUpdate()
            {
                Status = "Pending"
            };

            var result = (await controller.ModifyStatus(1, statusUpdate)) as StatusCodeResult;

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(StatusCodeResult));
            Assert.AreEqual(204, result.StatusCode);

            var transaction = await DbContext.Transaction.FindAsync((long)1);

            Assert.AreEqual(transaction.Id, toAdd.Id, "Ids did not match");
            Assert.AreEqual(transaction.Datetime, toAdd.Datetime, "Datetimes did not match");
            Assert.AreEqual(transaction.Descripton, toAdd.Descripton, "Desciptions did not match");
            Assert.AreEqual(transaction.Amount, toAdd.Amount, "Amounts did not match");
            Assert.AreEqual(transaction.Status, statusUpdate.Status, "Status was not updated");

            ClearDb();
        }
示例#17
0
        private void Segment_Finished()
        {
            if (CurrentSegment < Segments.Count - 1)
            {
                CurrentSegment++;
                Segments[CurrentSegment].Start();
            }
            else
            {
                AbortProgressMonitor();
                ProgressPercentage = 100;
                StatusUpdate?.Invoke(this, ProgressPercentage, 0, Status.Merging);
                string directory = Path.Combine(ConfigManager.GetSettings().DownloadPath, FilenameValidation(string.Format("[{0}]{1}", Description, Title)));
                Directory.CreateDirectory(directory);
                string filename = FilenameValidation($"{Index}-{Part}");
                string filepath = Path.Combine(directory, $"{filename}.{Segments[0].Extention}");

                // valid path length
                if (filepath.Length > MAX_PATH - 1)     // Reserve 1 char for <NULL>
                {
                    int truncateCount = filepath.Length - (MAX_PATH - 1);
                    if (truncateCount > filename.Length - 1)     // Least 1 char for filename
                    {
                        // Should never occur
                        throw new Exception($"无法创建合法文件名,截断失败: {filename} (截断计数: {truncateCount})");
                    }
                    filename = filename.Substring(0, filename.Length - truncateCount);
                    filepath = directory + $"{filename}.{Segments[0].Extention}";
                }

                int      count = Segments.Count;
                string[] paths = new string[count];
                for (int i = 0; i < count; i++)
                {
                    paths[i] = Segments[i].Filepath;
                }

                if (MergeRequired)
                {
                    FlvUtil.FlvMerge(paths, filepath);
                }
                else
                {
                    File.Copy(Segments[0].Filepath, filepath, true);
                }


                foreach (string path in paths)
                {
                    File.Delete(path);
                }
                IsFinished = true;
                IsRunning  = false;
                StatusUpdate?.Invoke(this, 100, 0, Status.Finished);

                DownloadFinishedNotification.SendNotification(this, filepath);

                Finished?.Invoke(this, filepath);
            }
        }
示例#18
0
        public override void OnAction(L2Player player)
        {
            player.SendMessage(AsString());
            //    TimeSpan ts = dtstart - DateTime.Now;
            //    player.sendMessage($"timems {(ts.TotalMilliseconds)}");
            bool newtarget = false;

            if (player.CurrentTarget == null)
            {
                player.CurrentTarget = this;
                newtarget            = true;
            }
            else
            {
                if (player.CurrentTarget.ObjId != ObjId)
                {
                    player.CurrentTarget = this;
                    newtarget            = true;
                }
            }

            if (newtarget)
            {
                player.SendPacket(new MyTargetSelected(ObjId, player.Level - Template.Level));

                StatusUpdate su = new StatusUpdate(ObjId);
                su.Add(StatusUpdate.CurHp, (int)CurHp);
                su.Add(StatusUpdate.MaxHp, (int)CharacterStat.GetStat(EffectType.BMaxHp));
                player.SendPacket(su);
            }
            else
            {
                player.AiCharacter.Attack(this);
            }
        }
示例#19
0
        internal async Task SendIdentifyAsync(StatusUpdate status)
        {
            var identify = new GatewayIdentify
            {
                Token          = Utilities.GetFormattedToken(this),
                Compress       = this.Configuration.GatewayCompressionLevel == GatewayCompressionLevel.Payload,
                LargeThreshold = this.Configuration.LargeThreshold,
                ShardInfo      = new ShardInfo
                {
                    ShardId    = this.Configuration.ShardId,
                    ShardCount = this.Configuration.ShardCount
                },
                Presence = status,
                Intents  = this.Configuration.Intents
            };
            var payload = new GatewayPayload
            {
                OpCode = GatewayOpCode.Identify,
                Data   = identify
            };
            var payloadstr = JsonConvert.SerializeObject(payload);

            await this.WsSendAsync(payloadstr).ConfigureAwait(false);

            if (this.Configuration.Intents.HasValue)
            {
                this.Logger.LogDebug(LoggerEvents.Intents, "Registered gateway intents ({0})", this.Configuration.Intents.Value);
            }
        }
示例#20
0
        public ActionResult WriteStatusUpdate(CreateViewModel model)
        {
            //fetches account of logged in user and assigns the status update to their accountID
            Account account = GetAccount();

            if (ModelState.IsValid)
            {
                StatusUpdate statusUpdate = new StatusUpdate
                {
                    accountID  = account.accountID,
                    status     = model.status,
                    createDate = DateTime.Now,
                };
                statusUpdateDAO.CreateStatusUpdate(statusUpdate);
            }

            //redirects user to appropriate page after the status update has been submitted
            var adminUser = accountPermissionDAO.FetchByEmail(account.email);

            if (adminUser == null)
            {
                return(RedirectToAction("ProfileHomepage", "Profile"));
            }

            else if (adminUser != null)
            {
                return(RedirectToAction("MyActivity", "Admin"));
            }

            return(View());
        }
示例#21
0
        void GetInfo()
        {
            SetContentView(Resource.Layout.EditText);
            Button btn = FindViewById <Button> (Resource.Id.SumbitShare);

            btn.Click += delegate
            {
                var sdCardPath = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
                var filePath   = System.IO.Path.Combine(sdCardPath, "test.png");

                ThreadPool.QueueUserWorkItem(state =>
                {
                    try
                    {
                        EditText context       = FindViewById <EditText>(Resource.Id.TextShare);
                        string textShare       = context.Text;
                        var f                  = new Java.IO.File(filePath);
                        StatusUpdate updStatus = new StatusUpdate(textShare);
                        updStatus.SetMedia(f);
                        twitter.UpdateStatus(updStatus);
                    }
                    catch (Java.Lang.Exception ex)
                    {
                        Console.WriteLine(ex);
                    }
                });
            };
        }
        public DefinitionReader(string path, StatusUpdate su)
        {
            StreamReader sr = new StreamReader(path, Encoding.GetEncoding(1252));

            sr.ReadLine(); // discard first line
            while (!sr.EndOfStream)
            {
                string   province       = sr.ReadLine();
                string[] provinceTokens = province.Split(';');
                if ((provinceTokens[4] == "RNW") || ((provinceTokens[4].Length > 5) && (provinceTokens[4].Substring(0, 6) == "Unused")))
                {
                    continue;
                }
                try
                {
                    Province p = new Province(provinceTokens);
                    provinces.Add(p);
                }
                catch
                {
                }
                su(100.0 * sr.BaseStream.Position / sr.BaseStream.Length);
            }
            sr.Close();
        }
        private void ReadYML(FileInfo File, List<Province> provinceList, StatusUpdate su)
        {
            StreamReader sr = new StreamReader(File.FullName, Encoding.UTF8);
            sr.ReadLine(); // discard first line
            while (!sr.EndOfStream)
            {
                string locEntry = sr.ReadLine();
                string[] locTokens = locEntry.Split(':');
                if (locTokens[0].StartsWith(" PROV"))
                {
                    int provNum = 0;
                    if (int.TryParse(locTokens[0].Substring(5), out provNum))
                    {
                        foreach (Province p in provinceList)
                        {
                            if (p.ID == provNum)
                            {
                                p.name = locTokens[1].Trim().Trim('\"');
                                break;
                            }
                        }
                    }
                }

                su(100.0 * ((double)sr.BaseStream.Position / sr.BaseStream.Length));
            }
            sr.Close();
        }
示例#24
0
        /// <summary>
        /// Handles update messages.
        /// </summary>
        /// <param name="message"></param>
        public override void Handle(IStatusUpdate <MultiLineTextList, IViewModelBase> message)
        {
            //IF WE DON'T HAVE A CURRENT OFFER, THEN WE DON'T NEED TO LISTEN TO THIS MESSAGE.
            if (_CurrentOffer == null)
            {
                return;
            }

            //WE DON'T CARE ABOUT MESSAGES WE PUBLISH OURSELVES
            if (message.PublisherId == Id)
            {
                return;
            }

            //WE ONLY CARE ABOUT STUDY MESSAGES
            if (message.Category != StudyResources.CategoryStudy)
            {
                return;
            }

            //NOT SURE IF THIS IS RIGHT
            if (_CurrentOffer.Opportunity.JobInfo.Id != message.JobInfo.Id)
            {
                return;
            }

            //THIS IS ONE OF THIS OBJECT'S UPDATES, SO BUBBLE IT BACK UP WITH THIS OFFER, OPPORTUNITY, ETC.

            //CREATE THE BUBBLING UP UPDATE
            var opportunity  = _CurrentOffer.Opportunity;
            var offer        = _CurrentOffer;
            var jobInfo      = opportunity.JobInfo;
            var statusUpdate =
                new StatusUpdate <MultiLineTextList, IViewModelBase>(message.Status,
                                                                     opportunity,
                                                                     offer,
                                                                     null,
                                                                     jobInfo,
                                                                     Id,
                                                                     this,
                                                                     StudyResources.CategoryStudy,
                                                                     null);


            //BEFORE PUBLISHING UPDATE, CHECK FOR PRODUCT
            //IF THIS IS A COMPLETED STATUS UPDATE, THEN PRODUCT SHOULD BE SET.  SO, BUBBLE THIS ASPECT UP.
            if (message.Status == CommonResources.StatusCompleted)
            {
                if (message.JobInfo.Product != null && _CurrentOffer.Opportunity.JobInfo.Product != null)
                {
                    jobInfo.Product = message.JobInfo.Product;
                }

                //WE'RE DONE WITH THE CURRENT OFFER
                _CurrentOffer = null;
            }

            //PUBLISH TO BUBBLE UP
            Exchange.Ton.Publish(statusUpdate);
        }
示例#25
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        oXbmc = new XBMC_Communicator();
        oXbmc.SetIp("10.0.0.5");
        oXbmc.SetConnectionTimeout(4000);
        oXbmc.SetCredentials("", "");
        oXbmc.Status.StartHeartBeat();

        Build();

        this.AllowStaticAccess();

        //Create objects used
        oPlaylist     = new Playlist(this);
        oControls     = new Controls(this);
        oMenuItems    = new MenuItems(this);
        oContextMenu  = new ContextMenu(this);
        oShareBrowser = new ShareBrowser(this);
        oTrayicon     = new SysTrayIcon(this);
        oStatusUpdate = new StatusUpdate(this);
        oMediaInfo    = new MediaInfo(this);
        oNowPlaying   = new NowPlaying(this);
        oGuiConfig    = new GuiConfig(this);

        nbDataContainer.CurrentPage = 0;
    }
示例#26
0
        private void BlockCorporateCardOnCAF(string cardNo)
        {
            string     currentuser     = Session["CurrentUserID"].ToString();
            string     currentusername = Session["DomainUserName"].ToString();
            Guid       userguid        = new Guid(currentuser);
            SystemUser user            = db.systemUser.Single(p => p.SystemUserId == userguid);
            string     usernum         = String.IsNullOrEmpty(user.TandemUserNum) ? String.Empty : user.TandemUserNum;
            string     usergroup       = String.IsNullOrEmpty(user.TandemUserGroup) ? String.Empty : user.TandemUserGroup;

            Params param = new Params()
            {
                Parameter = new Dictionary <string, string>()
            };

            param.RequestTransType = "ChangeATMStatusByAtmNo";
            param.Parameter.Add("atmNo", cardNo);
            param.Parameter.Add("newStatus", "2");
            param.Parameter.Add("sUserNum", usernum);
            param.Parameter.Add("sUserGroup", usergroup);

            string start = DateTime.Now.ToString();

            ChangeStatusResult    result    = StatusUpdate.Card(param);
            ChangeStatusUpdatedBy updatedby = new ChangeStatusUpdatedBy
            {
                ID   = currentuser,
                Name = currentusername
            };

            result.UpdatedBy = updatedby;

            string stop = DateTime.Now.ToString();

            ChangeStatusLog.Write(param, result, start, stop);
        }
示例#27
0
        internal void SetStatusText(Verbosity verbosity, string text)
        {
            StatusUpdate del = delegate
            {
                this.toolStripStatusLabel1.Text = text;
                switch (verbosity)
                {
                case Verbosity.Critical:
                    this.toolStripStatusLabel1.ForeColor = Color.Red;
                    break;

                default:
                case Verbosity.Normal:
                    this.toolStripStatusLabel1.ForeColor = SystemColors.ControlText;
                    break;

                case Verbosity.Verbose:
                    this.toolStripStatusLabel1.ForeColor = Color.Green;
                    break;

                case Verbosity.Everything:
                    this.toolStripStatusLabel1.ForeColor = Color.Blue;
                    break;
                }
            };

            if (this.InvokeRequired == true)
            {
                this.Invoke(del, verbosity, text);
            }
            else
            {
                del(verbosity, text);
            }
        }
示例#28
0
        /// <summary>
        /// This method is used to load a PixelDatabase and its DirectBitmap object.
        /// </summary>
        /// <param name="bitmap"></param>
        /// <returns></returns>
        public static PixelDatabase LoadPixelDatabase(Image original, StatusUpdate updateCallback)
        {
            // initial valule
            PixelDatabase pixelDatabase = null;

            try
            {
                // convert to a bitmap
                Bitmap bitmap = (Bitmap)original;

                // Load the PixelDatabase
                pixelDatabase = LoadPixelDatabase(bitmap, updateCallback);
            }
            catch (Exception error)
            {
                // write to console for now
                DebugHelper.WriteDebugError("LoadPixelDatabase", "PixelDatabaseLoader", error);
            }
            finally
            {
            }

            // return value
            return(pixelDatabase);
        }
示例#29
0
        /// <summary>
        /// This method is used to load a PixelDatabase and its DirectBitmap object from an imagePath
        /// </summary>
        /// <param name="imagePath">The path to the image</param>
        /// <param name="updateCallback">The delegate to call during load for status.</param>
        /// <param name="copyInPlaceForResetImage">If true, a copy of the image will be created, and the ResetPath and UndoPath will be set to this new filename.</param>
        /// <returns></returns>
        public static PixelDatabase LoadPixelDatabase(string imagePath, StatusUpdate updateCallback)
        {
            // initial valule
            PixelDatabase pixelDatabase = null;

            try
            {
                // if we have an imagePath
                if ((TextHelper.Exists(imagePath)) && (File.Exists(imagePath)))
                {
                    // create the Bitmap
                    using (Bitmap bitmap = (Bitmap)Bitmap.FromFile(imagePath))
                    {
                        // load the pixelDatabase
                        pixelDatabase = LoadPixelDatabase(bitmap, updateCallback);
                    }
                }
            }
            catch (Exception error)
            {
                // write to console for now
                DebugHelper.WriteDebugError("LoadPixelDatabase", "PixelDatabaseLoader", error);
            }
            finally
            {
            }

            // return value
            return(pixelDatabase);
        }
示例#30
0
        private static void DevicePoll_Received(List <C4UFX.CANMessage> responses)
        {
            StatusUpdate?.Invoke("Querying names (1/3)...");


            foreach (C4UFX.CANMessage response in responses)
            {
                FndTnd address = CANInterface.IdToFndTnd(response.ID);
                if (address.FromDevice > 0)
                {
                    Node   currentNode = allResponses.First(x => x.NodeId == address.FromNode);
                    byte   fromNode    = CANInterface.IdToFndTnd(response.ID).FromNode;
                    byte   fromDevice  = CANInterface.IdToFndTnd(response.ID).FromDevice;
                    Device newDevice;
                    switch ((Signatures)response.Data[2])
                    {
                    case Signatures.MechanicalSwitch: newDevice = new MechanicalSwitch(fromNode, fromDevice); break;

                    case Signatures.StatusLED: newDevice = new StatusLED(fromNode, fromDevice); break;

                    case Signatures.InfraredInput: newDevice = new InfraredInput(fromNode, fromDevice); break;

                    case Signatures.DimmerOut: newDevice = new DimmerOut(fromNode, fromDevice); break;

                    case Signatures.LatLong: newDevice = new LatLong(fromNode, fromDevice); break;

                    case Signatures.TimerEvent: newDevice = new TimerEvent(fromNode, fromDevice); break;

                    case Signatures.Scene: newDevice = new Scene(fromNode, fromDevice); break;

                    case Signatures.RealTimeClock: newDevice = new RealTimeClock(fromNode, fromDevice); break;

                    default: newDevice = new UnknownDevice(fromNode, fromDevice); break;
                    }

                    currentNode.Devices.Add(newDevice);
                }
            }

            Dictionary <byte, List <byte> > sendList = new Dictionary <byte, List <byte> >();

            foreach (Node node in allResponses)
            {
                if (sendList.Keys.Contains(node.NodeId))
                {
                    break;
                }
                sendList.Add(node.NodeId, new List <byte>());
                for (byte i = 1; i < 127; i++)
                {
                    sendList[node.NodeId].Add(i);
                }
            }

            CANPing poll = new CANPing(Commands.CmdSysEName1, sendList);

            poll.ResponseReceived += Name1Poll_Received;
            PongsReceived?.Invoke(allResponses, false);
        }
示例#31
0
        private bool Analysis()
        {
            StatusUpdate?.Invoke(ProgressPercentage, 0, Status.Analyzing);
            Segments = new List <Segment>();
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("avid", Aid.ToString());
            dic.Add("cid", Cid.ToString());
            dic.Add("qn", Qn.ToString());
            try
            {
                IJson json = BiliApi.GetJsonResult("https://api.bilibili.com/x/player/playurl", dic, false);
                if (json.GetValue("code").ToLong() == 0)
                {
                    if (json.GetValue("data").GetValue("quality").ToLong() == Qn)
                    {
                        foreach (IJson v in json.GetValue("data").GetValue("durl"))
                        {
                            Segment segment = new Segment(Aid, Regex.Unescape(v.GetValue("url").ToString()), SegmentType.Mixed, v.GetValue("size").ToLong(), Threads);
                            segment.Finished += Segment_Finished;
                            Segments.Add(segment);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    json = BiliApi.GetJsonResult("http://api.bilibili.com/pgc/player/web/playurl", dic, false);
                    if (json.GetValue("code").ToLong() == 0)
                    {
                        if (json.GetValue("result").GetValue("quality").ToLong() == Qn)
                        {
                            foreach (IJson v in json.GetValue("result").GetValue("durl"))
                            {
                                Segment segment = new Segment(Aid, Regex.Unescape(v.GetValue("url").ToString()), SegmentType.Mixed, v.GetValue("size").ToLong(), Threads);
                                segment.Finished += Segment_Finished;
                                Segments.Add(segment);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                return(true);
            }
            catch (WebException)
            {
                return(false);
            }
        }
示例#32
0
 public void SaveStatusUpdate(StatusUpdate statusUpdate)
 {
     _statusRepository.SaveStatusUpdate(statusUpdate);
     if (statusUpdate.SenderID != statusUpdate.AccountID)
     {
         _alertService.AddStatusUpdateAlert(statusUpdate);
     }
 }
示例#33
0
        void IJobProcessor.setup(Job job, StatusUpdate su, LogItem log)
        {
            CleanupJob j = (CleanupJob)job;

            this.log   = log;
            this.su    = su;
            this.files = j.files;
        }
示例#34
0
 public StatusUpdate Clone()
 {
     StatusUpdate newStatusUpdate = new StatusUpdate();
     newStatusUpdate.ProjectID = ProjectID;
     newStatusUpdate.PhaseID = PhaseID;
     newStatusUpdate.VerticalID = VerticalID;
     newStatusUpdate.ProjectUpdateID = ProjectUpdateID;
     return newStatusUpdate;
 }
        public MappingReader(string _path, string _srcTag, string _destTag, List<Province> srcProvs, List<Province> destProvs, StatusUpdate su)
        {
            srcTag = _srcTag;
            destTag = _destTag;
            path = _path;

            StreamReader sr = new StreamReader(path, Encoding.GetEncoding(1252));
            while (!sr.EndOfStream)
            {
                string line = sr.ReadLine().Trim();
                if (line.Length > 0)
                {
                    if (line.StartsWith("link"))
                    {
                        try
                        {
                            mappings.Add(new ProvinceMapping(line, srcTag, destTag, srcProvs, destProvs));
                        }
                        catch (Exception e)
                        {
                            System.Windows.Forms.MessageBox.Show(e.Message, "Error in mapping file");
                        }
                    }
                    else if (line.StartsWith("#"))
                    {
                        try
                        {
                            mappings.Add(new CommentMapping(line));
                        }
                        catch (Exception e)
                        {
                            System.Windows.Forms.MessageBox.Show(e.Message, "Error in mapping file");
                        }
                    }
                    else if (line.StartsWith("mappings") || line.StartsWith("{") || line.StartsWith("}"))
                    {
                        // ignore these lines
                    }
                    else
                    {
                        System.Windows.Forms.MessageBox.Show(String.Format("Error parsing province mapping file: line beginning '{0}' appears to be invalid.", line.Split(' ')[0]));
                    }
                }
                su(100.0 * sr.BaseStream.Position / sr.BaseStream.Length);
            }
            sr.Close();
        }
示例#36
0
        public ActionResult Detail(int photoItemID)
        {
            _pitm = new PhotoItem(photoItemID);

            if (_pitm.PhotoItemID == 0)
                return HttpNotFound();

            var sus = new StatusUpdates();

            var su = new StatusUpdate();

            su.GetStatusUpdateByPhotoID(photoItemID);

            su.PhotoDisplay = true;
            sus.Add(su);

            if (string.IsNullOrWhiteSpace(_pitm.Title))
            {
                _pitm.Title = String.Format("{0:u}", _pitm.CreateDate);
            }

            sus.IncludeStartAndEndTags = false;
            ViewBag.StatusUpdateList = string.Format(@"<ul id=""status_update_list_items"">{0}</ul>", sus.ToUnorderdList);

            var pitm2 = new PhotoItem();

            pitm2.GetPreviousPhoto(_pitm.CreateDate);
            if (pitm2.PhotoItemID > 0)
            {
                pitm2.ShowTitle = false;
                pitm2.UseThumb = true;
                ViewBag.PreviousPhoto = pitm2;
            }

            pitm2 = new PhotoItem();
            pitm2.GetNextPhoto(_pitm.CreateDate);

            if (pitm2.PhotoItemID > 0)
            {
                pitm2.ShowTitle = false;
                pitm2.UseThumb = true;
                ViewBag.NextPhoto = pitm2;
            }

            return View(_pitm);
        }
 public DefinitionReader(string path, StatusUpdate su)
 {
     StreamReader sr = new StreamReader(path, Encoding.GetEncoding(1252));
     sr.ReadLine(); // discard first line
     while (!sr.EndOfStream)
     {
         string province = sr.ReadLine();
         string[] provinceTokens = province.Split(';');
         try
         {
             Province p = new Province(provinceTokens);
             provinces.Add(p);
         }
         catch
         {
         }
         su(100.0 * sr.BaseStream.Position / sr.BaseStream.Length);
     }
     sr.Close();
 }
        public LocalizationReader(string mapFolder, List<Province> provinceList, StatusUpdate su)
        {
            DirectoryInfo locFolder = new DirectoryInfo(Path.Combine(mapFolder, "..\\Localisation"));

            // first, check for the new YML localization (EUIV)
            FileInfo[] ymlFile = locFolder.GetFiles("prov_names_l_english.yml");
            if (ymlFile.Count() == 1)
            {
                ReadYML(ymlFile[0], provinceList, su);
                return;
            }

            // no relevant YML...read all the CSVs instead
            FileInfo[] locFiles = locFolder.GetFiles("*.csv");
            int fileIndex = 0;
            double fileFactor = 1.0 / locFiles.Count();
            foreach (FileInfo fi in locFiles)
            {
                ReadCSV(fi, provinceList, su, fileFactor, fileIndex);
                ++fileIndex;
            }
        }
        public LocalizationReader(string mapFolder, List<Province> provinceList, StatusUpdate su)
        {
            DirectoryInfo locFolder = new DirectoryInfo(Path.Combine(mapFolder, "..\\Localisation"));
            FileInfo[] locFiles = locFolder.GetFiles("*.csv");
            int fileIndex = 0;
            double fileFactor = 1.0 / locFiles.Count();
            foreach (FileInfo fi in locFiles)
            {
                StreamReader sr = new StreamReader(fi.FullName, Encoding.GetEncoding(1252));
                sr.ReadLine(); // discard first line
                while (!sr.EndOfStream)
                {
                    string locEntry = sr.ReadLine();
                    string[] locTokens = locEntry.Split(';');
                    if (locTokens[0].StartsWith("PROV"))
                    {
                        int provNum = 0;
                        if (int.TryParse(locTokens[0].Substring(4), out provNum))
                        {
                            foreach (Province p in provinceList)
                            {
                                if (p.ID == provNum)
                                {
                                    p.name = locTokens[1];
                                    break;
                                }
                            }
                        }
                    }

                    su(100.0 * fileFactor * (fileIndex + (double)sr.BaseStream.Position / sr.BaseStream.Length));
                }
                sr.Close();
                ++fileIndex;
            }
        }
 public DefinitionReader(string path, StatusUpdate su)
 {
     StreamReader sr = new StreamReader(path, Encoding.GetEncoding(1252));
     sr.ReadLine(); // discard first line
     while (!sr.EndOfStream)
     {
         string province = sr.ReadLine();
         string[] provinceTokens = province.Split(';');
         if ( (provinceTokens[4] == "RNW") || ((provinceTokens[4].Length > 5) && (provinceTokens[4].Substring(0, 6) == "Unused")) )
         {
             continue;
         }
         try
         {
             Province p = new Province(provinceTokens);
             provinces.Add(p);
         }
         catch
         {
         }
         su(100.0 * sr.BaseStream.Position / sr.BaseStream.Length);
     }
     sr.Close();
 }
示例#41
0
        public ActionResult ProfileDetail(string userName)
        {
            ViewBag.VideoHeight = (Request.Browser.IsMobileDevice) ? 100 : 277;
            ViewBag.VideoWidth = (Request.Browser.IsMobileDevice) ? 225 : 400;

            _ua = new UserAccount(userName);

            var uad = new UserAccountDetail();
            uad.GetUserAccountDeailForUser(_ua.UserAccountID);

            uad.BandsSeen = ContentLinker.InsertBandLinks(uad.BandsSeen, false);
            uad.BandsToSee = ContentLinker.InsertBandLinks(uad.BandsToSee, false);

            var model = new ProfileModel();

            model.ProfilePhotoMainRaw = uad.RawProfilePicUrl;

            if (_ua.UserAccountID > 0)
            {
                model.UserAccountID = _ua.UserAccountID;
                model.PhotoCount = PhotoItems.GetPhotoItemCountForUser(_ua.UserAccountID);
                model.CreateDate = _ua.CreateDate;
            }

            if (_mu != null)
            {
                ViewBag.IsBlocked = BlockedUser.IsBlockedUser(_ua.UserAccountID, Convert.ToInt32(_mu.ProviderUserKey));
                ViewBag.IsBlocking = BlockedUser.IsBlockedUser(Convert.ToInt32(_mu.ProviderUserKey), _ua.UserAccountID);

                if (_ua.UserAccountID == Convert.ToInt32(_mu.ProviderUserKey))
                {
                    model.IsViewingSelf = true;
                }
                else
                {
                    var ucon = new UserConnection();

                    ucon.GetUserToUserConnection(Convert.ToInt32(_mu.ProviderUserKey), _ua.UserAccountID);

                    model.UserConnectionID = ucon.UserConnectionID;

                    if (BlockedUser.IsBlockedUser(Convert.ToInt32(_mu.ProviderUserKey), _ua.UserAccountID))
                    {
                        return RedirectToAction("index", "home");
                    }
                }
            }
            else
            {
                if (uad.MembersOnlyProfile)
                {
                    return RedirectToAction("LogOn", "Account");
                }
            }

            ViewBag.ThumbIcon = uad.FullProfilePicURL;

            SetModelForUserAccount(model, uad);

            //
            var su = new StatusUpdate();
            su.GetMostRecentUserStatus(_ua.UserAccountID);

            if (su.StatusUpdateID > 0)
            {
                model.LastStatusUpdate = su.CreateDate;
                model.MostRecentStatusUpdate = su.Message;
            }

            model.ProfileVisitorCount = ProfileLog.GetUniqueProfileVisitorCount(_ua.UserAccountID);

            GetUserPhotos(model);

            GetUserNews(model);

            model.MetaDescription = _ua.UserName + " " + Messages.Profile + " " +
                                    FromDate.DateToYYYY_MM_DD(_ua.LastActivityDate);

            GetUserPlaylist();

            ForumThreads(_ua.UserAccountID, model);

            if (uad.UserAccountID > 0)
            {
                model.Birthday = uad.BirthDate;

                if (uad.ShowOnMapLegal)
                {
                    // because of the foreign cultures, numbers need to stay in the English version unless a javascript encoding could be added
                    string currentLang = Utilities.GetCurrentLanguageCode();

                    Thread.CurrentThread.CurrentUICulture =
                        CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString());
                    Thread.CurrentThread.CurrentCulture =
                        CultureInfo.CreateSpecificCulture(SiteEnums.SiteLanguages.EN.ToString());

                    model.DisplayOnMap = uad.ShowOnMapLegal;

                    var rnd = new Random();
                    int offset = rnd.Next(10, 100);

                    SiteStructs.LatLong latlong = GeoData.GetLatLongForCountryPostal(uad.Country, uad.PostalCode);

                    if (latlong.latitude != 0 && latlong.longitude != 0)
                    {
                        model.Latitude =
                            Convert.ToDecimal(latlong.latitude + Convert.ToDouble("0.00" + offset))
                                .ToString(CultureInfo.InvariantCulture);
                        model.Longitude =
                            Convert.ToDecimal(latlong.longitude + Convert.ToDouble("0.00" + offset))
                                .ToString(CultureInfo.InvariantCulture);
                    }
                    else
                    {
                        model.DisplayOnMap = false;
                    }

                    Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(currentLang);
                    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(currentLang);
                }

                ViewBag.ThumbIcon = uad.FullProfilePicThumbURL;

                LoadCurrentImagesViewBag(uad.UserAccountID);
            }

            ViewBag.UserAccountDetail = uad;
            ViewBag.UserAccount = _ua;

            GetUserContacts(model);

            UserAccountDetail uadLooker = null;

            if (_mu != null)
            {
                uadLooker = new UserAccountDetail();
                uadLooker.GetUserAccountDeailForUser(Convert.ToInt32(_mu.ProviderUserKey));
            }

            if (uadLooker != null &&
                (_mu != null && _ua.UserAccountID > 0 && uadLooker.EnableProfileLogging && uad.EnableProfileLogging))
            {
                var pl = new ProfileLog
                {
                    LookedAtUserAccountID = _ua.UserAccountID,
                    LookingUserAccountID = Convert.ToInt32(_mu.ProviderUserKey)
                };

                if (pl.LookingUserAccountID != pl.LookedAtUserAccountID) pl.Create();

                ArrayList al = ProfileLog.GetRecentProfileViews(_ua.UserAccountID);

                if (al != null && al.Count > 0)
                {
                    var uas = new UserAccounts();

                    foreach (UserAccount viewwer in al.Cast<int>().Select(id =>
                        new UserAccount(id))
                        .Where(viewwer => !viewwer.IsLockedOut && viewwer.IsApproved)
                        .TakeWhile(viewwer => uas.Count < Maxcountusers))
                    {
                        uas.Add(viewwer);
                    }
                }
            }

            GetUserAccountVideos();

            // this is either a youtube user or this is a band
            var art = new Artist();
            art.GetArtistByAltname(userName);

            if (art.ArtistID > 0)
            {
                // try this way for dashers
                model.UserName = art.Name;
            }

            var vids = new Videos();
            var sngrs = new SongRecords();

            if (art.ArtistID == 0)
            {
                vids.GetAllVideosByUser(userName);

                var uavs = new UserAccountVideos();
                uavs.GetRecentUserAccountVideos(_ua.UserAccountID, 'U');

                foreach (Video f2 in uavs.Select(uav1 => new Video(uav1.VideoID)).Where(f2 => !vids.Contains(f2)))
                {
                    vids.Add(f2);
                }

                vids.Sort((x, y) => (y.PublishDate.CompareTo(x.PublishDate)));

                model.UserName = _ua != null ? _ua.UserName : userName;
            }
            else
            {
                GetArtistProfile(art, vids);
            }

            vids.Sort((p1, p2) => p2.PublishDate.CompareTo(p1.PublishDate));
            sngrs.AddRange(vids.Select(v1 => new SongRecord(v1)));

            if (_mu != null && _ua.UserAccountID != Convert.ToInt32(_mu.ProviderUserKey))
            {
                var uc1 = new UserConnection();

                uc1.GetUserToUserConnection(_ua.UserAccountID, Convert.ToInt32(_mu.ProviderUserKey));

                if (uc1.UserConnectionID > 0)
                {
                    switch (uc1.StatusType)
                    {
                        case 'C':
                            if (uc1.IsConfirmed)
                            {
                                model.IsCyberFriend = true;
                            }
                            else
                            {
                                model.IsWatingToBeCyberFriend = true;
                            }
                            break;
                        case 'R':
                            if (uc1.IsConfirmed)
                            {
                                model.IsRealFriend = true;
                            }
                            else
                            {
                                model.IsWatingToBeRealFriend = true;
                            }
                            break;
                        default:
                            model.IsDeniedCyberFriend = true;
                            model.IsDeniedRealFriend = true;
                            break;
                    }
                }
            }

            if (sngrs.Count == 0 && art.ArtistID == 0 && _ua.UserAccountID == 0)
            {
                // no longer exists
                Response.RedirectPermanent("/");
                return new EmptyResult();
            }

            var sngDisplay = new SongRecords();
            sngDisplay.AddRange(from sr1 in sngrs
                let vidToShow = new Video(sr1.VideoID)
                where vidToShow.IsEnabled
                select sr1);

            model.SongRecords = sngDisplay.VideosList();

            return View(model);
        }
示例#42
0
        private void ProcessStatusUpdates(StatusUpdate[] items)
        {
            bool displayUpdate = false;
            int suppressedUpdates = 0;
            foreach (StatusUpdate item in items)
            {
                if ((DateTime.Now.Ticks - m_lastStatusUpdateTime).ToSeconds() > 1)
                {
                    displayUpdate = true;
                    m_statusUpdatesDisplayed = 1;
                    m_lastStatusUpdateTime = DateTime.Now.Ticks;
                }
                else
                {
                    displayUpdate = m_statusUpdatesDisplayed <= m_maxStatusUpdatesFrequency;
                    m_statusUpdatesDisplayed++;
                }

                // Send the status update to specified client(s).
                if (displayUpdate)
                {
                    if (item.Message.Length <= m_maxStatusUpdatesLength)
                    {
                        SendUpdateClientStatusResponse(item.Client, item.Type, item.Message);
                    }
                    else
                    {
                        SendUpdateClientStatusResponse(item.Client, item.Type, item.Message.TruncateRight(m_maxStatusUpdatesLength));
                        SendUpdateClientStatusResponse(item.Client, UpdateType.Warning, string.Format("\r\nSuppressed {0:N0} status update character(s) from being displayed to avoid flooding.\r\n\r\n", item.Message.Length - m_maxStatusUpdatesLength));
                    }
                }
                else
                {
                    suppressedUpdates++;
                }

                // Log the status update to the log file if logging is enabled.
                if (m_logStatusUpdates)
                    m_statusLog.WriteTimestampedLine(item.Message);
            }

            if (suppressedUpdates > 0)
                SendUpdateClientStatusResponse(Guid.Empty, UpdateType.Warning, string.Format("\r\nSuppressed {0:N0} status update(s) from being displayed to avoid flooding.\r\n\r\n", suppressedUpdates));
        }
		public HitboxVideoJob( string id, StatusUpdate.IStatusUpdate statusUpdater = null ) {
			JobStatus = VideoJobStatus.NotStarted;
			StatusUpdater = statusUpdater == null ? new StatusUpdate.NullStatusUpdate() : statusUpdater;
			VideoInfo = new GenericVideoInfo() { Service = StreamService.Hitbox, VideoId = id };
			Status = "...";
		}
示例#44
0
 public void PrioritizeUpdate(StatusUpdate update)
 {
     m_thread.Push(HighPriority, () => m_serviceHelper.SendUpdateClientStatusResponse(update.Client, update.Type, update.Message));
 }
示例#45
0
        public void ProcessRequest(HttpContext context)
        {
            if (string.IsNullOrEmpty(context.Request.QueryString[SiteEnums.QueryStringNames.param_type.ToString()]))
                return;

            var ptyc = (SiteEnums.QueryStringNames) Enum.Parse(typeof (SiteEnums.QueryStringNames),
                context.Request.QueryString[SiteEnums.QueryStringNames.param_type.ToString()]);

            MembershipUser mu;

            switch (ptyc)
            {
                case SiteEnums.QueryStringNames.status_update:

                    #region status_update

                    string key = context.Request.QueryString[SiteEnums.QueryStringNames.status_update_id.ToString()];

                    if (string.IsNullOrEmpty(key))
                    {
                        key =
                            context.Request.QueryString[
                                SiteEnums.QueryStringNames.most_applauded_status_update_id.ToString()];
                    }

                    int statusUpdateID = Convert.ToInt32(key);

                    StatusUpdate statup;

                    if (
                        !string.IsNullOrEmpty(
                            context.Request.QueryString[SiteEnums.QueryStringNames.stat_update_rsp.ToString()]))
                    {
                        mu = MembershipWrapper.GetUser();

                        if (mu == null) return;
                        var ack = new Acknowledgement
                        {
                            CreatedByUserID = Convert.ToInt32(mu.ProviderUserKey),
                            UserAccountID = Convert.ToInt32(mu.ProviderUserKey),
                            AcknowledgementType = Convert.ToChar(
                                context.Request.QueryString[SiteEnums.QueryStringNames.stat_update_rsp.ToString()]),
                            StatusUpdateID = statusUpdateID
                        };

                        statup = new StatusUpdate(statusUpdateID);

                        if (!Acknowledgement.IsUserAcknowledgement(statusUpdateID, Convert.ToInt32(mu.ProviderUserKey)))
                        {
                            ack.Create();

                            var sun = new StatusUpdateNotification();

                            if (ack.AcknowledgementType == Convert.ToChar(SiteEnums.ResponseType.A.ToString()))
                            {
                                sun.GetStatusUpdateNotificationForUserStatus(statup.UserAccountID, statusUpdateID,
                                    SiteEnums.ResponseType.A);
                            }

                            if (Convert.ToInt32(mu.ProviderUserKey) != statup.UserAccountID)
                            {
                                sun.UserAccountID = statup.UserAccountID;

                                SiteEnums.ResponseType rspType;

                                if (ack.AcknowledgementType == Convert.ToChar(SiteEnums.ResponseType.A.ToString()))
                                {
                                    rspType = SiteEnums.ResponseType.A;
                                    sun.ResponseType = Convert.ToChar(rspType.ToString());
                                }
                                else
                                {
                                    rspType = SiteEnums.ResponseType.B;
                                    sun.ResponseType = Convert.ToChar(rspType.ToString());
                                }

                                sun.CreatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                                sun.UpdatedByUserID = Convert.ToInt32(mu.ProviderUserKey);

                                if (sun.StatusUpdateNotificationID == 0)
                                {
                                    sun.IsRead = false;
                                    sun.Create();
                                }
                                else
                                {
                                    sun.IsRead = false;
                                    sun.Update();
                                }

                                SendNotificationEmail(statup.UserAccountID, Convert.ToInt32(mu.ProviderUserKey), rspType,
                                    sun.StatusUpdateID);
                            }

                            context.Response.Write(string.Format(@"{{""StatusAcks"": ""{0}""}}",
                                HttpUtility.HtmlEncode(statup.StatusAcknowledgements)));
                        }
                        else
                        {
                            // reverse

                            ack.GetAcknowledgement(statusUpdateID, Convert.ToInt32(mu.ProviderUserKey));

                            ack.Delete();

                            // TODO: DELETE NOTIFICATION

                            context.Response.Write(string.Format(@"{{""StatusAcks"": ""{0}""}}",
                                HttpUtility.HtmlEncode(statup.StatusAcknowledgements)));
                        }
                    }
                    else if (
                        !string.IsNullOrEmpty(
                            context.Request.QueryString[
                                SiteEnums.QueryStringNames.stat_update_comment_rsp.ToString()]))
                    {
                        mu = MembershipWrapper.GetUser();

                        if (mu == null) return;
                        var ack = new StatusCommentAcknowledgement
                        {
                            CreatedByUserID = Convert.ToInt32(mu.ProviderUserKey),
                            UserAccountID = Convert.ToInt32(mu.ProviderUserKey),
                            AcknowledgementType = Convert.ToChar(
                                context.Request.QueryString[
                                    SiteEnums.QueryStringNames.stat_update_comment_rsp.ToString()]),
                            StatusCommentID = statusUpdateID
                        };

                        var statcomup = new StatusComment(statusUpdateID);

                        statup = new StatusUpdate(statcomup.StatusUpdateID);

                        if (!StatusCommentAcknowledgement.IsUserCommentAcknowledgement(statcomup.StatusCommentID,
                            Convert.ToInt32(
                                mu.ProviderUserKey)))
                        {
                            ack.Create();

                            var sun = new StatusUpdateNotification();

                            sun.GetStatusUpdateNotificationForUserStatus(statcomup.UserAccountID,
                                statcomup.StatusUpdateID,
                                ack.AcknowledgementType ==
                                Convert.ToChar(
                                    SiteEnums.ResponseType.A.ToString())
                                    ? SiteEnums.ResponseType.A
                                    : SiteEnums.ResponseType.B);

                            if (Convert.ToInt32(mu.ProviderUserKey) != statcomup.UserAccountID)
                            {
                                sun.UserAccountID = statcomup.UserAccountID;

                                SiteEnums.ResponseType rspType;

                                if (ack.AcknowledgementType == Convert.ToChar(SiteEnums.ResponseType.A.ToString()))
                                {
                                    rspType = SiteEnums.ResponseType.A;
                                    sun.ResponseType = Convert.ToChar(rspType.ToString());
                                }
                                else
                                {
                                    rspType = SiteEnums.ResponseType.B;
                                    sun.ResponseType = Convert.ToChar(rspType.ToString());
                                }

                                if (sun.StatusUpdateNotificationID == 0)
                                {
                                    sun.CreatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                                    sun.IsRead = false;
                                    sun.Create();
                                }
                                else
                                {
                                    sun.UpdatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                                    sun.IsRead = false;
                                    sun.Update();
                                }

                                SendNotificationEmail(statup.UserAccountID, Convert.ToInt32(mu.ProviderUserKey), rspType,
                                    sun.StatusUpdateID);
                            }

                            context.Response.Write(string.Format(@"{{""StatusAcks"": ""{0}""}}", HttpUtility.HtmlEncode(
                                statcomup.StatusCommentAcknowledgementsOptions)));
                        }
                        else
                        {
                            // reverse

                            ack.GetCommentAcknowledgement(statusUpdateID, Convert.ToInt32(mu.ProviderUserKey));

                            ack.Delete();
                            // TODO: DELETE NOTIFICATION

                            context.Response.Write(string.Format(@"{{""StatusAcks"": ""{0}""}}", HttpUtility.HtmlEncode(
                                statcomup.StatusCommentAcknowledgementsOptions)));
                        }
                    }
                    else if (
                        !string.IsNullOrEmpty(
                            context.Request.QueryString[SiteEnums.QueryStringNames.comment_msg.ToString()]) &&
                        !string.IsNullOrEmpty(
                            context.Request.QueryString[SiteEnums.QueryStringNames.comment_msg.ToString()])
                        )
                    {
                        mu = MembershipWrapper.GetUser();

                        if (mu == null) return;

                        var statCom = new StatusComment
                        {
                            CreatedByUserID = Convert.ToInt32(mu.ProviderUserKey),
                            Message = HttpUtility.HtmlEncode(
                                context.Request.QueryString[SiteEnums.QueryStringNames.comment_msg.ToString()]),
                            StatusUpdateID = statusUpdateID,
                            UserAccountID = Convert.ToInt32(mu.ProviderUserKey)
                        };

                        // TODO: CHECK IF THERE IS A RECENT MESSAGE THAT IS THE SAME
                        if (statCom.StatusCommentID != 0) return;
                        //BUG: THERE IS AN EVENT HANDLER THAT HAS QUEUED UP TOO MANY
                        var suLast = new StatusUpdate();
                        suLast.GetMostRecentUserStatus(Convert.ToInt32(mu.ProviderUserKey));

                        if (suLast.Message.Trim() != statCom.Message.Trim() ||
                            (suLast.Message.Trim() == statCom.Message.Trim() &&
                             suLast.StatusUpdateID != statCom.StatusUpdateID))
                        {
                            statCom.Create();
                        }

                        statup = new StatusUpdate(statusUpdateID);

                        // create a status update notification for the post maker and all commenters
                        StatusUpdateNotification sun;

                        if (Convert.ToInt32(mu.ProviderUserKey) != statup.UserAccountID)
                        {
                            sun = new StatusUpdateNotification();

                            sun.GetStatusUpdateNotificationForUserStatus(statup.UserAccountID,
                                statusUpdateID,
                                SiteEnums.ResponseType.C);

                            if (sun.StatusUpdateNotificationID == 0)
                            {
                                sun.ResponseType = Convert.ToChar(SiteEnums.ResponseType.C.ToString());
                                sun.CreatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                                sun.IsRead = false;
                                sun.StatusUpdateID = statup.StatusUpdateID;
                                sun.UserAccountID = statup.UserAccountID;
                                sun.Create();
                            }
                            else
                            {
                                sun.IsRead = false;
                                sun.UpdatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                                sun.Update();
                            }

                            SendNotificationEmail(statup.UserAccountID, Convert.ToInt32(mu.ProviderUserKey),
                                SiteEnums.ResponseType.C, sun.StatusUpdateID);
                        }

                        var statComs = new StatusComments();

                        statComs.GetAllStatusCommentsForUpdate(statusUpdateID);

                        foreach (StatusComment sc1 in statComs)
                        {
                            sun = new StatusUpdateNotification();

                            sun.GetStatusUpdateNotificationForUserStatus(statup.UserAccountID,
                                statusUpdateID,
                                SiteEnums.ResponseType.C);

                            if (Convert.ToInt32(mu.ProviderUserKey) == sc1.UserAccountID ||
                                Convert.ToInt32(mu.ProviderUserKey) == statup.UserAccountID) continue;

                            if (sun.StatusUpdateNotificationID == 0)
                            {
                                sun.IsRead = false;
                                sun.StatusUpdateID = statusUpdateID;
                                sun.UserAccountID = sc1.UserAccountID;
                                sun.Create();
                            }
                            else
                            {
                                sun.IsRead = false;
                                sun.Update();
                            }
                        }
                        context.Response.Write(@"{""StatusAcks"": """ + @"""}");
                    }
                    else if (
                        !string.IsNullOrEmpty(
                            context.Request.QueryString[SiteEnums.QueryStringNames.act_type.ToString()]) &&
                        context.Request.QueryString[SiteEnums.QueryStringNames.act_type.ToString()] == "P"
                        )
                    {
                        // delete post
                        statup = new StatusUpdate(statusUpdateID);

                        StatusUpdateNotifications.DeleteNotificationsForStatusUpdate(statup.StatusUpdateID);
                        Acknowledgements.DeleteStatusAcknowledgements(statup.StatusUpdateID);

                        var statComs = new StatusComments();
                        statComs.GetAllStatusCommentsForUpdate(statup.StatusUpdateID);

                        foreach (StatusComment sc1 in statComs)
                        {
                            StatusCommentAcknowledgements.DeleteStatusCommentAcknowledgements(
                                sc1.StatusCommentID);
                        }
                        StatusComments.DeleteStatusComments(statup.StatusUpdateID);

                        statup.Delete();

                        if (statup.PhotoItemID != null)
                        {
                            var pitm = new PhotoItem(Convert.ToInt32(statup.PhotoItemID));

                            var s3 = new S3Service
                            {
                                AccessKeyID = AmazonCloudConfigs.AmazonAccessKey,
                                SecretAccessKey = AmazonCloudConfigs.AmazonSecretKey
                            };

                            if (s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathRaw))
                            {
                                s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathRaw);
                            }

                            if (s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathStandard))
                            {
                                s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathStandard);
                            }

                            if (s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathThumb))
                            {
                                s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathThumb);
                            }

                            pitm.Delete();
                        }
                        context.Response.Write(@"{""StatusAcks"": """ + @"""}");
                    }
                    else if (
                        !string.IsNullOrEmpty(
                            context.Request.QueryString[SiteEnums.QueryStringNames.act_type.ToString()]) &&
                        context.Request.QueryString[SiteEnums.QueryStringNames.act_type.ToString()] ==
                        "C"
                        )
                    {
                        // delete comment

                        var statCom = new StatusComment(
                            Convert.ToInt32(
                                context.Request.QueryString[
                                    SiteEnums.QueryStringNames.status_com_id.ToString()]));

                        StatusCommentAcknowledgements.DeleteStatusCommentAcknowledgements(
                            statCom.StatusCommentID);

                        statCom.Delete();

                        context.Response.Write(string.Format(@"{{""StatusUpdateID"": ""{0}""}}", statCom.StatusUpdateID));
                    }
                    else if (!string.IsNullOrEmpty(
                        context.Request.QueryString[SiteEnums.QueryStringNames.all_comments.ToString()]))
                    {
                        mu = MembershipWrapper.GetUser();

                        if (mu == null) return;

                        var preFilter = new StatusComments();

                        preFilter.GetAllStatusCommentsForUpdate(statusUpdateID);

                        var statComs = new StatusComments();
                        statComs.AddRange(
                            preFilter.Where(
                                su1 =>
                                    !BlockedUser.IsBlockingUser(Convert.ToInt32(mu.ProviderUserKey), su1.UserAccountID)));

                        statComs.IncludeStartAndEndTags = true;

                        var sb = new StringBuilder(100);

                        sb.Append(statComs.ToUnorderdList);

                        context.Response.Write(string.Format(@"{{""StatusComs"": ""{0}""}}",
                            HttpUtility.HtmlEncode(sb.ToString())));
                    }
                    else if (!string.IsNullOrEmpty(
                        context.Request.QueryString[SiteEnums.QueryStringNames.comment_page.ToString()]))
                    {
                        int pcount =
                            Convert.ToInt32(
                                context.Request.QueryString[
                                    SiteEnums.QueryStringNames.comment_page.ToString()]);

                        var statups = new StatusUpdates();

                        pcount = pcount + 10;

                        var preFilter = new StatusUpdates();

                        preFilter.GetStatusUpdatesPageWise(pcount, 1);

                        mu = MembershipWrapper.GetUser();

                        statups.AddRange(
                            preFilter.Where(
                                su1 =>
                                    mu != null &&
                                    !BlockedUser.IsBlockingUser(Convert.ToInt32(mu.ProviderUserKey), su1.UserAccountID)));

                        statups.IncludeStartAndEndTags = false;

                        context.Response.Write(string.Format(@"{{""StatusUpdates"": ""{0}""}}",
                            HttpUtility.HtmlEncode(statups.ToUnorderdList)));
                    }

                    #endregion

                    break;
                case SiteEnums.QueryStringNames.begin_playlist:

                    #region begin_playlist

                    context.Response.Write(
                        PlaylistVideo.GetFirstVideo(Convert.ToInt32(context.Request.QueryString[
                            SiteEnums.QueryStringNames.playlist.ToString()])));

                    #endregion

                    break;
                case SiteEnums.QueryStringNames.menu:

                    #region menu

                    mu = MembershipWrapper.GetUser();

                    int userCountChat = 0;
                    int userMessages = 0;
                    int unconfirmedUsers = 0;
                    int notifications = 0;

                    if (mu != null)
                    {
                        // log off users who are offline

                        var uasOffline = new UserAccounts();
                        uasOffline.GetWhoIsOffline(true);

                        foreach (UserAccount uaoff1 in uasOffline)
                        {
                            var cru = new ChatRoomUser();
                            cru.GetChatRoomUserByUserAccountID(uaoff1.UserAccountID);

                            if (cru.ChatRoomUserID > 0)
                            {
                                cru.DeleteChatRoomUser();
                            }

                            var offlineUser = new UserAccount(uaoff1.UserAccountID);
                            offlineUser.RemoveCache();
                        }

                        userCountChat = ChatRoomUsers.GetChattingUserCount();

                        userMessages = DirectMessages.GetDirectMessagesToUserCount(mu);
                        unconfirmedUsers =
                            UserConnections.GetCountUnconfirmedConnections(Convert.ToInt32(mu.ProviderUserKey));
                    }

                    // get users online
                    int onlineUsers = UserAccounts.GetOnlineUserCount();

                    if (mu != null)
                    {
                        notifications =
                            StatusUpdateNotifications.GetStatusUpdateNotificationCountForUser(
                                Convert.ToInt32(mu.ProviderUserKey));
                    }

                    string timedMessge = string.Format(
                        @"{{""UserCountChat"": ""{0}"",
               ""UserMessages"": ""{1}"",
               ""OnlineUsers"": ""{2}"",
               ""Notifications"": ""{3}"",
               ""UnconfirmedUsers"": ""{4}""}}", userCountChat, userMessages, onlineUsers, notifications,
                        unconfirmedUsers);

                    context.Response.Write(timedMessge);

                    #endregion

                    break;
                case SiteEnums.QueryStringNames.random:

                    #region random

                    if (
                        !string.IsNullOrEmpty(
                            context.Request.QueryString[SiteEnums.QueryStringNames.currentvidid.ToString()]))
                    {
                        context.Response.Write(Video.GetRandomJSON(
                            context.Request.QueryString[SiteEnums.QueryStringNames.currentvidid.ToString()]));
                    }
                    else
                    {
                        context.Response.Write(Video.GetRandomJSON());
                    }

                    #endregion

                    break;
                case SiteEnums.QueryStringNames.video_playlist:

                    #region video_playlist

                    if (!string.IsNullOrEmpty(
                        context.Request.QueryString[SiteEnums.QueryStringNames.currentvidid.ToString()]))
                    {
                        context.Response.Write(
                            PlaylistVideo.GetNextVideo(
                                Convert.ToInt32(
                                    context.Request.QueryString[SiteEnums.QueryStringNames.playlist.ToString()]),
                                context.Request.QueryString[SiteEnums.QueryStringNames.currentvidid.ToString()]));
                    }
                    else if (
                        !string.IsNullOrEmpty(
                            context.Request.QueryString[SiteEnums.QueryStringNames.begin_playlist.ToString()]))
                    {
                        context.Response.Write(
                            PlaylistVideo.GetFirstVideo(
                                Convert.ToInt32(
                                    context.Request.QueryString[SiteEnums.QueryStringNames.playlist.ToString()])));
                    }
                    else
                    {
                        context.Response.Write(
                            PlaylistVideo.CurrentVideoInPlaylist(
                                Convert.ToInt32(
                                    context.Request.QueryString[SiteEnums.QueryStringNames.playlist.ToString()])
                                ));
                    }

                    #endregion

                    break;
                case SiteEnums.QueryStringNames.video:

                    #region video

                    var vid = new Video("YT", context.Request.QueryString[SiteEnums.QueryStringNames.vid.ToString()]);

                    VideoLog.AddVideoLog(vid.VideoID, context.Request.UserHostAddress);

                    context.Response.Write(
                        Video.GetVideoJSON(context.Request.QueryString[SiteEnums.QueryStringNames.vid.ToString()]));

                    #endregion

                    break;

                case SiteEnums.QueryStringNames.playlist:

                    #region playlist

                    if (!string.IsNullOrEmpty(
                        context.Request.QueryString[SiteEnums.QueryStringNames.currentvidid.ToString()]))
                    {
                        context.Response.Write(
                            PlaylistVideo.GetNextVideo(
                                Convert.ToInt32(
                                    context.Request.QueryString[SiteEnums.QueryStringNames.playlist.ToString()]),
                                context.Request.QueryString[SiteEnums.QueryStringNames.currentvidid.ToString()]));
                    }
                    else if (
                        !string.IsNullOrEmpty(
                            context.Request.QueryString[SiteEnums.QueryStringNames.begin_playlist.ToString()]))
                    {
                        context.Response.Write(
                            PlaylistVideo.GetFirstVideo(
                                Convert.ToInt32(
                                    context.Request.QueryString[SiteEnums.QueryStringNames.playlist.ToString()])));
                    }
                    else
                    {
                        context.Response.Write(
                            PlaylistVideo.CurrentVideoInPlaylist(
                                Convert.ToInt32(
                                    context.Request.QueryString[SiteEnums.QueryStringNames.playlist.ToString()])
                                ));
                    }

                    #endregion

                    break;
            }
        }
示例#46
0
        public ActionResult Home()
        {
            mu = Membership.GetUser();

            if (mu == null)
            {
                return RedirectToAction("LogOff");
            }

            ua = new UserAccount(Convert.ToInt32(mu.ProviderUserKey));

            ViewBag.CurrentUser = ua.ToUnorderdListItem;

            StatusUpdates preFilter = new StatusUpdates();

            preFilter.GetStatusUpdatesPageWise(1, pageSize);

            StatusUpdates sus = new StatusUpdates();

            foreach (BootBaronLib.AppSpec.DasKlub.BOL.StatusUpdate su1
                in preFilter)
            {
                if (!BootBaronLib.AppSpec.DasKlub.BOL.BlockedUser.IsBlockingUser(ua.UserAccountID, su1.UserAccountID))
                {
                    sus.Add(su1);
                }
            }

            sus.IncludeStartAndEndTags = false;
            ViewBag.StatusUpdateList = string.Format(@"<ul id=""status_update_list_items"">{0}</ul>", sus.ToUnorderdList);

            StatusUpdateNotifications suns = new StatusUpdateNotifications();
            suns.GetStatusUpdateNotificationsForUser(ua.UserAccountID);

            if (suns.Count > 0)
            {
                suns.Sort(delegate(StatusUpdateNotification p1, StatusUpdateNotification p2)
                {
                    return p1.CreateDate.CompareTo(p2.CreateDate);
                });

                ViewBag.Notifications = suns;

                foreach (StatusUpdateNotification sun1 in suns)
                {
                    sun1.IsRead = true;
                    sun1.Update();
                }
            }

            StatusUpdates applauseResult = new StatusUpdates();
            applauseResult.GetMostAcknowledgedStatus(7, 'A');
            if (applauseResult.Count > 0)
            {
                ViewBag.MostApplauded = applauseResult;
            }

            StatusUpdate beatDownResult = new BootBaronLib.AppSpec.DasKlub.BOL.StatusUpdate();
            beatDownResult = new StatusUpdate();
            beatDownResult.GetMostAcknowledgedStatus(7, 'B');

            bool isAlreadyApplauded = false;

            if (beatDownResult.StatusUpdateID > 0)
            {
                foreach (StatusUpdate ssr1 in applauseResult)
                {
                    if (beatDownResult.StatusUpdateID == ssr1.StatusUpdateID)
                    {
                        isAlreadyApplauded = true;
                        break;
                    }
                }
            }

            if (!isAlreadyApplauded && beatDownResult.StatusUpdateID > 0)
            {
                ViewBag.MostBeatDown = beatDownResult;
            }

            //
            StatusUpdate commentResponse
            = new BootBaronLib.AppSpec.DasKlub.BOL.StatusUpdate(
            StatusComments.GetMostCommentedOnStatus(DateTime.UtcNow.AddDays(-7)));

            bool isAlreadyCommented = false;

            foreach (StatusUpdate ssr1 in applauseResult)
            {
                if (commentResponse.StatusUpdateID == ssr1.StatusUpdateID)
                {
                    isAlreadyCommented = true;
                }
            }

            if (!isAlreadyCommented && beatDownResult.StatusUpdateID != commentResponse.StatusUpdateID && commentResponse.StatusUpdateID > 0)
            {
                // only show if the most commented is different from most beat down or applauded
                ViewBag.MostCommented = commentResponse;
            }

            return View();
        }
示例#47
0
        public ActionResult StatusDelete(NameValueCollection nvc)
        {
            if (Request.Form["delete_status_id"] != null)
            {
                StatusUpdate su = new StatusUpdate(
                    Convert.ToInt32(Request.Form["delete_status_id"])
                    );

                // delete all acknowledgements for status

                Acknowledgements.DeleteStatusAcknowledgements(su.StatusUpdateID);

                su.Delete();
            }
            else if (Request.Form["status_update_id_beat"] != null ||
                     Request.Form["status_update_id_applaud"] != null)
            {
                mu = Membership.GetUser();

                Acknowledgement ack = new Acknowledgement();

                ack.CreatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                ack.UserAccountID = Convert.ToInt32(mu.ProviderUserKey);

                if (Request.Form["status_update_id_beat"] != null)
                {
                    ack.AcknowledgementType = 'B';
                    ack.StatusUpdateID = Convert.ToInt32(Request.Form["status_update_id_beat"]);
                }
                else if (Request.Form["status_update_id_applaud"] != null)
                {
                    ack.AcknowledgementType = 'A';
                    ack.StatusUpdateID = Convert.ToInt32(Request.Form["status_update_id_applaud"]);
                }

                if (!Acknowledgement.IsUserAcknowledgement(ack.StatusUpdateID, ack.UserAccountID))
                {
                    ack.Create();
                }
            }

            return RedirectToAction("Home");
        }
示例#48
0
        public ActionResult Home()
        {
            if (_mu == null)
            {
                return RedirectToAction("LogOff");
            }

            var uas = new UserAccounts();
            uas.GetNewestUsers();
            ViewBag.NewestUsers = uas.ToUnorderdList;

            _ua = new UserAccount(Convert.ToInt32(_mu.ProviderUserKey));

            ViewBag.CurrentUser = _ua.ToUnorderdListItem;

            var preFilter = new StatusUpdates();

            preFilter.GetStatusUpdatesPageWise(1, PageSize);

            var sus = new StatusUpdates();
            sus.AddRange(
                preFilter.Where(
                    su1 =>
                        !Lib.BOL.BlockedUser.IsBlockingUser(_ua.UserAccountID, su1.UserAccountID)));

            sus.IncludeStartAndEndTags = false;
            ViewBag.StatusUpdateList = string.Format(@"<ul id=""status_update_list_items"">{0}</ul>", sus.ToUnorderdList);

            var suns = new StatusUpdateNotifications();
            suns.GetStatusUpdateNotificationsForUser(_ua.UserAccountID);

            if (suns.Count > 0)
            {
                suns.Sort((p1, p2) => p1.CreateDate.CompareTo(p2.CreateDate));

                ViewBag.Notifications = suns;

                foreach (StatusUpdateNotification sun1 in suns)
                {
                    sun1.IsRead = true;
                    sun1.Update();
                }
            }

            var applauseResult = new StatusUpdates();
            applauseResult.GetMostAcknowledgedStatus(7, SiteEnums.AcknowledgementType.A);
            if (applauseResult.Count > 0)
            {
                ViewBag.MostApplauded = applauseResult;
            }

            var beatDownResult = new StatusUpdate();
            beatDownResult.GetMostAcknowledgedStatus(7, SiteEnums.AcknowledgementType.B);

            bool isAlreadyApplauded = false;

            if (beatDownResult.StatusUpdateID > 0)
            {
                if (applauseResult.Any(ssr1 => beatDownResult.StatusUpdateID == ssr1.StatusUpdateID))
                {
                    isAlreadyApplauded = true;
                }
            }

            if (!isAlreadyApplauded && beatDownResult.StatusUpdateID > 0)
            {
                ViewBag.MostBeatDown = beatDownResult;
            }

            var commentResponse = new StatusUpdate(StatusComments.GetMostCommentedOnStatus(DateTime.UtcNow.AddDays(-7)));

            bool isAlreadyCommented = false;

            foreach (
                StatusUpdate ssr1 in applauseResult.Where(ssr1 => commentResponse.StatusUpdateID == ssr1.StatusUpdateID)
                )
            {
                isAlreadyCommented = true;
            }

            if (!isAlreadyCommented && beatDownResult.StatusUpdateID != commentResponse.StatusUpdateID &&
                commentResponse.StatusUpdateID > 0)
            {
                ViewBag.MostCommented = commentResponse;
            }

            if (TempData["user_error"] != null)
            {
                ViewBag.Error = TempData["user_error"];
            }

            return View();
        }
示例#49
0
        public ActionResult UserPhoto(string userName, int photoItemID)
        {
            _ua = new UserAccount(userName);

            ViewBag.UserName = _ua.UserName;

            _pitm = new PhotoItem(photoItemID);

            var sus = new StatusUpdates();

            var su = new StatusUpdate();

            su.GetStatusUpdateByPhotoID(photoItemID);

            su.PhotoDisplay = true;
            sus.Add(su);

            if (string.IsNullOrWhiteSpace(_pitm.Title))
            {
                _pitm.Title = String.Format("{0:u}", _pitm.CreateDate);
            }

            sus.IncludeStartAndEndTags = false;
            ViewBag.StatusUpdateList = @"<ul id=""status_update_list_items"">" + sus.ToUnorderdList + @"</ul>";

            var pitm2 = new PhotoItem();

            pitm2.GetPreviousPhotoForUser(_pitm.CreateDate, _ua.UserAccountID);
            if (pitm2.PhotoItemID > 0)
            {
                pitm2.IsUserPhoto = true;
                pitm2.ShowTitle = false;
                pitm2.UseThumb = true;
                ViewBag.PreviousPhoto = pitm2;
            }

            pitm2 = new PhotoItem();
            pitm2.GetNextPhotoForUser(_pitm.CreateDate, _ua.UserAccountID);

            if (pitm2.PhotoItemID <= 0) return View(_pitm);

            pitm2.IsUserPhoto = true;
            pitm2.ShowTitle = false;
            pitm2.UseThumb = true;
            ViewBag.NextPhoto = pitm2;

            return View(_pitm);
        }
示例#50
0
        public MappingReader(string _path, string _srcTag, string _destTag, List<Province> srcProvs, List<Province> destProvs, StatusUpdate su)
        {
            srcTag  = _srcTag;
            destTag = _destTag;
            path    = _path;

            initialLines = new List<string>();
            List<Mapping>   currentMappings = new List<Mapping>();
            string          mappingName     = "";
            int             level           = 0;

            StreamReader sr = new StreamReader(path, Encoding.GetEncoding(1252));
            while (!sr.EndOfStream)
            {
                string line = sr.ReadLine().Trim();
                if (line.Length > 0)
                {
                    if (level == 0)
                    {
                        if (line.Count(x => x == '{') > 0)
                        {
                            if (mappingName != "")
                            {
                                mappings.Add(mappingName, currentMappings);
                                currentMappings = new List<Mapping>();
                            }
                            string[] strings = line.Split('=');
                            mappingName = strings[0];
                            mappingName = mappingName.Trim();
                        }
                        else
                        {
                            initialLines.Add(line);
                        }
                    }
                    else if (line.StartsWith("link"))
                    {
                        try
                        {
                            currentMappings.Add(new ProvinceMapping(line, srcTag, destTag, srcProvs, destProvs, mappingName));
                        }
                        catch (Exception e)
                        {
                            System.Windows.Forms.MessageBox.Show(e.Message, "Error in mapping file");
                        }
                        level += line.Count(x => x == '{') - line.Count(x => x == '}');
                    }
                    else if (line.StartsWith("#"))
                    {
                        try
                        {
                            currentMappings.Add(new CommentMapping(line));
                        }
                        catch (Exception e)
                        {
                            System.Windows.Forms.MessageBox.Show(e.Message, "Error in mapping file");
                        }
                    }
                    else if (line.StartsWith("mappings") || line.StartsWith("{") || line.StartsWith("}"))
                    {
                        // ignore these lines
                    }
                    else
                    {
                        System.Windows.Forms.MessageBox.Show(String.Format("Error parsing province mapping file: line beginning '{0}' appears to be invalid.", line.Split(' ')[0]));
                    }

                    level += line.Count(x => x == '{') - line.Count(x => x == '}');
                }
                su(100.0 * sr.BaseStream.Position / sr.BaseStream.Length);
            }
            mappings.Add(mappingName, currentMappings);
            sr.Close();
        }
示例#51
0
        public void ProcessRequest(HttpContext context)
        {
            //        context.Response.ContentType = "text/plain";

               //    context.Response.CacheControl = "no-cache";

               // context.Response.AddHeader("Pragma", "no-cache");

               // //context.Response.AddHeader("Pragma", "no-store");

               // //context.Response.AddHeader("cache-control", "no-cache");

               //context.Response.Cache.SetCacheability(HttpCacheability.NoCache);

               // context.Response.Cache.SetNoServerCaching();

            if (string.IsNullOrEmpty(context.Request.QueryString[SiteEnums.QueryStringNames.param_type.ToString()])) return;

            SiteEnums.QueryStringNames ptyc = (SiteEnums.QueryStringNames)Enum.Parse(typeof(SiteEnums.QueryStringNames),
                context.Request.QueryString[SiteEnums.QueryStringNames.param_type.ToString()]);

              //  Dictionary<string, Subgurim.Chat.Usuario> usrrs = null;
            StringBuilder sb = null;
            MembershipUser mu = null;

            switch (ptyc)
            {
                case SiteEnums.QueryStringNames.status_update:
                    #region status_update

                    string key = context.Request.QueryString[SiteEnums.QueryStringNames.status_update_id.ToString()];

                    if (string.IsNullOrEmpty(key))
                    {
                        key = context.Request.QueryString[SiteEnums.QueryStringNames.most_applauded_status_update_id.ToString()];
                    }

                    int statusUpdateID = Convert.ToInt32(key);

                    StatusUpdate statup = null;

                    if (!string.IsNullOrEmpty(context.Request.QueryString[SiteEnums.QueryStringNames.stat_update_rsp.ToString()]))
                    {
                        mu = Membership.GetUser();

                        Acknowledgement ack = new Acknowledgement();

                        ack.CreatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                        ack.UserAccountID = Convert.ToInt32(mu.ProviderUserKey);
                        ack.AcknowledgementType = Convert.ToChar(context.Request.QueryString[SiteEnums.QueryStringNames.stat_update_rsp.ToString()]);
                        ack.StatusUpdateID = statusUpdateID;

                        statup = new StatusUpdate(statusUpdateID);

                        if (!Acknowledgement.IsUserAcknowledgement(statusUpdateID, Convert.ToInt32(mu.ProviderUserKey)))
                        {
                            ack.Create();

                            StatusUpdateNotification sun = new StatusUpdateNotification();

                            if (ack.AcknowledgementType == Convert.ToChar(SiteEnums.ResponseType.A.ToString()))
                            {
                                //  sun.GetStatusUpdateNotificationForUserStatus(Convert.ToInt32(mu.ProviderUserKey), statusUpdateID, SiteEnums.ResponseType.A);
                                sun.GetStatusUpdateNotificationForUserStatus(statup.UserAccountID, statusUpdateID, SiteEnums.ResponseType.A);
                            }
                            else if (ack.AcknowledgementType == Convert.ToChar(SiteEnums.ResponseType.B.ToString()))
                            {
                                //sun.GetStatusUpdateNotificationForUserStatus(Convert.ToInt32(mu.ProviderUserKey), statusUpdateID, SiteEnums.ResponseType.B);
                                sun.GetStatusUpdateNotificationForUserStatus(statup.UserAccountID, statusUpdateID, SiteEnums.ResponseType.B);
                            }

                            if (Convert.ToInt32(mu.ProviderUserKey) != statup.UserAccountID)
                            {
                                sun.UserAccountID = statup.UserAccountID;

                                SiteEnums.ResponseType rspType = SiteEnums.ResponseType.U;

                                if (ack.AcknowledgementType == Convert.ToChar(SiteEnums.ResponseType.A.ToString()))
                                {
                                    rspType = SiteEnums.ResponseType.A;
                                    sun.ResponseType = Convert.ToChar(rspType.ToString());
                                }
                                else
                                {
                                    rspType = SiteEnums.ResponseType.B;
                                    sun.ResponseType = Convert.ToChar(rspType.ToString());
                                }

                                sun.CreatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                                sun.UpdatedByUserID = Convert.ToInt32(mu.ProviderUserKey);

                                if (sun.StatusUpdateNotificationID == 0)
                                {
                                    sun.IsRead = false;
                                    sun.Create();
                                }
                                else
                                {
                                    sun.IsRead = false;
                                    sun.Update();
                                }

                                SendNotificationEmail(statup.UserAccountID, rspType, sun.StatusUpdateID);
                            }

                            context.Response.Write(@"{""StatusAcks"": """ + HttpUtility.HtmlEncode(statup.StatusAcknowledgements) + @"""}");
                        }
                        else
                        {
                            // reverse

                            ack.GetAcknowledgement(statusUpdateID, Convert.ToInt32(mu.ProviderUserKey));

                            ack.Delete();

                            // TODO: DELETE NOTIFICATION

                            context.Response.Write(@"{""StatusAcks"": """ + HttpUtility.HtmlEncode(statup.StatusAcknowledgements) + @"""}");
                        }
                    }
                    else if (!string.IsNullOrEmpty(context.Request.QueryString[SiteEnums.QueryStringNames.stat_update_comment_rsp.ToString()]))
                    {
                        mu = Membership.GetUser();

                        StatusCommentAcknowledgement ack = new StatusCommentAcknowledgement();

                        ack.CreatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                        ack.UserAccountID = Convert.ToInt32(mu.ProviderUserKey);
                        ack.AcknowledgementType = Convert.ToChar(context.Request.QueryString[SiteEnums.QueryStringNames.stat_update_comment_rsp.ToString()]);
                        ack.StatusCommentID = statusUpdateID; // this is really the commentID (or should be)

                        StatusComment statcomup = new StatusComment(statusUpdateID);

                        statup = new StatusUpdate(statcomup.StatusUpdateID);

                        if (!StatusCommentAcknowledgement.IsUserCommentAcknowledgement(statcomup.StatusCommentID, Convert.ToInt32(mu.ProviderUserKey)))
                        {
                            ack.Create();

                            StatusUpdateNotification sun = new StatusUpdateNotification();

                            if (ack.AcknowledgementType == Convert.ToChar(SiteEnums.ResponseType.A.ToString()))
                            {
                                sun.GetStatusUpdateNotificationForUserStatus(statcomup.UserAccountID, statcomup.StatusUpdateID, SiteEnums.ResponseType.A);
                            }
                            else
                            {
                                sun.GetStatusUpdateNotificationForUserStatus(statcomup.UserAccountID, statcomup.StatusUpdateID, SiteEnums.ResponseType.B);
                            }

                            if (Convert.ToInt32(mu.ProviderUserKey) != statcomup.UserAccountID)
                            {
                                sun.UserAccountID = statcomup.UserAccountID;

                                SiteEnums.ResponseType rspType = SiteEnums.ResponseType.U;

                                if (ack.AcknowledgementType == Convert.ToChar(SiteEnums.ResponseType.A.ToString()))
                                {
                                    rspType = SiteEnums.ResponseType.A;
                                    sun.ResponseType = Convert.ToChar(rspType.ToString());
                                }
                                else
                                {
                                    rspType = SiteEnums.ResponseType.B;
                                    sun.ResponseType = Convert.ToChar(rspType.ToString());
                                }

                                if (sun.StatusUpdateNotificationID == 0)
                                {
                                    sun.CreatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                                    sun.IsRead = false;
                                    sun.Create();
                                }
                                else
                                {
                                    sun.UpdatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                                    sun.IsRead = false;
                                    sun.Update();
                                }

                                SendNotificationEmail(statup.UserAccountID, rspType, sun.StatusUpdateID);
                            }

                            context.Response.Write(@"{""StatusAcks"": """ + HttpUtility.HtmlEncode(statcomup.StatusCommentAcknowledgementsOptions) + @"""}");
                        }
                        else
                        {
                            // reverse

                            ack.GetCommentAcknowledgement(statusUpdateID, Convert.ToInt32(mu.ProviderUserKey));

                            ack.Delete();
                            // TODO: DELETE NOTIFICATION

                            context.Response.Write(@"{""StatusAcks"": """ + HttpUtility.HtmlEncode(statcomup.StatusCommentAcknowledgementsOptions) + @"""}");
                        }
                    }
                    else if (!string.IsNullOrEmpty(context.Request.QueryString[SiteEnums.QueryStringNames.comment_msg.ToString()]) &&
                        !string.IsNullOrEmpty(context.Request.QueryString[SiteEnums.QueryStringNames.comment_msg.ToString()])
                        )
                    {
                        mu = Membership.GetUser();

                        if (mu == null) return;

                        StatusComment statCom = new StatusComment();
                        statCom.CreatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                        statCom.Message = HttpUtility.HtmlEncode(context.Request.QueryString[SiteEnums.QueryStringNames.comment_msg.ToString()]);
                        statCom.StatusUpdateID = statusUpdateID;
                        statCom.UserAccountID = Convert.ToInt32(mu.ProviderUserKey);

                        //statCom.GetStatusCommentMessage(); // ? ignore this duplicate now

                        // TODO: CHECK IF THERE IS A RECENT MESSAGE THAT IS THE SAME
                        if (statCom.StatusCommentID == 0)
                        {
                            //BUG: THERE IS AN EVENT HANDLER THAT HAS QUEUED UP TOO MANY
                            StatusUpdate suLast = new StatusUpdate();
                            suLast.GetMostRecentUserStatus(Convert.ToInt32(mu.ProviderUserKey));

                            if (suLast.Message.Trim() != statCom.Message.Trim() || (suLast.Message.Trim() == statCom.Message.Trim() && suLast.StatusUpdateID != statCom.StatusUpdateID))
                            {
                                statCom.Create();
                            }

                            statup = new StatusUpdate(statusUpdateID);

                            // create a status update notification for the post maker and all commenters
                            StatusUpdateNotification sun = null;

                            if (Convert.ToInt32(mu.ProviderUserKey) != statup.UserAccountID)
                            {
                                sun = new StatusUpdateNotification();

                                sun.GetStatusUpdateNotificationForUserStatus(statup.UserAccountID, statusUpdateID, SiteEnums.ResponseType.C);

                                if (sun.StatusUpdateNotificationID == 0)
                                {
                                    sun.ResponseType = Convert.ToChar(SiteEnums.ResponseType.C.ToString());
                                    sun.CreatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                                    sun.IsRead = false;
                                    sun.StatusUpdateID = statup.StatusUpdateID;
                                    sun.UserAccountID = statup.UserAccountID;
                                    sun.Create();
                                }
                                else
                                {
                                    sun.IsRead = false;
                                    sun.UpdatedByUserID = Convert.ToInt32(mu.ProviderUserKey);
                                    sun.Update();
                                }

                                SendNotificationEmail(statup.UserAccountID, SiteEnums.ResponseType.C, sun.StatusUpdateID);
                            }

                            StatusComments statComs = new StatusComments();

                            statComs.GetAllStatusCommentsForUpdate(statusUpdateID);

                            foreach (StatusComment sc1 in statComs)
                            {
                                sun = new StatusUpdateNotification();

                                sun.GetStatusUpdateNotificationForUserStatus(statup.UserAccountID, statusUpdateID, SiteEnums.ResponseType.C);

                                if (Convert.ToInt32(mu.ProviderUserKey) == sc1.UserAccountID ||
                                    Convert.ToInt32(mu.ProviderUserKey) == statup.UserAccountID) continue;

                                if (sun.StatusUpdateNotificationID == 0)
                                {
                                    sun.IsRead = false;
                                    sun.StatusUpdateID = statusUpdateID;
                                    sun.UserAccountID = sc1.UserAccountID;
                                    sun.Create();
                                }
                                else
                                {
                                    sun.IsRead = false;
                                    sun.Update();
                                }
                            }
                            context.Response.Write(@"{""StatusAcks"": """ +  @"""}");
                        }
                    }
                    else if (!string.IsNullOrEmpty(context.Request.QueryString[SiteEnums.QueryStringNames.act_type.ToString()]) &&
                         context.Request.QueryString[SiteEnums.QueryStringNames.act_type.ToString()] == "P"
                        )
                    {
                        // delete post
                        statup = new StatusUpdate(statusUpdateID);

                        StatusUpdateNotifications.DeleteNotificationsForStatusUpdate(statup.StatusUpdateID);
                        Acknowledgements.DeleteStatusAcknowledgements(statup.StatusUpdateID);

                        StatusComments statComs = new StatusComments();
                        statComs.GetAllStatusCommentsForUpdate(statup.StatusUpdateID);

                        foreach (StatusComment sc1 in statComs)
                        {
                            StatusCommentAcknowledgements.DeleteStatusCommentAcknowledgements(sc1.StatusCommentID);
                        }
                        StatusComments.DeleteStatusComments(statup.StatusUpdateID);

                        statup.Delete();

                        if (statup.PhotoItemID != null)
                        {
                            PhotoItem pitm = new PhotoItem(Convert.ToInt32(statup.PhotoItemID));

                            S3Service s3 = new S3Service();

                            s3.AccessKeyID = AmazonCloudConfigs.AmazonAccessKey;
                            s3.SecretAccessKey = AmazonCloudConfigs.AmazonSecretKey;

                            if (s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathRaw))
                            {
                                s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathRaw);
                            }

                            if (s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathStandard))
                            {
                                s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathStandard);
                            }

                            if (s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathThumb))
                            {
                                s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathThumb);
                            }

                            pitm.Delete();
                        }
                        context.Response.Write(@"{""StatusAcks"": """ + @"""}");
                    }
                    else if (!string.IsNullOrEmpty(context.Request.QueryString[SiteEnums.QueryStringNames.act_type.ToString()]) &&
                             context.Request.QueryString[SiteEnums.QueryStringNames.act_type.ToString()] == "C"
                            )
                    {
                        // delete comment

                        StatusComment statCom = new StatusComment(
                            Convert.ToInt32(context.Request.QueryString[SiteEnums.QueryStringNames.status_com_id.ToString()]));

                        StatusCommentAcknowledgements.DeleteStatusCommentAcknowledgements(statCom.StatusCommentID);

                        statCom.Delete();

                        context.Response.Write(@"{""StatusUpdateID"": """ + statCom.StatusUpdateID.ToString() + @"""}");
                    }
                    else if (!string.IsNullOrEmpty(
                        context.Request.QueryString[SiteEnums.QueryStringNames.all_comments.ToString()]))
                    {
                        mu = Membership.GetUser();

                        if (mu == null) return;

                        StatusComments preFilter = new StatusComments();

                        preFilter.GetAllStatusCommentsForUpdate(statusUpdateID);

                        StatusComments statComs = new StatusComments();

                        foreach (BootBaronLib.AppSpec.DasKlub.BOL.StatusComment su1 in preFilter)
                        {
                            if (!BootBaronLib.AppSpec.DasKlub.BOL.BlockedUser.IsBlockingUser(Convert.ToInt32(mu.ProviderUserKey), su1.UserAccountID))
                            {
                                statComs.Add(su1);
                            }
                        }

                        statComs.IncludeStartAndEndTags = true;

                        sb = new StringBuilder(100);

                        sb.Append(statComs.ToUnorderdList);

                        context.Response.Write(@"{""StatusComs"": """ + HttpUtility.HtmlEncode(sb.ToString()) + @"""}");
                    }
                    else if (!string.IsNullOrEmpty(
                            context.Request.QueryString[SiteEnums.QueryStringNames.comment_page.ToString()]))
                    {
                        int pcount = Convert.ToInt32(context.Request.QueryString[SiteEnums.QueryStringNames.comment_page.ToString()]);

                        StatusUpdates statups = new StatusUpdates();

                        pcount = pcount + 10;

                        StatusUpdates preFilter = new StatusUpdates();

                        preFilter.GetStatusUpdatesPageWise(pcount, 1);

                        StatusUpdates sus = new StatusUpdates();

                        mu = Membership.GetUser();

                        foreach (BootBaronLib.AppSpec.DasKlub.BOL.StatusUpdate su1
                            in preFilter)
                        {
                            if (!BootBaronLib.AppSpec.DasKlub.BOL.BlockedUser.IsBlockingUser(Convert.ToInt32(mu.ProviderUserKey), su1.UserAccountID))
                            {
                                statups.Add(su1);
                            }
                        }

                        statups.IncludeStartAndEndTags = false;

                        context.Response.Write(@"{""StatusUpdates"": """ + HttpUtility.HtmlEncode(statups.ToUnorderdList) + @"""}");
                    }

                    #endregion
                    break;
                case SiteEnums.QueryStringNames.begin_playlist:
                    #region begin_playlist
                    context.Response.Write(
                       PlaylistVideo.GetFirstVideo(Convert.ToInt32(context.Request.QueryString[
                       SiteEnums.QueryStringNames.playlist.ToString()])));
                    #endregion
                    break;
                case SiteEnums.QueryStringNames.menu:
                    #region menu

                    mu = Membership.GetUser();

                    // menu updates

                    // get count in video room
                    int userCountChat = 0;

                    // get new mail
                    int userMessages = 0;

                    // get new users
                    int unconfirmedUsers = 0;

                    // status notifications
                    int notifications = 0;

                    if (mu != null)
                    {
                        // log off users who are offline

                        UserAccounts uasOffline = new UserAccounts();
                        uasOffline.GetWhoIsOffline(true);

                        UserAccount offlineUser = null;

                        foreach (UserAccount uaoff1 in uasOffline)
                        {
                            ChatRoomUser cru = new ChatRoomUser();
                            cru.GetChatRoomUserByUserAccountID(uaoff1.UserAccountID);

                            if (cru.ChatRoomUserID > 0)
                            {
                                cru.DeleteChatRoomUser();
                            }

                            offlineUser = new UserAccount(uaoff1.UserAccountID);
                            offlineUser.RemoveCache();
                        }

                        userCountChat = ChatRoomUsers.GetChattingUserCount();

                        userMessages = BootBaronLib.AppSpec.DasKlub.BOL.DirectMessages.GetDirectMessagesToUserCount(mu);
                        unconfirmedUsers = BootBaronLib.AppSpec.DasKlub.BOL.UserConnections.GetCountUnconfirmedConnections(Convert.ToInt32(mu.ProviderUserKey));
                    }

                    // get users online
                    int onlineUsers = UserAccounts.GetOnlineUserCount();

                    if (mu != null)
                    {
                        notifications = StatusUpdateNotifications.GetStatusUpdateNotificationCountForUser(Convert.ToInt32(mu.ProviderUserKey));
                    }

                    string timedMessge = string.Format(
            @"{{""UserCountChat"": ""{0}"",
               ""UserMessages"": ""{1}"",
               ""OnlineUsers"": ""{2}"",
               ""Notifications"": ""{3}"",
               ""UnconfirmedUsers"": ""{4}""}}",userCountChat,userMessages,onlineUsers,notifications,unconfirmedUsers);

                    context.Response.Write(timedMessge);

                    #endregion
                    break;
                case SiteEnums.QueryStringNames.random:
                    #region random
                    if (!string.IsNullOrEmpty(context.Request.QueryString[SiteEnums.QueryStringNames.currentvidid.ToString()]))
                    {
                        context.Response.Write(Video.GetRandomJSON(
                            context.Request.QueryString[SiteEnums.QueryStringNames.currentvidid.ToString()]));
                    }
                    else
                    {
                        context.Response.Write(Video.GetRandomJSON());
                    }

                    #endregion
                    break;
                case SiteEnums.QueryStringNames.video_playlist:
                    #region video_playlist
                    if (!string.IsNullOrEmpty(
               context.Request.QueryString[SiteEnums.QueryStringNames.currentvidid.ToString()]))
                    {
                        context.Response.Write(
                            PlaylistVideo.GetNextVideo(Convert.ToInt32(context.Request.QueryString[SiteEnums.QueryStringNames.playlist.ToString()]),
                            context.Request.QueryString[SiteEnums.QueryStringNames.currentvidid.ToString()]));
                    }
                    else if (!string.IsNullOrEmpty(context.Request.QueryString[SiteEnums.QueryStringNames.begin_playlist.ToString()]))
                    {
                        context.Response.Write(
                          PlaylistVideo.GetFirstVideo(Convert.ToInt32(context.Request.QueryString[SiteEnums.QueryStringNames.playlist.ToString()])));
                    }
                    else
                    {
                        context.Response.Write(
                            PlaylistVideo.CurrentVideoInPlaylist(
                            Convert.ToInt32(context.Request.QueryString[SiteEnums.QueryStringNames.playlist.ToString()])
                            ));
                    }
                    #endregion
                    break;
                case SiteEnums.QueryStringNames.video:
                    #region video
                    Video vid = new Video("YT", context.Request.QueryString[SiteEnums.QueryStringNames.vid.ToString()]);

                    VideoLog.AddVideoLog(vid.VideoID, context.Request.UserHostAddress);

                    context.Response.Write(Video.GetVideoJSON(context.Request.QueryString[SiteEnums.QueryStringNames.vid.ToString()]));
                    #endregion
                    break;
                case SiteEnums.QueryStringNames.begindate:
                    #region begindate

                    //string[] dates = HttpUtility.UrlDecode(
                    //    context.Request.QueryString[SiteEnums.QueryStringNames.begindate.ToString()]
                    //    ).Split('G');

                    DateTime dtBegin = Convert.ToDateTime(context.Request.QueryString[SiteEnums.QueryStringNames.begindate.ToString()]);

                    dtBegin = new DateTime(dtBegin.Year, dtBegin.Month, 1);

                    DateTime dtEnd = dtBegin.AddMonths(1).AddDays(-1);
                    Events tds = new Events();

                    tds.GetEventsForLocation(
                          dtBegin, dtEnd,
                          context.Request.QueryString[SiteEnums.QueryStringNames.country_iso.ToString()],
                          context.Request.QueryString[SiteEnums.QueryStringNames.region.ToString()],
                          context.Request.QueryString[SiteEnums.QueryStringNames.city.ToString()]);

                    CalendarItems citms = GetCitms(tds, dtBegin, dtEnd, true);

                    //[ 100, 500, 300, 200, 400 ]
                    sb = new StringBuilder();

                    sb.Append("[");

                    int processed = 1;

                    foreach (CalendarItem ci1 in citms)
                    {
                        if (processed == citms.Count)
                        {
                            sb.Append(ci1.StartDate.Day);
                        }
                        else
                        {
                            sb.Append(ci1.StartDate.Day);
                            sb.Append(", ");
                        }

                        processed++;
                    }

                    sb.Append("]");

                    context.Response.Write(sb.ToString());
                    #endregion
                    break;
                case SiteEnums.QueryStringNames.playlist:
                    #region playlist

                    if (!string.IsNullOrEmpty(
                    context.Request.QueryString[SiteEnums.QueryStringNames.currentvidid.ToString()]))
                    {
                        context.Response.Write(
                            PlaylistVideo.GetNextVideo(Convert.ToInt32(context.Request.QueryString[SiteEnums.QueryStringNames.playlist.ToString()]),
                            context.Request.QueryString[SiteEnums.QueryStringNames.currentvidid.ToString()]));
                    }
                    else if (!string.IsNullOrEmpty(context.Request.QueryString[SiteEnums.QueryStringNames.begin_playlist.ToString()]))
                    {
                        context.Response.Write(
                          PlaylistVideo.GetFirstVideo(Convert.ToInt32(context.Request.QueryString[SiteEnums.QueryStringNames.playlist.ToString()])));
                    }
                    else
                    {
                        context.Response.Write(
                            PlaylistVideo.CurrentVideoInPlaylist(
                            Convert.ToInt32(context.Request.QueryString[SiteEnums.QueryStringNames.playlist.ToString()])
                            ));
                    }
                    #endregion
                    break;
                default:
                    // ?
                    break;

            }
        }
示例#52
0
        public ActionResult Home(string message, HttpPostedFileBase file)
        {
            if (string.IsNullOrWhiteSpace(message) && file == null)
            {
                return RedirectToAction("Home");
            }

            if (message != null) message = message.Trim();

            if (_mu != null) _ua = new UserAccount(Convert.ToInt32(_mu.ProviderUserKey));

            if (_ua.UserAccountID ==  18136)
            {
                // check if over posting user can take a hint to stop
                var lastUpdate = new StatusUpdate();
                lastUpdate.GetMostRecentUserStatus(_ua.UserAccountID);

                if (lastUpdate.CreateDate > DateTime.UtcNow.AddHours(-24))
                {
                    TempData["user_error"] =
                        "Please STOP posting so much, you are only allowed to post once ever 24 hours! Thank you for keeping the wall clean.";

                    return RedirectToAction("Home");
                }
            }

            ViewBag.CurrentUser = _ua.ToUnorderdListItem;

            var su = new StatusUpdate();

            su.GetMostRecentUserStatus(_ua.UserAccountID);

            DateTime startTime = DateTime.UtcNow;

            TimeSpan span = startTime.Subtract(su.CreateDate);

            // TODO: this is not working properly, preventing posts
            if (su.Message == message && file == null)
            {
                // double post
                return RedirectToAction("Home");
            }
            su = new StatusUpdate();

            if (file != null && Utilities.IsImageFile(file.FileName))
            {
                var b = new Bitmap(file.InputStream);

                const CannedAcl acl = CannedAcl.PublicRead;

                var s3 = new S3Service
                {
                    AccessKeyID = AmazonCloudConfigs.AmazonAccessKey,
                    SecretAccessKey = AmazonCloudConfigs.AmazonSecretKey
                };

                var pitem = new PhotoItem {CreatedByUserID = _ua.UserAccountID, Title = message};

                Image fullPhoto = b;

                string fileNameFull = Utilities.CreateUniqueContentFilename(file);

                Stream maker = fullPhoto.ToAStream(ImageFormat.Jpeg);

                s3.AddObject(
                    maker,
                    maker.Length,
                    AmazonCloudConfigs.AmazonBucketName,
                    fileNameFull,
                    file.ContentType,
                    acl);

                pitem.FilePathRaw = fileNameFull;

                // resized
                Image photoResized = b;

                string fileNameResize = Utilities.CreateUniqueContentFilename(file);

                photoResized = ImageResize.FixedSize(photoResized, 500, 375, Color.Black);

                maker = photoResized.ToAStream(ImageFormat.Jpeg);

                s3.AddObject(
                    maker,
                    maker.Length,
                    AmazonCloudConfigs.AmazonBucketName,
                    fileNameResize,
                    file.ContentType,
                    acl);

                pitem.FilePathStandard = fileNameResize;

                // thumb
                Image thumbPhoto = b;

                thumbPhoto = ImageResize.Crop(thumbPhoto, 150, 150, ImageResize.AnchorPosition.Center);

                string fileNameThumb = Utilities.CreateUniqueContentFilename(file);

                maker = thumbPhoto.ToAStream(ImageFormat.Jpeg);

                s3.AddObject(
                    maker,
                    maker.Length,
                    AmazonCloudConfigs.AmazonBucketName,
                    fileNameThumb,
                    file.ContentType,
                    acl);

                pitem.FilePathThumb = fileNameThumb;

                pitem.Create();

                su.PhotoItemID = pitem.PhotoItemID;
            }

            su.UserAccountID = _ua.UserAccountID;
            su.Message = message;
            su.CreatedByUserID = _ua.UserAccountID;
            su.IsMobile = Request.Browser.IsMobileDevice;
            su.Create();

            if (Request.Browser.IsMobileDevice)
            {
                return new RedirectResult(Url.Action("Home") + "#most_recent");
            }
            return RedirectToAction("Home");
        }
示例#53
0
        public ActionResult Home(string message, HttpPostedFileBase file)
        {
            if (string.IsNullOrWhiteSpace(message) && file == null)
            {
                return RedirectToAction("Home");
            }

            message = message.Trim();

            mu = Membership.GetUser();

            ua = new UserAccount(Convert.ToInt32(mu.ProviderUserKey));
            //StatusUpdates sus = null;

            ViewBag.CurrentUser = ua.ToUnorderdListItem;

            StatusUpdate su = new StatusUpdate();

            su.GetMostRecentUserStatus(ua.UserAccountID);

            DateTime startTime = Utilities.GetDataBaseTime();

            TimeSpan span = startTime.Subtract(su.CreateDate);

            //su = new StatusUpdate();
            // TODO: this is not working properly, preventing posts
            if (su.Message == message && file == null)
            {
                // double post
                return RedirectToAction("Home");
            }
            else
            {
                su = new StatusUpdate();
            }

            if (file != null && Utilities.IsImageFile(file.FileName))
            {
                Bitmap b = new Bitmap(file.InputStream);

                var acl = CannedAcl.PublicRead;

                S3Service s3 = new S3Service();

                s3.AccessKeyID = AmazonCloudConfigs.AmazonAccessKey;
                s3.SecretAccessKey = AmazonCloudConfigs.AmazonSecretKey;

                PhotoItem pitem = new PhotoItem();

                pitem.CreatedByUserID = ua.UserAccountID;
                pitem.Title = message;

                // full
                System.Drawing.Image fullPhoto = (System.Drawing.Image)b;

                string fileNameFull = Utilities.CreateUniqueContentFilename(file);

                Stream maker = fullPhoto.ToAStream(ImageFormat.Jpeg);

                s3.AddObject(
                    maker,
                    maker.Length,
                    AmazonCloudConfigs.AmazonBucketName,
                    fileNameFull,
                    file.ContentType,
                    acl);

                pitem.FilePathRaw = fileNameFull;

                // resized
                System.Drawing.Image photoResized = (System.Drawing.Image)b;

                string fileNameResize = Utilities.CreateUniqueContentFilename(file);

                photoResized = ImageResize.FixedSize(photoResized, 500, 375, System.Drawing.Color.Black);

                maker = photoResized.ToAStream(ImageFormat.Jpeg);

                s3.AddObject(
                    maker,
                    maker.Length,
                    AmazonCloudConfigs.AmazonBucketName,
                    fileNameResize,
                    file.ContentType,
                    acl);

                pitem.FilePathStandard = fileNameResize;

                // thumb
                System.Drawing.Image thumbPhoto = (System.Drawing.Image)b;

                thumbPhoto = ImageResize.Crop(thumbPhoto, 150, 150, ImageResize.AnchorPosition.Center);

                string fileNameThumb = Utilities.CreateUniqueContentFilename(file);

                maker = thumbPhoto.ToAStream(ImageFormat.Jpeg);

                s3.AddObject(
                    maker,
                    maker.Length,
                    AmazonCloudConfigs.AmazonBucketName,
                    fileNameThumb,
                    file.ContentType,
                    acl);

                pitem.FilePathThumb = fileNameThumb;

                pitem.Create();

                su.PhotoItemID = pitem.PhotoItemID;
            }

            su.UserAccountID = ua.UserAccountID;
            su.Message = message;
            su.CreatedByUserID = ua.UserAccountID;
            su.IsMobile = Request.Browser.IsMobileDevice;
            su.Create();

            if (Request.Browser.IsMobileDevice)
            {
                // this will bring them to the post
                return new RedirectResult(Url.Action("Home") + "#most_recent");
            }
            else
            {
                // the menu prevents brining to post correctly
                return RedirectToAction("Home");
            }
        }
示例#54
0
        public void UpdateStatus(Guid client, UpdateType type, bool publishToLog, string message, params object[] args)
        {
            string formattedMessage = string.Format(message, args);

            if (publishToLog)
            {
                switch (type)
                {
                    case UpdateType.Information:
                        s_logStatusInfo.Publish(formattedMessage, client.ToString());
                        break;
                    case UpdateType.Warning:
                        s_logStatusWarning.Publish(formattedMessage, client.ToString());
                        break;
                    case UpdateType.Alarm:
                        s_logStatusAlarm.Publish(formattedMessage, client.ToString());
                        break;
                    default:
                        throw new ArgumentOutOfRangeException(nameof(type), type, null);
                }
            }

            const int HighPriority = 2;
            const int LowPriority = 1;
            StatusUpdate update;

            if (m_suppressUpdates)
                return;

            update = new StatusUpdate(client, type, formattedMessage);

            if (client != Guid.Empty)
                m_statusUpdateThread.Push(HighPriority, () => PrioritizeStatusUpdate(update));
            else
                m_statusUpdateThread.Push(LowPriority, () => QueueStatusUpdate(update));
        }
示例#55
0
        public ActionResult RotateStatusImage(int statusUpdateID)
        {
            mu = Membership.GetUser();

            StatusUpdate su = new StatusUpdate(statusUpdateID);

            if (su.PhotoItemID != null && su.PhotoItemID > 0)
            {
                var acl = CannedAcl.PublicRead;

                S3Service s3 = new S3Service();

                s3.AccessKeyID = AmazonCloudConfigs.AmazonAccessKey;
                s3.SecretAccessKey = AmazonCloudConfigs.AmazonSecretKey;

                PhotoItem pitm = new PhotoItem(Convert.ToInt32(su.PhotoItemID));

                // full
                Image imgFull = DownloadImage(Utilities.S3ContentPath(pitm.FilePathRaw));

                float angle = 90;

                Bitmap b = RotateImage(imgFull, angle);

                System.Drawing.Image fullPhoto = (System.Drawing.Image)b;

                string fileNameFull = Guid.NewGuid() + ".jpg";

                Stream maker = fullPhoto.ToAStream(ImageFormat.Jpeg);

                s3.AddObject(
                    maker,
                    maker.Length,
                    AmazonCloudConfigs.AmazonBucketName,
                    fileNameFull,
                    "image/jpg",
                    acl);

                if (s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathRaw))
                {
                    s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathRaw);
                }

                pitm.FilePathRaw = fileNameFull;

                // resized
                System.Drawing.Image photoResized = (System.Drawing.Image)b;

                string fileNameResize = Guid.NewGuid() + ".jpg";

                photoResized = ImageResize.FixedSize(photoResized, 500, 375, System.Drawing.Color.Black);

                maker = photoResized.ToAStream(ImageFormat.Jpeg);

                s3.AddObject(
                    maker,
                    maker.Length,
                    AmazonCloudConfigs.AmazonBucketName,
                    fileNameResize,
                    "image/jpg",
                    acl);

                if (s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathStandard))
                {
                    s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathStandard);
                }

                pitm.FilePathStandard = fileNameResize;

                // thumb
                System.Drawing.Image thumbPhoto = (System.Drawing.Image)b;

                thumbPhoto = ImageResize.Crop(thumbPhoto, 150, 150, ImageResize.AnchorPosition.Center);

                string fileNameThumb = Guid.NewGuid() + ".jpg";

                maker = thumbPhoto.ToAStream(ImageFormat.Jpeg);

                s3.AddObject(
                    maker,
                    maker.Length,
                    AmazonCloudConfigs.AmazonBucketName,
                    fileNameThumb,
                   "image/jpg",
                    acl);

                if (s3.ObjectExists(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathThumb))
                {
                    s3.DeleteObject(AmazonCloudConfigs.AmazonBucketName, pitm.FilePathThumb);
                }

                pitm.FilePathThumb = fileNameThumb;

                pitm.Update();

            }

            return RedirectToAction("statusupdate", new { @statusUpdateID = statusUpdateID });
        }
示例#56
0
            public bool PassesFilter(StatusUpdate update)
            {
                UpdateType updateType = update.Type;
                string message = update.Message;

                return TypeInclusionFilters.DefaultIfEmpty(update.Type).Any(type => type == updateType) &&
                       TypeExclusionFilters.All(type => type != updateType) &&
                       PatternInclusionFilters.DefaultIfEmpty("").Any(pattern => Regex.IsMatch(message, pattern, RegexOptions.IgnoreCase)) &&
                       PatternExclusionFilters.All(pattern => !Regex.IsMatch(message, pattern, RegexOptions.IgnoreCase));
            }
示例#57
0
        public ActionResult StatusUpdate(int statusUpdateID)
        {
            StatusUpdate su = new StatusUpdate(statusUpdateID);
            su.PhotoDisplay = false;

            StatusUpdates sus = new StatusUpdates();
            sus.Add(su);

            sus.IncludeStartAndEndTags = false;
            ViewBag.StatusUpdateList = @"<ul id=""status_update_list_items"">" + sus.ToUnorderdList + @"</ul>";

            return View(su);
        }
示例#58
0
        private void PrioritizeStatusUpdate(StatusUpdate update)
        {
            ClientStatusUpdateConfiguration clientConfig;

            if (m_clientStatusUpdateLookup.TryGetValue(update.Client, out clientConfig))
                clientConfig.PrioritizeUpdate(update);

            if (m_logStatusUpdates)
                m_statusLog.WriteTimestampedLine(update.Message);
        }
示例#59
0
        public long AddStatusUpdateAlert(StatusUpdate statusUpdate)
        {
            //alert = new Alert();
            //alert.CreateDate = DateTime.Now;
            //alert.AccountID = _userSession.CurrentUser.AccountID;
            //alert.AlertTypeID = (int)AlertType.AlertTypes.StatusUpdate;
            //alertMessage = "<div class=\"AlertHeader\">"
            //    + GetProfileImage(_userSession.CurrentUser.AccountID) + GetProfileUrl(_userSession.CurrentUser.Username) + " " + statusUpdate.Status + "</div>";
            //alert.Message = alertMessage;
            //SaveAlert(alert);
            //SendAlertToFriends(alert);

            Init();
            alert = new Alert();
            //alert.CreateDate = DateTime.Now;
            alert.AccountID = account.AccountID;
            alert.AlertTypeID = (int)AlertType.AlertTypes.StatusUpdate;
            alertMessage = statusUpdate.Status;
            alert.Message = GetProfileImage(account.AccountID) + "<div class='title'><h2>"
                + GetProfileUrl(account.Username) + "</h2></div>" + alertMessage;
            SaveAlert(alert);
            SendAlertToFriends(alert);
            return alert.AlertID;
        }
示例#60
0
        private void QueueStatusUpdate(StatusUpdate update)
        {
            const int HighPriority = 2;
            Action processAction;

            m_statusUpdateQueue.Add(update);

            if (m_logStatusUpdates)
                m_statusLog.WriteTimestampedLine(update.Message);

            if (m_queueCancellationToken == null)
            {
                processAction = () => m_statusUpdateThread.Push(HighPriority, ProcessStatusUpdates);
                m_queueCancellationToken = processAction.DelayAndExecute(250);
            }
        }