示例#1
0
        public void WriteLog(JournalItem item)
        {
            var specialPath = Path.GetFullPath(Path.Combine(folderPath, item.date.ToString("MMMM yyyy", CultureInfo.CreateSpecificCulture("ru-RU"))));
            var filePath    = Path.GetFullPath(Path.Combine(specialPath, item.date.ToString("d MMMM yyyy", CultureInfo.CreateSpecificCulture("ru-RU")) + ".journal"));

            CreateFolderIfNotExists(specialPath);
            write_log(filePath, item.ToString());
        }
示例#2
0
        public static JournalItem_View ItemToToView(JournalItem to)
        {
            var ret = new JournalItem_View();

            try
            {
                ret = new JournalItem_View()
                {
                    to          = to.date,
                    machineName = to.machineName,
                    username    = to.username,
                    RealName    = "",
                    purpose     = to.purpose
                };
            }
            catch (Exception e) { }
            return(ret);
        }
示例#3
0
        public static JournalItem_View ItemsToView(JournalItem from, JournalItem to, namemap namemap, pcmap pcmap)
        {
            var ret = new JournalItem_View();

            try
            {
                ret = new JournalItem_View()
                {
                    from        = from.date,
                    to          = to.date,
                    duration    = to.date - from.date,
                    machineName = pcmap.GetViewName(from.machineName),
                    username    = namemap.GetName(from.username),
                    RealName    = "",
                    purpose     = from.purpose,
                    isValid     = from.isValid && to.isValid
                };
            }
            catch (Exception e) { }
            return(ret);
        }
示例#4
0
        public List <JournalItem> TLItems(string path)
        {
            var res = new List <JournalItem>();

            try
            {
                using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read))
                    using (var sr = new StreamReader(fs))
                    {
                        string nl;
                        while ((nl = sr.ReadLine()) != null)
                        {
                            try
                            {
                                res.Add(JournalItem.StringToJournalItem(nl));
                            }
                            catch (Exception e) { }
                        }
                    }
            }
            catch (Exception e) { }
            return(res);
        }