// GET api/job/5 public Job Get(Int64 id) { this.oDB = new db(oConfig.ConnectionString); System.Data.DataRow oJobRow = oDB.getJob(id); return Job.getInstance(oJobRow["JSON"].ToString()); }
public bool ImportData(Object Configuration, String DBConnectionString) { IMSClasses.Jobs.Job oCurrentJob = (IMSClasses.Jobs.Job)Configuration; DataTable oDT = null; bool bCorrect = true; String sError = ""; db oDB = new db(DBConnectionString); try { oDT = IMSClasses.excellHelpper.ExcelHelpper.getExcelData(oCurrentJob.InputParameters.Files[0].FileName, oCurrentJob.SQLParameters.TableName); } catch (Exception xlException) { bCorrect = false; sError = "Error getting excel data --> Exception --> " + xlException.Message; } if (bCorrect) { try { bCorrect = oDB.LoadTable(oDT); } catch (Exception dbException) { bCorrect = false; sError = "Error loading data in DB --> Exception --> " + dbException.Message; } } return bCorrect; }
private void ThisWorkbook_Startup(object sender, System.EventArgs e) { oCfg = new ConfigurationHelpper(); oDb = new db(oCfg.ConnectionStringSQL.ToString()); //get the job data oJob = IMSClasses.Jobs.Job.getInstance(oDb.getJob(oCfg.JobID)["JSON"].ToString()); this.RemoveCustomization(); this.StatusMessage = ""; this.StatusCorrect = true; }
// GET api/job public IEnumerable<Job> Get() { List<Job> oJobList = new List<Job>(); this.oDB = new db(oConfig.ConnectionString); System.Data.DataTable oJobsTable = oDB.getConfiguration(); foreach(System.Data.DataRow oJobRow in oJobsTable.Rows) { IMSClasses.Jobs.Job oJobToAdd = Job.getInstance(oJobRow["JSON"].ToString()); oJobToAdd.CurrentTaskStatus = oJobRow["CurrentTaskStatus"].ToString(); oJobList.Add(oJobToAdd); } return oJobList; }
public bool ImportData(Object Configuration, String DBConnectionString) { IMSClasses.Jobs.Job oCurrentJob = (IMSClasses.Jobs.Job)Configuration; DataTable oDT = null; bool bCorrect = true; db oDB = new db(DBConnectionString); int iIdentity = 1; List<IMSClasses.Jobs.File>.Enumerator oEFiles = oCurrentJob.InputParameters.Files.GetEnumerator(); while (oEFiles.MoveNext() && bCorrect) { try { String sTableName = oCurrentJob.SQLParameters.TableName.Replace(@"%identity%", iIdentity.ToString()); IMSClasses.Jobs.File oCurrentFile = oEFiles.Current; oDT = ExcelHelpper.getExcelData(oCurrentFile.FileName, sTableName); } catch(Exception eLoadException) { bCorrect = false; } if (bCorrect) { try { bCorrect = oDB.LoadTable(oDT); } catch (Exception dbException) { bCorrect = false; } } if (bCorrect) iIdentity++; } return bCorrect; }