12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using SCC.Common;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Text;
- namespace SCC.Services
- {
- public class CheckResultServices
- {
-
-
-
-
-
-
- public int ExecuteResult(string tablename, Dictionary<int, int> result)
- {
- try
- {
- if (result.Count == 0) return 1;
- var resultok = result.Where(w => w.Value == 1).Select(w => w.Key).ToArray();
- var resultall = result.Select(w => w.Key).ToArray(); ;
- string okstr = string.Join(",", resultok);
- string allstr = string.Join(",", resultall);
- string sql = string.Format(ResultSQL, tablename, okstr, allstr);
- int rt = SqlHelper.ExecuteNonQuery(CommandType.Text, sql, null);
- return rt;
- }
- catch (Exception ee)
- {
- return -2;
- }
- }
- private string ResultSQL = @"update {0} set IsChecked=1 ,IsPassed=( case when Term in({1}) then 1 else 0 end) where Term in ({2})";
- }
- }
|