Exemplo n.º 1
0
        public override void LoadDataToGrid()
        {
            AppFuncs.WriteLogTraceMessage($" - {this.GetType().Name}.LoadDataToGrid()");

            _dataTable = DBContext.GetNoteTemplates();  // чтение данных о шаблонах сл.зап.
            base.LoadDataToGrid();

            AppFuncs.SetDGVColumnsFromDescr(_dataGrid, AppNoteTemplates.dgvColDescr);
        }
Exemplo n.º 2
0
        public override void LoadDataToGrid()
        {
            AppFuncs.WriteLogTraceMessage($" - {this.GetType().Name}.LoadDataToGrid()");
            //_dataTable = DBContext.GetNotes();  // чтение данных о сл.зап.

            // создать таблицу для отображения данных
            Dictionary <int, string> deps      = DBContext.GetDepartmentNamesDict();
            Dictionary <int, string> templates = DBContext.GetNoteTemplateNamesDict();

            _notesDataTable.Clear();
            // и заполнить таблицу
            foreach (Note note in _viewNotes)
            {
                string[] apvs = (note.Approvers ?? "").Split(';');

                DataRow row = _notesDataTable.NewRow();
                row["Id"]             = note.Id;
                row["TemplateName"]   = (templates.ContainsKey(note.Templates) ? templates[note.Templates] : null);
                row["DepartmentName"] = (deps.ContainsKey(note.IdDepartment) ? deps[note.IdDepartment] : null);
                row["DepartmentId"]   = note.IdDepartment;
                row["Date"]           = note.Date;
                row["ApprAvtor"]      = (note.ApprAvtor ? AppConst.DGVNotesApprYesText : AppConst.DGVNotesApprNoText);
                row["ApprDir"]        = (apvs.Contains("ApprDir") ? (note.ApprDir ? AppConst.DGVNotesApprYesText : AppConst.DGVNotesApprNoText) : AppConst.DGVNotesApprNoneText);
                row["ApprComdir"]     = (apvs.Contains("ApprComdir") ? (note.ApprComdir ? AppConst.DGVNotesApprYesText : AppConst.DGVNotesApprNoText) : AppConst.DGVNotesApprNoneText);
                row["ApprSBNach"]     = (apvs.Contains("ApprSBNach") ? (note.ApprSBNach ? AppConst.DGVNotesApprYesText : AppConst.DGVNotesApprNoText) : AppConst.DGVNotesApprNoneText);
                row["ApprSB"]         = (apvs.Contains("ApprSB") ? (note.ApprSB ? AppConst.DGVNotesApprYesText : AppConst.DGVNotesApprNoText) : AppConst.DGVNotesApprNoneText);
                row["ApprKasa"]       = (apvs.Contains("ApprKasa") ? (note.ApprKasa ? AppConst.DGVNotesApprYesText : AppConst.DGVNotesApprNoText) : AppConst.DGVNotesApprNoneText);
                row["ApprNach"]       = (apvs.Contains("ApprNach") ? (note.ApprNach ? AppConst.DGVNotesApprYesText : AppConst.DGVNotesApprNoText) : AppConst.DGVNotesApprNoneText);
                row["ApprFin"]        = (apvs.Contains("ApprFin") ? (note.ApprFin ? AppConst.DGVNotesApprYesText : AppConst.DGVNotesApprNoText) : "-");
                row["ApprDostavka"]   = (apvs.Contains("ApprDostavka") ? (note.ApprDostavka ? AppConst.DGVNotesApprYesText : AppConst.DGVNotesApprNoText) : AppConst.DGVNotesApprNoneText);
                row["ApprEnerg"]      = (apvs.Contains("ApprEnerg") ? (note.ApprEnerg ? AppConst.DGVNotesApprYesText : AppConst.DGVNotesApprNoText) : AppConst.DGVNotesApprNoneText);
                row["ApprSklad"]      = (apvs.Contains("ApprSklad") ? (note.ApprSklad ? AppConst.DGVNotesApprYesText : AppConst.DGVNotesApprNoText) : AppConst.DGVNotesApprNoneText);
                row["ApprBuh"]        = (apvs.Contains("ApprBuh") ? (note.ApprBuh ? AppConst.DGVNotesApprYesText : AppConst.DGVNotesApprNoText) : AppConst.DGVNotesApprNoneText);
                row["ApprASU"]        = (apvs.Contains("ApprASU") ? (note.ApprASU ? AppConst.DGVNotesApprYesText : AppConst.DGVNotesApprNoText) : AppConst.DGVNotesApprNoneText);
                row["ApprAll"]        = (note.ApprAll ? AppConst.DGVNotesApprYesText : AppConst.DGVNotesApprNoText);

                _notesDataTable.Rows.Add(row);
            }

            base.LoadDataToGrid();

            AppFuncs.SetDGVColumnsFromDescr(_dataGrid, AppNotes.dgvColDescr);
        }