コード例 #1
0
ファイル: DoingBO.cs プロジェクト: zhangbo27/bbsmax
        /**************************************
        *      Delete开头的函数删除数据      *
        **************************************/

        /// <summary>
        /// 删除记录
        /// </summary>
        /// <param name="operatorID">操作者ID</param>
        /// <param name="doingID">所要删除的记录ID</param>
        public bool DeleteDoing(int operatorID, int doingID)
        {
            if (ValidateUserID(operatorID) == false)
            {
                return(false);
            }

            Doing doing = DoingBO.Instance.GetDoing(doingID);

            if (ValidateDoingDeletePermission(operatorID, doing) == false)
            {
                return(false);
            }

            DoingDao.Instance.DeleteDoing(doingID);

            ClearCachedEveryoneData();

            ClearCachedUserData(doing.UserID);

            FeedBO.Instance.DeleteFeed(AppActionType.UpdateDoing, doing.UserID);

            Logs.LogManager.LogOperation(
                new Doing_DeleteDoing(
                    operatorID,
                    UserBO.Instance.GetUser(operatorID).Name,
                    IPUtil.GetCurrentIP(),
                    doingID,
                    doing.UserID,
                    UserBO.Instance.GetUser(doing.UserID).Name
                    )
                );

            return(true);
        }
