65 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			65 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Data;
 | |
| using System.Data.SqlClient;
 | |
| using System.Collections;
 | |
| using System.Collections.Generic;
 | |
| using AIMSModel;
 | |
| using AIMSObjectQuery;
 | |
| using System.Text;
 | |
| 
 | |
| namespace AIMSDAL
 | |
| {
 | |
|     internal partial class DApplyPersonDuty
 | |
|     {
 | |
|         public static int Add(ApplyPersonDuty ApplyPersonDutyObj)
 | |
| 		{
 | |
| 			StringBuilder strSql=new StringBuilder();
 | |
| 			strSql.Append("insert into [ApplyPersonDuty](");
 | |
| 			strSql.Append("OperationApplyId,PersonDutyId,PersonId,OperatorNo,OperatorName,OperateDate");
 | |
| 			strSql.Append(")");
 | |
| 			strSql.Append(" values (");
 | |
| 			strSql.Append(""+ApplyPersonDutyObj.OperationApplyId+",");
 | |
| 			strSql.Append(""+ApplyPersonDutyObj.PersonDutyId+",");
 | |
| 			strSql.Append(""+ApplyPersonDutyObj.PersonId+",");
 | |
| 			strSql.Append("'"+ApplyPersonDutyObj.OperatorNo+"',");
 | |
| 			strSql.Append("'"+ApplyPersonDutyObj.OperatorName+"',");
 | |
| 			strSql.Append("'"+ApplyPersonDutyObj.OperateDate+"'");
 | |
| 			strSql.Append(")");
 | |
| 		  return  HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString());
 | |
| 		}
 | |
| 
 | |
|         public static void Delete(int OperationApplyId, int PersonDutyId)
 | |
| 		{
 | |
| 			StringBuilder strSql=new StringBuilder();
 | |
| 			strSql.Append("delete ApplyPersonDuty ");
 | |
|             strSql.Append(" where PersonDutyId ="+PersonDutyId+" and OperationApplyId=" + OperationApplyId + "");
 | |
|             HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString());
 | |
| 		}
 | |
|         public static void Delete(int OperationApplyId, int PersonDutyId, int PersonId)
 | |
| 		{
 | |
| 			StringBuilder strSql=new StringBuilder();
 | |
| 			strSql.Append("delete ApplyPersonDuty ");
 | |
|             strSql.Append(" where PersonDutyId ="+PersonDutyId+" and  PersonId ="+PersonId+" and OperationApplyId=" + OperationApplyId + "");
 | |
|             HelperDB.DbHelperSQL.ExecNonQuery(strSql.ToString());
 | |
| 		}
 | |
|         public static List<int> GetPersonIdList(int OperationApplyId,int PersonDutyId)
 | |
|         {
 | |
|             List<int> PersonIdList  = new List<int>();
 | |
|             string strSql = "SELECT PersonId FROM ApplyPersonDuty WHERE OperationApplyId=" + OperationApplyId + " AND PersonDutyId =" + PersonDutyId + "";
 | |
|             DataTable dt = HelperDB.DbHelperSQL.GetDataTable(strSql);
 | |
|             for (int i = 0; i < dt.Rows.Count; i++)
 | |
|             {
 | |
|                 PersonIdList.Add(int.Parse(dt.Rows[i]["PersonId"].ToString()));
 | |
|             }
 | |
| 
 | |
|             return PersonIdList;
 | |
|         }
 | |
|         public static DataTable GetPersonDataTable(int OperationApplyId)
 | |
|         {
 | |
|             List<int> PersonIdList = new List<int>();
 | |
|             string strSql = "SELECT PersonDutyId,PersonId FROM ApplyPersonDuty WHERE OperationApplyId=" + OperationApplyId + "   ";
 | |
|             return  HelperDB.DbHelperSQL.GetDataTable(strSql);
 | |
|         }
 | |
|     }
 | |
| }
 |