public void InitLog() { cbAnaAudit.Checked = cbSysAudit.Checked = true; dtpAuditFrom.Format = DateTimePickerFormat.Custom; dtpAuditFrom.CustomFormat = Common.GetDateOrTimeFormat(true, Common.GlobalProfile.DateTimeFormator); dtpAuditTo.Format = DateTimePickerFormat.Custom; dtpAuditTo.CustomFormat = Common.GetDateOrTimeFormat(true, Common.GlobalProfile.DateTimeFormator); list = logbll.GetLog(null); if (list != null && list.Count > 0) { count = list.Count; AddColumnsToGrid(); AddRowsToGrid(); DateTime end = list.Max(p => p.Operatetime.ToLocalTime()); DateTime start = list.Min(p => p.Operatetime.ToLocalTime()); this.dtpAuditFrom.Value = start; this.dtpAuditTo.Value = end; List <string> useList = list.Select(p => p.Username).Distinct().ToList(); useList.Add(""); useList.Reverse(); this.cmbUserName.DataSource = useList; this.cmbUserName.DisplayMember = "User Name"; InitAction(); } }
public string GetLocalTimeZoneString() { string result = string.Empty; int offset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).Hours; string offsetString = string.Empty; if (offset >= 0) { offsetString = string.Format("+{0}", offset.ToString("00")); } else { offsetString = offset.ToString("00"); } result = string.Format("Time Zone: (GMT{0}:00) {1}", offsetString, Common.GetDateOrTimeFormat(true, Common.GetGlobalUserProfile().DateTimeFormator)); return(result); }