コード例 #2
0
        public void RefreshMainWindow()
        {
            ToDo.Clear();
            Doing.Clear();
            Backlog.Clear();
            Done.Clear();

            var result = readDbDataToDisplay();

            foreach (var i in result)
            {
                if (i.States == BackLog.State.IsToDo)
                {
                    ToDo.Add(i);
                }
                else if (i.States == BackLog.State.IsDoing)
                {
                    Doing.Add(i);
                }
                else if (i.States == BackLog.State.Backlog)
                {
                    Backlog.Add(i);
                }
                else
                {
                    Done.Add(i);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Execution of new scrum that will dete tasks from Done, and put all current task to BackLog.
        /// </summary>
        public void NewScrumCommandExecute()
        {
            foreach (var i in Done)
            {
                DeleteTask(i);
            }

            Done.Clear();

            foreach (var i in Doing)
            {
                i.States = BackLog.State.Backlog;
                PutTask(i);
                Backlog.Add(i);
            }
            foreach (var i in ToDo)
            {
                i.States = BackLog.State.Backlog;
                PutTask(i);
                Backlog.Add(i);
            }

            Doing.Clear();
            ToDo.Clear();
        }
コード例 #4
0
        public MainPageViewModel()
        {
            MessagingCenter.Subscribe <string>(this, "ExecuteAction", (actionToExecute) =>
            {
                switch (actionToExecute)
                {
                case "Clean":
                    ToDo.Clear();
                    Doing.Clear();
                    Done.Clear();
                    break;

                case "Reset":
                    break;

                case "OtherPage":
                case "AboutPage":
                    navigationService.Navigate(actionToExecute);
                    break;
                }
            });

            navigationService = new NavigationService();
            apiService        = new ApiService();

            ToDo  = new ObservableCollection <TaskItemViewModel>();
            Doing = new ObservableCollection <TaskItemViewModel>();
            Done  = new ObservableCollection <TaskItemViewModel>();

            LoadTasks();
        }
コード例 #5
0
        private async Task LoadTasks()
        {
            var result = await apiService.GetAllTasks();

            if (result.HttpResponse.IsSuccessStatusCode)
            {
                foreach (var item in result.Data)
                {
                    switch (item.Status)
                    {
                    case 0:
                        ToDo.Add(ViewModelHelper.Get(item));
                        break;

                    case 1:
                        Doing.Add(ViewModelHelper.Get(item));
                        break;

                    case 2:
                        Done.Add(ViewModelHelper.Get(item));
                        break;
                    }
                }
            }
        }
コード例 #6
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var formatter = new BinaryFormatter();

            switch (ActionId)
            {
            case ActionName.Doing:
                var DoingClass = new Doing(Time.SelectedDate.Value, ActionNameText.Text);

                using (var fs = new FileStream(FileName, FileMode.OpenOrCreate))
                {
                    formatter.Serialize(fs, DoingClass);
                }
                break;

            case ActionName.NeedToDo:
                var NeedToDoClass = new NeedToDo(Time.SelectedDate.Value, ActionNameText.Text);

                using (var fs = new FileStream(FileName, FileMode.OpenOrCreate))
                {
                    formatter.Serialize(fs, NeedToDoClass);
                }
                break;

            case ActionName.Done:
                var DoneClass = new Done(Time.SelectedDate.Value, ActionNameText.Text);

                using (var fs = new FileStream(FileName, FileMode.OpenOrCreate))
                {
                    formatter.Serialize(fs, DoneClass);
                }
                break;
            }
        }
コード例 #7
0
        internal async Task RefreshTasks()
        {
            ToDo.Clear();
            Doing.Clear();
            Done.Clear();

            await LoadTasks();
        }
コード例 #8
0
        private IEnumerable <CardName> getStartedInPeriod()
        {
            var prev = Previous() as PeriodCardsStatus;

            return(prev == null
                ? (IEnumerable <CardName>) new CardName[0]
                : Doing.Where(card => !prev.Doing.Contains(card)).ToList());
        }
コード例 #9
0
ファイル: DoingBO.cs プロジェクト: zhangbo27/bbsmax
        public Doing GetDoing(int doingID)
        {
            Doing result = DoingDao.Instance.GetDoing(doingID);

            ProcessKeyword(result, ProcessKeywordMode.TryUpdateKeyword);

            return(result);
        }
コード例 #10
0
 private void RingAndFlash()
 {
     this.FlashWindow(5);
     _shakeStoryBoard.Begin(this, true);
     _doing = Doing.Ringing;
     ActionButtonText.Text = Properties.Resources.MainWindow_TimerTick_Stop_Ringing_;
     _timer.Stop();
     Player.Play();
 }
コード例 #11
0
        private void StartTimer()
        {
            MinutesTextBox.IsReadOnly = true;
            ActionButtonText.Text     = Properties.Resources.MainWindow_CreateJumpList_Stop_Timer;
            _doing      = Doing.Started;
            WindowState = WindowState.Minimized;
            _thumbnailToolBarButton.Icon    = _stopicon;
            _thumbnailToolBarButton.Tooltip = "Stop";

            _timer.Start();
        }
コード例 #12
0
ファイル: DoingBO.cs プロジェクト: zhangbo27/bbsmax
        /// <summary>
        /// 验证操作者是否具有删除某条记录的全新
        /// </summary>
        /// <param name="operatorID">操作者ID</param>
        /// <param name="doing">所要删除的Doing</param>
        /// <returns>具有删除权限就返回true,否则返回false</returns>
        private bool ValidateDoingDeletePermission(int operatorID, Doing doing)
        {
            if (CheckDoingDeletePermission(operatorID, doing))
            {
                return(true);
            }

            ThrowError(new NoPermissionDeleteDoingError());

            return(false);
        }
コード例 #13
0
        private void StopRinging()
        {
            _thumbnailToolBarButton.Icon    = _starticon;
            _thumbnailToolBarButton.Tooltip = "Start";

            _shakeStoryBoard.Stop(this);
            this.StopFlashingWindow();
            TaskbarItemInfo.Overlay   = CreateTaskbarIconOverlayImage("");  //remove the minutes from the icon, stupid to show 0
            MinutesTextBox.IsReadOnly = false;
            Player.Stop();
            ActionButtonText.Text = Properties.Resources.MainWindow_CreateJumpList_Start_New_Session;
            _doing = Doing.Done;
        }
コード例 #14
0
ファイル: index.aspx.cs プロジェクト: zhangbo27/bbsmax
        protected bool IsShowCommentPager(Doing doing)
        {
            if (doing.DoingID != CommentListTargetID)
            {
                return(false);
            }

            if (doing.TotalComments > CommentPageSize)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #15
0
ファイル: index.aspx.cs プロジェクト: zhangbo27/bbsmax
        protected bool IsShowGetAll(Doing doing)
        {
            if (doing.DoingID != CommentListTargetID)
            {
                if (doing.TotalComments > 2)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            return(false);
        }
コード例 #16
0
        public void Set(TrelloCard card, CardStatus status, bool propagateToNext = false)
        {
            if (!BoardAnalysis.Cards.Contains(card))
            {
                BoardAnalysis.Cards.Add(card);
            }
            switch (status)
            {
            case CardStatus.Other:
                if (Other.Contains(card))
                {
                    break;
                }

                Other.Add(card);
                removeFrom(card, Doing, Done);
                break;

            case CardStatus.Doing:
                if (Doing.Contains(card))
                {
                    break;
                }

                Doing.Add(card);
                removeFrom(card, Done, Other);
                break;

            case CardStatus.Done:
                if (Done.Contains(card))
                {
                    break;
                }

                Done.Add(card);
                removeFrom(card, Other, Doing);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(status), status, null);
            }
            if (propagateToNext)
            {
                ((PeriodCardsStatus)Next(false))?.Set(card, status);
            }
        }
コード例 #17
0
ファイル: DoingBO.cs プロジェクト: zhangbo27/bbsmax
        private void ProcessKeyword(Doing doing, ProcessKeywordMode mode)
        {
            //更新关键字模式,如果这个记录并不需要处理,直接退出
            if (mode == ProcessKeywordMode.TryUpdateKeyword)
            {
                if (AllSettings.Current.ContentKeywordSettings.ReplaceKeywords.NeedUpdate <Doing>(doing) == false)
                {
                    return;
                }
            }

            DoingCollection doings = new DoingCollection();

            doings.Add(doing);

            ProcessKeyword(doings, mode);
        }
コード例 #18
0
        public MainWindow()
        {
            InitializeComponent();

            _doing = Doing.Stopped;
            _timer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(1)
            };
            _timer.Tick        += TimerTick;
            _seconds            = Settings.Default.SessionLength * 60;
            MinutesTextBox.Text = Minutes + " " + Properties.Resources.MainWindow_TimerTick_minutes;

            MinutesTextBox.GotFocus  += OnMinutesTextBoxOnGotFocus;
            MinutesTextBox.LostFocus += OnMinutesTextBoxOnLostFocus;
            MinutesTextBox.KeyDown   += MinutesTextBoxOnKeyDown;

            Player.MediaEnded += (s, e) => RepeatRinging();
        }
コード例 #19
0
        private void StopTimer()
        {
            if (_doing == Doing.Ringing)
            {
                StopRinging();
                return;
            }

            _thumbnailToolBarButton.Icon    = _starticon;
            _thumbnailToolBarButton.Tooltip = "Start";

            MinutesTextBox.IsReadOnly = false;
            _timer.Stop();

            TaskbarItemInfo.Overlay = CreateTaskbarIconOverlayImage("(" + Minutes + ")");
            ActionButtonText.Text   = Properties.Resources.MainWindow_CreateJumpList_Start_Timer;
            _doing = Doing.Stopped;
        }
コード例 #20
0
 /// <summary>
 /// Method that will refresh all the data in the view. Specifically it will add a backlog item to the new correct Observable list
 /// This is called from the edit Command, so we after deleted the item from the prvious view, add it to the new view.
 /// </summary>
 /// <param name="item">Specific item you want to change to a new listbox in the view</param>
 public void RefreshMainWindow(BackLog item)
 {
     if (item.States == BackLog.State.IsToDo)
     {
         ToDo.Add(item);
     }
     else if (item.States == BackLog.State.IsDoing)
     {
         Doing.Add(item);
     }
     else if (item.States == BackLog.State.Backlog)
     {
         Backlog.Add(item);
     }
     else
     {
         Done.Add(item);
     }
 }
コード例 #21
0
ファイル: index.aspx.cs プロジェクト: zhangbo27/bbsmax
        protected CommentCollection GetComments(Doing doing)
        {
            if (CommentListTargetID != doing.DoingID)
            {
                return(doing.CommentList);
            }

            if (doingComments == null)
            {
                int count;
                doingComments = CommentBO.Instance.GetComments(doing.DoingID, CommentType.Doing, CommentListPageNumber, CommentPageSize, false, out count);

                FillSimpleUsers <Comment>(doingComments);

                SetPager("commentlist", null, CommentListPageNumber, CommentPageSize, count);
            }

            return(doingComments);
        }
コード例 #22
0
        /// <summary>
        /// Ctor. Need to read all data from WebAPI (Database), and populate the above ObservableCollections.
        /// These bind to 4 different listbox in View.
        /// </summary>
        public BackLogController()
        {
            if (_client.BaseAddress == null)
            {
                _client.BaseAddress = new Uri("http://localhost:4200/");

                _client.DefaultRequestHeaders.Accept.Clear();
                _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            }

            var result = readDbDataToDisplay();

            foreach (var i in result)
            {
                if (i.States == BackLog.State.IsToDo)
                {
                    ToDo.Add(i);
                }
                else if (i.States == BackLog.State.IsDoing)
                {
                    Doing.Add(i);
                }
                else if (i.States == BackLog.State.Backlog)
                {
                    Backlog.Add(i);
                }
                else
                {
                    Done.Add(i);
                }
            }

            //Here I read settings file for background color of main window.
            string color = Properties.Settings.Default.Color;
            var    brush = new SolidColorBrush((Color)ColorConverter.ConvertFromString(color));

            BackgroundColor = brush;

            NotifyPropertyChanged();

            UpdateChart();
        }
コード例 #23
0
ファイル: doing-delete.aspx.cs プロジェクト: zhangbo27/bbsmax
        protected void Page_Load(object sender, EventArgs e)
        {
            if (_Request.IsClick("delete"))
            {
                doingID = _Request.Get <int>("id", Method.Get);

                if (doingID.HasValue == false)
                {
                    ShowError("缺少必要参数");
                }

                Doing doing = DoingBO.Instance.GetDoingForDelete(MyUserID, doingID.Value);

                if (doing == null)
                {
                    ShowError("您要删除的记录不存在");
                }

                Delete();
            }
        }
コード例 #24
0
ファイル: DoingBO.cs プロジェクト: zhangbo27/bbsmax
        public Doing GetDoingForDelete(int operatorID, int doingID)
        {
            if (ValidateUserID(operatorID) == false)
            {
                return(null);
            }

            Doing doing = DoingDao.Instance.GetDoing(doingID);

            if (doing == null)
            {
                return(null);
            }

            if (ValidateDoingDeletePermission(operatorID, doing) == false)
            {
                return(null);
            }

            return(doing);
        }
コード例 #25
0
        public override RevertableCollection <Doing> GetDoingsWithReverters(IEnumerable <int> doingIDs)
        {
            if (ValidateUtil.HasItems(doingIDs) == false)
            {
                return(null);
            }

            RevertableCollection <Doing> doings = new RevertableCollection <Doing>();

            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = @"
SELECT 
	A.*,
	ContentReverter = ISNULL(R.ContentReverter, '')
FROM 
	bx_Doings A WITH(NOLOCK)
LEFT JOIN 
	bx_DoingReverters R WITH(NOLOCK) ON R.DoingID = A.DoingID
WHERE 
	A.DoingID IN (@DoingIDs)"    ;

                query.CreateInParameter <int>("@DoingIDs", doingIDs);

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        string contentReverter = reader.Get <string>("ContentReverter");

                        Doing doing = new Doing(reader);

                        doings.Add(doing, contentReverter);
                    }
                }
            }

            return(doings);
        }
