示例#1
0
 public static Process CreateForCurrentProcess() {
     var result = new Process();
     var currentprocess = System.Diagnostics.Process.GetCurrentProcess();
     result.StartTime = DateTime.Now;
     result.EndTime = DateExtensions.End;
     result.IsActive = true;
     result.Result = -10;
     result.Host = Environment.MachineName;
     result.Pid = currentprocess.Id;
     result.Name = currentprocess.ProcessName;
     result.Usr = Thread.CurrentPrincipal.Identity.Name;
     result.Args = Environment.GetCommandLineArgs().Skip(1).concat(" ").replace(@"\s*--mas-process-code\s*\S+","");
     result.Code = string.Format("{0}_{1}_{2}_{3}_{4}", result.Host, result.Name, result.Pid, result.Usr,result.StartTime.ToString("yyyyMMddHHmmssms")).toSystemName();
     return result;
 }
示例#2
0
 public void clean(int result, bool active, string resultcondition,string name, string host, string args, string time, string timecondition) {
     if (resultcondition.noContent()) resultcondition = "Eq";
     if (timecondition.noContent()) timecondition = "None";
     var query = new Process
                     {
                         IsActiveCondition = active ? Condition.None : Condition.Eq,
                         ResultCondition = (Condition) Enum.Parse(typeof (Condition),
                                                                  resultcondition, true),
                         Result = result,
                         
                         Host = host,
                         Args = "%" + args + "%",
                     };
     if(name.hasContent()) {
         query.Name = "%" + name + "%";
     }
     if(args.hasContent()) {
         query.Args = "%" + args + "%";
     }
     if ((Condition)Enum.Parse(typeof(Condition),timecondition, true) != Condition.None) {
         query.StartTimeCondition = (Condition) Enum.Parse(typeof (Condition), timecondition, true);
         query.StartTime = time.toDate();
     }
     Repository.Clean(query);
     RenderText("OK");
 }