public void Execute() { var d_indb = DAL.TreeManager.GetId(doc_id, parent_site_id, parent_id); if (d_indb > 0) { log("doc_id =" + doc_id + " redy"); return; } Stopwatch sw = Stopwatch.StartNew(); WebPage.DownloadFile(url, file_name, callback); sw.Stop(); var timeLoad = sw.ElapsedMilliseconds / 1000; var fileSize = (new FileInfo(file_name).Length); if (fileSize > 0) { using (var context = new dataEntities()) { //var d_indb = context.data.Where(t => t.site_id == doc_id && t.parent_site_id == parent_site_id && parent_id == this.parent_id).FirstOrDefault(); string data_rtf, data_text; sw.Reset(); sw.Start(); string doc_info; GetText(Path.GetFullPath(file_name), out data_rtf, out data_text, out doc_info); sw.Stop(); var time_text = sw.ElapsedMilliseconds / 1000; sw.Reset(); sw.Start(); var d = new data() { id = -1, site_id = this.doc_id, name = doc_name, parent_id = parent_id, parent_site_id = parent_site_id, position = position, is_doc = true, is_loaded = true, data_rtf = data_rtf, data_text = data_text }; context.data.AddObject(d); context.SaveChanges(); sw.Stop(); var time_save = sw.ElapsedMilliseconds / 1000; var milliSec = timeLoad + time_text + time_save; var str = String.Empty; if (milliSec > 3) { str += "all:" + milliSec + "\t\tload:" + timeLoad + "\t\ttext:" + time_text + "\t\tLENGTH:" + fileSize + "(" + doc_info + ")"; } log("doc_id =" + doc_id + "\t" + str); } } else { log("Leaf: doc file length is 0"); } }