コード例 #26
0
        private void SplitTask()
        {
            Debug.WriteLine($"Number of items in Task: {Task.Count}");
            foreach (var task in Task)
            {
                switch (task.Progress)
                {
                case Progress.ToDo:
                    ToDo.Add(task);
                    break;

                case Progress.Doing:
                    Doing.Add(task);
                    break;

                case Progress.Done:
                    Done.Add(task);
                    break;

                default:
                    break;
                }
            }
        }
コード例 #27
0
        /// <summary>
        /// The edit execute command. This will be called from mainwindow code behind, since it is a double click method.
        /// </summary>
        /// <param name="name">A string that define which Listbox the method was called from</param>
        public void ViewDetails(string name)
        {
            var     dlg    = new EditView();
            BackLog toEdit = new BackLog();

            //Each switch case will open a window see above, and will set the datacontext of the view to the current selected object in the specified listbox
            //When this window is succesfully completed, it will sync the possible new data with the database, and remove it from the possible old list.
            //After this it wil add it to the possible new list (if we have changed status or not).
            switch (name)
            {
            case "Backlog":
                toEdit          = Backlog[BackLogCurrentIndex];
                dlg.DataContext = toEdit;

                if (dlg.ShowDialog() == true)
                {
                    PutTask(toEdit);
                    Backlog.Remove(toEdit);
                    RefreshMainWindow(toEdit);
                }
                break;

            case "IsToDo":
                toEdit          = ToDo[ToDoCurrentIndex];
                dlg.DataContext = toEdit;

                if (dlg.ShowDialog() == true)
                {
                    PutTask(toEdit);
                    ToDo.Remove(toEdit);
                    RefreshMainWindow(toEdit);
                }
                break;

            case "Doing":
                toEdit          = Doing[DoingCurrentIndex];
                dlg.DataContext = toEdit;

                if (dlg.ShowDialog() == true)
                {
                    PutTask(toEdit);
                    Doing.Remove(toEdit);
                    RefreshMainWindow(toEdit);
                }
                break;

            case "Done":
                toEdit          = Done[DoneCurrentIndex];
                dlg.DataContext = toEdit;

                if (dlg.ShowDialog() == true)
                {
                    PutTask(toEdit);
                    Done.Remove(toEdit);
                    RefreshMainWindow(toEdit);
                }
                break;

            default:
                break;
            }
            UpdateChart();
        }
