Exemple #1
0
 private void FillGrid()
 {
     if (_listLogs == null)
     {
         Cursor    = Cursors.WaitCursor;
         _listLogs = InsEditLogs.GetLogsForPlan(_insPlan.PlanNum, _insPlan.CarrierNum, _insPlan.EmployerNum);
         TranslateBeforeAndAfter();
         Cursor = Cursors.Default;
     }
     gridMain.BeginUpdate();
     gridMain.Columns.Clear();
     gridMain.Columns.Add(new ODGridColumn("", 25));            //for the drop down arrows.
     gridMain.Columns.Add(new ODGridColumn("Log Date", 135));
     gridMain.Columns.Add(new ODGridColumn("User", 100));
     gridMain.Columns.Add(new ODGridColumn("Table", 100));
     gridMain.Columns.Add(new ODGridColumn("Key", 55));
     gridMain.Columns.Add(new ODGridColumn("Description", 150));
     gridMain.Columns.Add(new ODGridColumn("Field", 110));
     gridMain.Columns.Add(new ODGridColumn("Before", 150));
     gridMain.Columns.Add(new ODGridColumn("After", 150));
     gridMain.Rows.Clear();
     ConstructGridRows().ForEach(x => { gridMain.Rows.Add(x); });
     gridMain.EndUpdate();
 }
Exemple #2
0
        ///<summary>Actually creates the GridRows and returns them in a list. Takes care of linking dropdown rows.</summary>
        private List <ODGridRow> ConstructGridRows(bool refreshFromDb)
        {
            if (_listLogs == null || refreshFromDb)
            {
                _listLogs = InsEditLogs.GetLogsForPlan(_insPlan.PlanNum, _insPlan.CarrierNum, _insPlan.EmployerNum, PIn.Date(textDateFrom.Text), PIn.Date(textDateTo.Text));
            }
            ODGridRow                 row;
            List <ODGridRow>          listRows  = new List <ODGridRow>();
            Dictionary <long, Userod> dictUsers = Userods.GetDeepCopy().ToDictionary(x => x.UserNum, x => x);

            TranslateBeforeAndAfter();
            foreach (InsEditLog logCur in _listLogs)
            {
                row = new ODGridRow();
                row.Cells.Add("");
                row.Cells.Add(logCur.DateTStamp.ToString());
                row.Cells.Add(dictUsers[logCur.UserNum].UserName);
                row.Cells.Add(logCur.LogType.ToString());
                row.Cells.Add(logCur.FKey.ToString());
                row.Cells.Add(logCur.Description);
                row.Cells.Add(logCur.FieldName);
                row.Cells.Add(logCur.OldValue);
                row.Cells.Add(logCur.NewValue);
                row.Tag = logCur;
                listRows.Add(row);
            }
            //link drop down rows to drop down parents.
            listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Benefit &&
                           ((InsEditLog)x.Tag).FieldName == "BenefitNum" &&
                           ((InsEditLog)x.Tag).NewValue == "DELETED").ToList()
            .ForEach(y => {
                y.DropDownState = ODGridDropDownState.Up;
                listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Benefit &&
                               ((InsEditLog)x.Tag).FieldName != "BenefitNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey &&
                               ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => {
                    x.DropDownParent = y;
                });
            });
            listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Carrier &&
                           ((InsEditLog)x.Tag).FieldName == "CarrierNum" &&
                           ((InsEditLog)x.Tag).NewValue == "DELETED").ToList()
            .ForEach(y => {
                y.DropDownState = ODGridDropDownState.Up;
                listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Carrier &&
                               ((InsEditLog)x.Tag).FieldName != "CarrierNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey &&
                               ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => {
                    x.DropDownParent = y;
                });
            });
            listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Employer &&
                           ((InsEditLog)x.Tag).FieldName == "EmployerNum" &&
                           ((InsEditLog)x.Tag).NewValue == "DELETED").ToList()
            .ForEach(y => {
                y.DropDownState = ODGridDropDownState.Up;
                listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.Employer &&
                               ((InsEditLog)x.Tag).FieldName != "EmployerNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey &&
                               ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => {
                    x.DropDownParent = y;
                });
            });
            listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.InsPlan &&
                           ((InsEditLog)x.Tag).FieldName == "PlanNum" &&
                           ((InsEditLog)x.Tag).NewValue == "DELETED").ToList()
            .ForEach(y => {
                y.DropDownState = ODGridDropDownState.Up;
                listRows.Where(x => ((InsEditLog)x.Tag).LogType == InsEditLogType.InsPlan &&
                               ((InsEditLog)x.Tag).FieldName != "PlanNum" && ((InsEditLog)x.Tag).FKey == ((InsEditLog)y.Tag).FKey &&
                               ((InsEditLog)x.Tag).NewValue == "DELETED").ToList().ForEach(x => {
                    x.DropDownParent = y;
                });
            });
            return(listRows);
        }