Esempio n. 1
0
        protected override void InitLayout()
        {
            base.InitLayout();
            if (ParentForm == null)
            {
                return;
            }
            ParentForm.KeyPreview = false;

            txtSearchKey.KeyDown += (sender, e) => control_KeyDown(sender, e);

            ParentForm.Load += (sender, e) => {
                var tasks = new List <Task> {
                    LoadApplicationControlAsync(),
                    LoadCompanyAsync(),
                    LoadControlColorAsync(),
                    Task.Run(async() => SectionsAll           = await GetSectionsAsync()),
                    Task.Run(async() => SectionsWithLoginUser = await GetSectionsWithLoginUserAsync())
                };
                ProgressDialog.Start(ParentForm, Task.WhenAll(tasks), false, SessionKey);
            };
            ParentForm.Shown += (sender, ea) =>
            {
                grdSearch.Template   = CreateGridTemplate();
                grdSearch.DataSource = new BindingSource(SectionsAll, null);
                if (AllSection)
                {
                    SetCheckState(check: 1);
                }
                else
                {
                    var ids = InitialIds.Any()
                        ? InitialIds
                        : new List <int>(SectionsWithLoginUser.Select(x => x.Id));
                    SetCheckState(check: 1, filter: x => ids.Contains(x.Id));
                }
                InitialIds = GetCheckedIds();
                SortGridData();
                grdSearch.CurrentCellDirtyStateChanged += (_, __) => grdSearch.CommitEdit(GrapeCity.Win.MultiRow.DataErrorContexts.Commit);
            };
        }
Esempio n. 2
0
 private void InitializeSectionSelection()
 {
     if (SectionsWithLoginUser.Count == 0)
     {
         lblSectionName.Text = "すべて";
         SectionIds          = Sections.Select(item => item.Id).ToList();
     }
     else
     {
         if (Sections.Count == SectionsWithLoginUser.Count)
         {
             lblSectionName.Text = "すべて";
         }
         else if (SectionsWithLoginUser.Count == 1)
         {
             lblSectionName.Text = SectionsWithLoginUser.First().Name;
         }
         else
         {
             lblSectionName.Text = "入金部門絞込有";
         }
         SectionIds = SectionsWithLoginUser.Select(x => x.Id).ToList();
     }
 }