コード例 #28
0
ファイル: DoingDao.cs プロジェクト: huchao007/bbsmax
        public override RevertableCollection<Doing> GetDoingsWithReverters(IEnumerable<int> doingIDs)
        {
            if (ValidateUtil.HasItems(doingIDs) == false)
                return null;

            RevertableCollection<Doing> doings = new RevertableCollection<Doing>();

            using (SqlQuery query = new SqlQuery())
            {
                query.CommandText = @"
SELECT 
	A.*,
	ContentReverter = ISNULL(R.ContentReverter, '')
FROM 
	bx_Doings A WITH(NOLOCK)
LEFT JOIN 
	bx_DoingReverters R WITH(NOLOCK) ON R.DoingID = A.DoingID
WHERE 
	A.DoingID IN (@DoingIDs)";

                query.CreateInParameter<int>("@DoingIDs", doingIDs);

                using (XSqlDataReader reader = query.ExecuteReader())
                {

                    while (reader.Read())
                    {
                        string contentReverter = reader.Get<string>("ContentReverter");

                        Doing doing = new Doing(reader);

                        doings.Add(doing, contentReverter);
                    }
                }
            }

            return doings;
        }
コード例 #29
0
ファイル: index.aspx.cs プロジェクト: huchao007/bbsmax
        protected CommentCollection GetComments(Doing doing)
        {
            if (CommentListTargetID != doing.DoingID)
                return doing.CommentList;

            if (doingComments == null)
            {
                int count;
                doingComments = CommentBO.Instance.GetComments(doing.DoingID, CommentType.Doing, CommentListPageNumber, CommentPageSize, false, out count);

                FillSimpleUsers<Comment>(doingComments);

                SetPager("commentlist", null, CommentListPageNumber, CommentPageSize, count);
            }

            return doingComments;
        }
