Exemplo n.º 1
0
 public static void PostGetListAction(DataRow inputrow, DataTable dataTable, DataObjectStore store)
 {
     foreach (object obj in dataTable.Rows)
     {
         DataRow dataRow   = (DataRow)obj;
         string  startDate = ((DateTime)dataRow["RunDate"]).ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
         string  endDate   = ((DateTime)dataRow["RunDate"]).ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
         string  objectId  = dataRow["ObjectModified"].ToStringWithNull();
         string  cmdlet    = dataRow["CmdletName"].ToStringWithNull();
         dataRow["Identity"] = AuditingLog.CreateIdentity(objectId, cmdlet, startDate, endDate);
     }
 }
Exemplo n.º 2
0
        public static void PostGetObjectAction(DataRow inputrow, DataTable dataTable, DataObjectStore store)
        {
            if (dataTable.Rows.Count == 0)
            {
                return;
            }
            DataRow dataRow;

            if (dataTable.Rows.Count > 1)
            {
                AuditLogIdentity changeId = new AuditLogIdentity((Identity)inputrow["Identity"]);
                List <DataRow>   list     = new List <DataRow>();
                foreach (object obj in dataTable.Rows)
                {
                    DataRow item = (DataRow)obj;
                    list.Add(item);
                }
                dataRow = list.FirstOrDefault((DataRow r) => AuditingLog.GetDetailRow(r, changeId));
                Array.ForEach <DataRow>(list.Except(new DataRow[]
                {
                    dataRow
                }).ToArray <DataRow>(), delegate(DataRow r)
                {
                    dataTable.Rows.Remove(r);
                });
            }
            else
            {
                dataRow = dataTable.Rows[0];
            }
            if (DBNull.Value != dataRow["CmdletParameters"])
            {
                MultiValuedProperty <AdminAuditLogCmdletParameter> source = (MultiValuedProperty <AdminAuditLogCmdletParameter>)dataRow["CmdletParameters"];
                dataRow["ParameterValues"] = string.Join(", ", (from p in source
                                                                select string.Format("{0}: {1}", p.Name, p.Value)).ToArray <string>());
                store.SetModifiedColumns(new List <string>(new string[]
                {
                    "ParameterValues"
                }));
            }
        }