public static int DeleteT_WQX_IMPORT_LOG(int iMPORT_ID) { try { TWqxImportLog r = new TWqxImportLog(); r = (from c in _db.TWqxImportLog where c.ImportId == iMPORT_ID select c).FirstOrDefault(); _db.TWqxImportLog.Remove(r); _db.SaveChanges(); return(1); } catch { return(0); } }
public static int UpdateWQX_IMPORT_LOG_MarkPendingSampImportAsComplete(string oRG_ID) { try { TWqxImportLog t = new TWqxImportLog(); t = (from c in _db.TWqxImportLog where c.ImportProgress == "P" && c.TypeCd == "Sample" && c.OrgId == oRG_ID select c).FirstOrDefault(); t.ImportStatus = "Success"; t.ImportProgress = "100"; t.ImportProgressMsg = "Import complete."; _db.TWqxImportLog.Update(t); _db.SaveChanges(); return(t.ImportId); } catch { return(0); } }
//*********************** IMPORT LOG ******************************* public static int InsertUpdateWQX_IMPORT_LOG(int?iMPORT_ID, string oRG_ID, string tYPE_CD, string fILE_NAME, int fILE_SIZE, string iMPORT_STATUS, string iMPORT_PROGRESS, string iMPORT_PROGRESS_MSG, byte[] iMPORT_FILE, string uSER_ID) { try { TWqxImportLog t = new TWqxImportLog(); if (iMPORT_ID != null) { t = (from c in _db.TWqxImportLog where c.ImportId == iMPORT_ID select c).First(); } if (iMPORT_ID == null) { t = new TWqxImportLog(); } if (oRG_ID != null) { t.OrgId = oRG_ID; } if (tYPE_CD != null) { t.TypeCd = tYPE_CD.Substring(0, 5); } if (fILE_NAME != null) { t.FileName = fILE_NAME; } t.FileSize = fILE_SIZE; if (iMPORT_STATUS != null) { t.ImportStatus = iMPORT_STATUS; } if (iMPORT_PROGRESS != null) { t.ImportProgress = iMPORT_PROGRESS; } if (iMPORT_PROGRESS_MSG != null) { t.ImportProgressMsg = iMPORT_PROGRESS_MSG; } if (iMPORT_FILE != null) { t.ImportFile = iMPORT_FILE; } if (uSER_ID != null) { t.CreateUserid = uSER_ID; } if (iMPORT_ID == null) //insert case { t.CreateDt = DateTime.Now; _db.TWqxImportLog.Add(t); } else { _db.TWqxImportLog.Update(t); } _db.SaveChanges(); return(t.ImportId); } catch { return(0); } }