コード例 #30
0
ファイル: index.aspx.cs プロジェクト: huchao007/bbsmax
        protected bool IsShowGetAll(Doing doing)
        {
            if (doing.DoingID != CommentListTargetID)
            {
                if (doing.TotalComments > 2)
                    return true;
                else
                    return false;
            }

            return false;
        }
コード例 #31
0
ファイル: index.aspx.cs プロジェクト: huchao007/bbsmax
        protected bool IsShowCommentPager(Doing doing)
        {
            if (doing.DoingID != CommentListTargetID)
            {
                return false;
            }

            if (doing.TotalComments > CommentPageSize)
                return true;
            else
                return false;
        }
コード例 #32
0
		/// <summary>
		/// Do something
		/// </summary>
		/// <param name="what">What to do</param>
		private void Do(Doing what)
		{
			_doing = what;

			if (DoingSomething != null)
				DoingSomething(this, what);
		}
コード例 #33
0
ファイル: DoingBO.cs プロジェクト: zhangbo27/bbsmax
        /**************************************
        *    Check开头的函数只检查不抛错     *
        **************************************/

        /// <summary>
        /// 验证操作者是否具有删除某条记录的全新
        /// </summary>
        /// <param name="operatorID">操作者ID</param>
        /// <param name="doing">所要删除的Doing</param>
        /// <returns>具有删除权限就返回true,否则返回false</returns>
        public bool CheckDoingDeletePermission(int operatorID, Doing doing)
        {
            return(doing != null && CheckDeletePermission(operatorID, doing.UserID));
        }
