Exemple #1
0
        private void RefreshCurrentNotes()
        {
            NoteManager noteManager = new NoteManager(SysConfigInfo.WebServerBaseAddr);
            Response <SearchNotesResponse> response = noteManager.SearchNotesByAuthorId(new SearchNotesByAuthorIdRequest()
            {
                AuthorId  = SysConfigInfo.OnlineUser.Id,
                PageIndex = this.index,
                PageSize  = this.PageSize
            },
                                                                                        new TokenCheckInfo()
            {
                Token   = SysConfigInfo.OnlineUser.Token,
                UserId  = SysConfigInfo.OnlineUser.Id,
                Version = SysConfigInfo.Version
            });

            if (response == null)
            {
                MessageBox.Show("找不到指定的服务!");
            }
            else
            {
                if (response.Code != 0 || response.ResponseData == null || !response.HasAccessed)
                {
                    MessageBox.Show(response.Description);
                    LogHelper.WriteLog(LogType.Info, this.GetType().ToString(), "RefreshCurrentNotes", response.Description);
                }
                else
                {
                    this.totalRows = response.ResponseData.TotalRows;
                    this.notes.Clear();

                    if (response.ResponseData.Notes != null)
                    {
                        foreach (Note note in response.ResponseData.Notes)
                        {
                            ListNoteUnit unit = new ListNoteUnit();
                            unit.Init(note);
                            this.notes.Add(unit);
                        }
                    }

                    this.ReloadNoteUnits();
                }
            }
        }
Exemple #2
0
        private void RefreshCurrentNotes()
        {
            NoteManager noteManager = new NoteManager(SysConfigInfo.WebServerBaseAddr);
            Response <SearchNotesResponse> response = null;

            if (this.titleRadioButton.Checked)
            {
                response = noteManager.SearchNotesByTitleAndAuthorId(new SearchNotesByKeyStrAndAuthorIdRequest()
                {
                    AuthorId  = SysConfigInfo.OnlineUser.Id,
                    KeyStr    = this.keystrTextBox.Text,
                    PageIndex = this.index,
                    PageSize  = this.PageSize
                },
                                                                     new TokenCheckInfo()
                {
                    Token   = SysConfigInfo.OnlineUser.Token,
                    UserId  = SysConfigInfo.OnlineUser.Id,
                    Version = SysConfigInfo.Version
                });
            }
            else if (this.remarkRadioButton.Checked)
            {
                response = noteManager.SearchNotesByRemarkAndAuthorId(new SearchNotesByKeyStrAndAuthorIdRequest()
                {
                    AuthorId  = SysConfigInfo.OnlineUser.Id,
                    KeyStr    = this.keystrTextBox.Text,
                    PageIndex = this.index,
                    PageSize  = this.PageSize
                },
                                                                      new TokenCheckInfo()
                {
                    Token   = SysConfigInfo.OnlineUser.Token,
                    UserId  = SysConfigInfo.OnlineUser.Id,
                    Version = SysConfigInfo.Version
                });
            }
            else
            {
                response = noteManager.SearchNotesByTimeSpanAndAuthorId(new SearchNotesByTimeSpanAndAuthorIdRequest()
                {
                    AuthorId  = SysConfigInfo.OnlineUser.Id,
                    StartTime = this.startDateTimePicker.Value,
                    EndTime   = this.endDateTimePicker.Value,
                    PageIndex = this.index,
                    PageSize  = this.PageSize
                },
                                                                        new TokenCheckInfo()
                {
                    Token   = SysConfigInfo.OnlineUser.Token,
                    UserId  = SysConfigInfo.OnlineUser.Id,
                    Version = SysConfigInfo.Version
                });
            }

            if (response == null)
            {
                MessageBox.Show("找不到指定的服务!");
            }
            else
            {
                if (response.Code != 0 || response.ResponseData == null || !response.HasAccessed)
                {
                    MessageBox.Show(response.Description);
                    LogHelper.WriteLog(LogType.Info, this.GetType().ToString(), "RefreshCurrentNotes", response.Description);
                }
                else
                {
                    this.totalRows = response.ResponseData.TotalRows;
                    this.notes.Clear();

                    if (response.ResponseData.Notes != null)
                    {
                        foreach (Note note in response.ResponseData.Notes)
                        {
                            ListNoteUnit unit = new ListNoteUnit();
                            unit.Init(note);
                            this.notes.Add(unit);
                        }
                    }

                    this.ReloadNoteUnits();
                }
            }
        }