public static int ImportNow(Model_SubscriberParamImport param) { int ret = 0; Model_SubscriberImportTemp import = new Model_SubscriberImportTemp(); import = import.GetImportTemp(); DataTable data = null; if (import != null) { try { FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath(import.Path + import.FileName)); if (file.Exists) { string extension = file.Extension; switch (extension) { case ".csv": data = new GsCsvReader(import.Path, import.FileName).ResultDataTable; break; default: data = new ExcelReader(import.Path, import.FileName).GetDataSetCreatecolumn().Tables[0]; break; } if (data.Rows.Count > 0) { Lock.AcquireWriterLock(Timeout.Infinite); SubScriberImportController.TotalCompleted = 0; SubScriberImportController.PercentCompleted = 0.0M; SubScriberImportController.Onprocess = true; Lock.ReleaseWriterLock(); API_ThreadPool cpool = new API_ThreadPool(); object[] parameters = new object[] { data, param }; cpool.QueueWork(parameters, ImportSubscriber); } } ret = 1; } catch { } } return(ret); }
public static Model_SubscriberImportTemp GetTempImprt() { Model_SubscriberImportTemp import = new Model_SubscriberImportTemp(); return(import.GetImportTemp()); }