コード例 #34
0
        private void FillDoingComments(DoingCollection doings, SqlSession db)
        {
            if (doings.Count == 0)
            {
                return;
            }

            List <int> minIds = new List <int>();
            List <int> maxIds = new List <int>();

            for (int i = 0; i < doings.Count; i++)
            {
                if (doings[i].TotalComments == 0)
                {
                    continue;
                }
                else if (doings[i].TotalComments == 1)
                {
                    minIds.Add(doings[i].DoingID);
                }
                else
                {
                    minIds.Add(doings[i].DoingID);
                    maxIds.Add(doings[i].DoingID);
                }
            }

            if (minIds.Count == 0)
            {
                return;
            }

            using (SqlQuery query = db.CreateQuery())
            {
                query.CommandText = @"
SELECT * FROM bx_Comments WHERE CommentID IN(
    SELECT Min(CommentID) FROM [bx_Comments] WHERE [Type]=3 AND IsApproved = 1 AND [TargetID] IN(@MinTargetIDs) GROUP BY TargetID
);
";
                if (maxIds.Count > 0)
                {
                    query.CommandText += @"
SELECT * FROM bx_Comments WHERE CommentID IN(
    SELECT Max(CommentID) FROM [bx_Comments] WHERE [Type]=3 AND IsApproved = 1 AND [TargetID] IN(@MaxTargetIDs) GROUP BY TargetID
);
";
                }

                query.CreateInParameter <int>("@MinTargetIDs", minIds);
                query.CreateInParameter <int>("@MaxTargetIDs", maxIds);

                using (XSqlDataReader reader = query.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        Comment comment = new Comment(reader);
                        Doing   doing   = doings.GetValue(comment.TargetID);
                        if (doing != null)
                        {
                            if (doing.CommentList.ContainsKey(comment.CommentID) == false)
                            {
                                doing.CommentList.Add(comment);
                            }
                        }
                    }
                    if (reader.NextResult())
                    {
                        while (reader.Read())
                        {
                            Comment comment = new Comment(reader);
                            Doing   doing   = doings.GetValue(comment.TargetID);
                            if (doing != null)
                            {
                                if (doing.CommentList.ContainsKey(comment.CommentID) == false)
                                {
                                    doing.CommentList.Add(comment);
                                }
                            }
                        }
                    }
                }
            }

            db.Connection.Close();

            //Doing doing = null;
            //int lastDoingID = -1;

            //for (int i = 0; i < comments.Count; i++)
            //{
            //    int doingID = comments[i].TargetID;

            //    if (doingID != lastDoingID)
            //    {
            //        doing = doings.GetValue(doingID);

            //        lastDoingID = doingID;
            //    }

            //    doing.CommentList.Add(comments[i]);
            //}
        }
コード例 #35
0
        private void Start()
        {
            Doing.Invoke();

            // Пример в паттерне команда класс DoNothing
        }