private void LogView_MenuItem_Click(object sender, RoutedEventArgs e) { ObservableCollection<string> sloc = new ObservableCollection<string>(); lock (_serverLogLock) { foreach (Tuple<string, string, string> si in _serverLogOc) { bool find = false; foreach (string sloci in sloc) { if (string.Compare(sloci.Trim(), si.Item1.Trim(), true) == 0) { find = true; break; } } if (find == false) sloc.Add(si.Item1.Trim()); } } DeleteServerLog dsl = new DeleteServerLog(sloc, DeleteServerLog.ServerLogType.Select); bool? b = dsl.ShowDialog(); if (b == true) { ObservableCollection<Tuple<string, string, string>> slfoc = new ObservableCollection<Tuple<string, string, string>>(); if (string.IsNullOrWhiteSpace(dsl.DeleteUser) == false && string.IsNullOrWhiteSpace(dsl.DeleteDate) == false) { DateTime dt; if (DateTime.TryParse(dsl.DeleteDate, out dt) == true) { foreach (Tuple<string, string, string> si in _serverLogOc) { if (string.Compare(dsl.DeleteUser.Trim(), "all", true) == 0 || string.Compare(dsl.DeleteUser.Trim(), si.Item1.Trim(), true) == 0) { DateTime dtf; string[] sia = si.Item2.Trim().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); if (sia != null && sia.Length == 2) { string dtstr = Helper.ConvertDateTime(sia[0], Helper.DateTimeType.Date) + " " + Helper.ConvertDateTime(sia[1], Helper.DateTimeType.Time); if (DateTime.TryParse(dtstr, out dtf) == true) { if (DateTime.Compare(dt, dtf) <= 0) slfoc.Add(si); } } } } } } else if (string.IsNullOrWhiteSpace(dsl.DeleteUser) == true && string.IsNullOrWhiteSpace(dsl.DeleteDate) == false) { DateTime dt; if (DateTime.TryParse(dsl.DeleteDate, out dt) == true) { foreach (Tuple<string, string, string> si in _serverLogOc) { DateTime dtf; string[] sia = si.Item2.Trim().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); if (sia != null && sia.Length == 2) { string dtstr = Helper.ConvertDateTime(sia[0], Helper.DateTimeType.Date) + " " + Helper.ConvertDateTime(sia[1], Helper.DateTimeType.Time); if (DateTime.TryParse(dtstr, out dtf) == true) { if (DateTime.Compare(dt, dtf) <= 0) slfoc.Add(si); } } } } } else if (string.IsNullOrWhiteSpace(dsl.DeleteUser) == false && string.IsNullOrWhiteSpace(dsl.DeleteDate) == true) { foreach (Tuple<string, string, string> si in _serverLogOc) { if (string.Compare(dsl.DeleteUser.Trim(), "all", true) == 0 || string.Compare(dsl.DeleteUser.Trim(), si.Item1.Trim(), true) == 0) slfoc.Add(si); } } ViewUserMsgLog vuml = new ViewUserMsgLog(ServerIP, ServerWebPort, slfoc); vuml.ShowDialog(); } }
private void LogDelete_MenuItem_Click(object sender, RoutedEventArgs e) { ObservableCollection<string> sloc = new ObservableCollection<string>(); lock (_serverLogLock) { foreach (Tuple<string, string, string> si in _serverLogOc) { bool find = false; foreach (string sloci in sloc) { if (string.Compare(sloci.Trim(), si.Item1.Trim(), true) == 0) { find = true; break; } } if (find == false) sloc.Add(si.Item1.Trim()); } } DeleteServerLog dsl = new DeleteServerLog(sloc); bool? b = dsl.ShowDialog(); if (b == true) { string s = ""; if (string.IsNullOrWhiteSpace(dsl.DeleteUser) == false && string.IsNullOrWhiteSpace(dsl.DeleteDate) == false) { s = dsl.DeleteUser + "\t" + dsl.DeleteDate; PutRequest(new Tuple<string,string>(Consts.MAN_DEL_LOG_USER_DATE, s)); } else if (string.IsNullOrWhiteSpace(dsl.DeleteUser) == true && string.IsNullOrWhiteSpace(dsl.DeleteDate) == false) { s = dsl.DeleteDate; PutRequest(new Tuple<string,string>(Consts.MAN_DEL_LOG_DATE, s)); } else if (string.IsNullOrWhiteSpace(dsl.DeleteUser) == false && string.IsNullOrWhiteSpace(dsl.DeleteDate) == true) { s = dsl.DeleteUser; PutRequest(new Tuple<string,string>(Consts.MAN_DEL_LOG_USER, s)); } } }