1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using Common;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Text;
- namespace 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})";
- }
- }
|