public static List<RollingComment> AddComment(int surveyRowId, string comment) { var userName = AppNEnvConfig.GetUserName; using (SSCTechImp.CreateInstance()) { using (var db = new SSCTechClientDbCntx()) { db.RollingComment.Add(new RollingComment { Comments = comment, MachineName = string.Format("[{0}]-{1}", userName, AppNEnvConfig.GetMachineName), SequenceNumber = db.RollingComment.Count(x => x.SurveyRowID == surveyRowId) + 1, SurveyRowID = surveyRowId, TimeStamp = DateTime.UtcNow }); db.SaveChanges(); return GetComment(surveyRowId); } } }
public static void LogSSCTechActivityInfo(SSCTechInfo sSCTechInfo) { var user = AppNEnvConfig.GetUserName; using (SSCTechImp.CreateInstance()) { using (var db = new SSCTechClientDbCntx()) { db.SSCTechActivityInfo.Add(new SSCTechActivityInfo { Host = string.Format("{0}[{1}]", AppNEnvConfig.GetMachineName, AppNEnvConfig.AppVersion), User = user, SurveyId = sSCTechInfo.SurveyId, FAId = sSCTechInfo.FAId, SSCTechInfo = sSCTechInfo.Serialize(), TimeUtc = DateTime.UtcNow }); db.SaveChanges(); } } }
public static void LogError(SSCTechException ex) { var user = AppNEnvConfig.GetUserName; using (SSCTechImp.CreateInstance()) { using (var db = new SSCTechClientDbCntx()) { db.SSCTechError.Add(new SSCTechError { Host = string.Format("{0}[{1}]", AppNEnvConfig.GetMachineName, AppNEnvConfig.AppVersion), Type = ex.GetType().ToString(), Message = ex.Message, User = user, ErrorXml = ex.Serialize(), TimeUtc = DateTime.UtcNow }); db.SaveChanges(); } } }
public static void DeleteSSCTechActivityInfo() { using (SSCTechImp.CreateInstance()) { using (var db = new SSCTechClientDbCntx()) { db.SSCTechActivityInfo.RemoveRange(db.SSCTechActivityInfo); db.SaveChanges(); } } }
public static void DeleteError() { using (SSCTechImp.CreateInstance()) { using (var db = new SSCTechClientDbCntx()) { db.SSCTechError.RemoveRange(db.SSCTechError); db.SaveChanges(); } } }