Exemple #1
0
        public static void AddFileAsProcessed(string file, string connectionString)
        {
            using (HTMLFileContentDbContext dbContext = new HTMLFileContentDbContext(connectionString))
            {
                W3SVCLogFilesProcessed w3SVCLogFilesProcessed = new W3SVCLogFilesProcessed();
                w3SVCLogFilesProcessed.fileName      = file;
                w3SVCLogFilesProcessed.DateProcessed = DateTime.Now;
                dbContext.W3SVCLogFilesProcessed.Add(w3SVCLogFilesProcessed);

                dbContext.SaveChanges();
            }
        }
        public static void SaveContentItemView(HTMLContentView hTMLContentView, string connectionString)
        {
            using (HTMLFileContentDbContext dbContext = new HTMLFileContentDbContext(connectionString))
            {
                Mapper.CreateMap <HTMLContentView, HTMLContent>();
                Mapper.CreateMap <ContentItemView, ContentItem>();
                var hTMLContent = Mapper.Map <HTMLContentView, HTMLContent>(hTMLContentView);
                foreach (var item in hTMLContentView.ContentItemsView)
                {
                    hTMLContent.ContentItems.Add(Mapper.Map <ContentItemView, ContentItem>(item));
                }


                dbContext.HTMLContent.Add(hTMLContent);

                dbContext.SaveChanges();
            }
        }
Exemple #3
0
        public static void StoreLine(List <string> lines, string connectionString)
        {
            using (HTMLFileContentDbContext dbContext = new HTMLFileContentDbContext(connectionString))
            {
                foreach (string line in lines)
                {
                    string[]     lineContent  = line.Split(' ');
                    W3SVCLogFile w3SVCLogFile = new W3SVCLogFile();

                    w3SVCLogFile.Date           = DateTime.ParseExact(lineContent[(int)W3SVCLogFileFields.Date], "yyyy-MM-dd", CultureInfo.InvariantCulture);
                    w3SVCLogFile.Time           = DateTime.ParseExact(lineContent[(int)W3SVCLogFileFields.Time], "H:m:s", null);
                    w3SVCLogFile.CsBytes        = Convert.ToInt32(lineContent[(int)W3SVCLogFileFields.CsBytes]);
                    w3SVCLogFile.CsCookie       = lineContent[(int)W3SVCLogFileFields.CsCookie];
                    w3SVCLogFile.CSMethod       = lineContent[(int)W3SVCLogFileFields.CSMethod];
                    w3SVCLogFile.CsReferer      = lineContent[(int)W3SVCLogFileFields.CsReferer];
                    w3SVCLogFile.ClientIP       = lineContent[(int)W3SVCLogFileFields.ClientIP];
                    w3SVCLogFile.CSUriQuery     = lineContent[(int)W3SVCLogFileFields.CSUriQuery];
                    w3SVCLogFile.CSUriStem      = lineContent[(int)W3SVCLogFileFields.CSUriStem];
                    w3SVCLogFile.CsUserAgent    = lineContent[(int)W3SVCLogFileFields.CsUserAgent];
                    w3SVCLogFile.CsUsername     = lineContent[(int)W3SVCLogFileFields.CsUsername];
                    w3SVCLogFile.CsVersion      = lineContent[(int)W3SVCLogFileFields.CsVersion];
                    w3SVCLogFile.ScBytes        = Convert.ToInt32(lineContent[(int)W3SVCLogFileFields.ScBytes]);
                    w3SVCLogFile.ScStatus       = Convert.ToInt32(lineContent[(int)W3SVCLogFileFields.ScStatus]);
                    w3SVCLogFile.ScSubStatus    = Convert.ToInt32(lineContent[(int)W3SVCLogFileFields.ScSubStatus]);
                    w3SVCLogFile.ScWin32Status  = Convert.ToInt32(lineContent[(int)W3SVCLogFileFields.ScWin32Status]);
                    w3SVCLogFile.SourceIP       = lineContent[(int)W3SVCLogFileFields.SourceIP];
                    w3SVCLogFile.SourceSitename = lineContent[(int)W3SVCLogFileFields.SourceSitename];
                    w3SVCLogFile.SPort          = Convert.ToInt32(lineContent[(int)W3SVCLogFileFields.SPort]);
                    w3SVCLogFile.TimeTaken      = Convert.ToInt32(lineContent[(int)W3SVCLogFileFields.TimeTaken]);

                    dbContext.W3SVCLogFile.Add(w3SVCLogFile);
                }

                dbContext.SaveChanges();
            }
        }