Exemple #1
0
 public List <T> Query <T>(string sql, params object[] parameterValues)
 {
     using (var ct = new DS_SafeQuestionDataContext(DbHelperSQL.Connection))
     {
         return(ct.ExecuteQuery <T>(sql, parameterValues).ToList());
     }
 }
Exemple #2
0
 public DS_SafeQuestion GetSingleByMemberID(int MemberID)
 {
     using (var ct = new DS_SafeQuestionDataContext(DbHelperSQL.Connection))
     {
         return(ct.DS_SafeQuestion.Single(a => a.MemberID == MemberID));
     }
 }
Exemple #3
0
 public bool Exists(int MemberID)
 {
     using (var ct = new DS_SafeQuestionDataContext(DbHelperSQL.Connection))
     {
         var md = ct.DS_SafeQuestion.SingleOrDefault(a => a.MemberID.Equals(MemberID));
         return(!object.Equals(md, null));
     }
 }
Exemple #4
0
 public void Update(DS_SafeQuestion SafeQuestion)
 {
     using (var ct = new DS_SafeQuestionDataContext(DbHelperSQL.Connection))
     {
         ct.DS_SafeQuestion.Attach(SafeQuestion, true);
         ct.SubmitChanges();
     }
 }
Exemple #5
0
 public void Add(DS_SafeQuestion SafeQuestion)
 {
     using (var ct = new DS_SafeQuestionDataContext(DbHelperSQL.Connection))
     {
         ct.DS_SafeQuestion.InsertOnSubmit(SafeQuestion);
         ct.SubmitChanges();
     }
 }
Exemple #6
0
 public void Delete(int ID)
 {
     using (var ct = new DS_SafeQuestionDataContext(DbHelperSQL.Connection))
     {
         DS_SafeQuestion st = ct.DS_SafeQuestion.Single(a => a.ID == ID);
         ct.DS_SafeQuestion.DeleteOnSubmit(st);
         ct.SubmitChanges();
     }
 }
Exemple #7
0
 public List <DS_SafeQuestion> Query(string condition, string orderby, params object[] param)
 {
     using (var ct = new DS_SafeQuestionDataContext(DbHelperSQL.Connection))
     {
         IQueryable <DS_SafeQuestion> SafeQuestionList = ct.DS_SafeQuestion;
         if (!string.IsNullOrEmpty(condition))
         {
             SafeQuestionList = SafeQuestionList.Where(condition, param);
         }
         if (!string.IsNullOrEmpty(orderby))
         {
             SafeQuestionList = SafeQuestionList.OrderBy(orderby);
         }
         return(SafeQuestionList.ToList());
     }
 }
Exemple #8
0
 public List <DS_SafeQuestion> Query(string condition, string orderby, int startIndex, int pageSize, ref int pageCount, params object[] param)
 {
     using (var ct = new DS_SafeQuestionDataContext(DbHelperSQL.Connection))
     {
         IQueryable <DS_SafeQuestion> SafeQuestionList = ct.DS_SafeQuestion;
         if (!string.IsNullOrEmpty(condition))
         {
             SafeQuestionList = SafeQuestionList.Where(condition, param);
         }
         if (!string.IsNullOrEmpty(orderby))
         {
             SafeQuestionList = SafeQuestionList.OrderBy(orderby);
         }
         pageCount = SafeQuestionList.Count();
         return(SafeQuestionList.Skip(startIndex).Take(pageSize).ToList());
     }
 }
Exemple #9
0
 public void InsertOrUpdate(DS_SafeQuestion SafeQuestion)
 {
     using (var ct = new DS_SafeQuestionDataContext(DbHelperSQL.Connection))
     {
         var md = ct.DS_SafeQuestion.SingleOrDefault(a => a.MemberID.Equals(SafeQuestion.MemberID));
         if (object.Equals(md, null))
         {
             ct.DS_SafeQuestion.InsertOnSubmit(SafeQuestion);
         }
         else
         {
             md.Question1 = SafeQuestion.Question1;
             md.Answer1   = SafeQuestion.Answer1;
         }
         ct.SubmitChanges();
     }
 }