/// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(IPSP.Model.TPCase_OppositePersons model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TPCase_OppositePersons(");
            strSql.Append("n_CaseID,s_Role,s_Name,s_OtherName,s_Addr,s_OtherAddr,s_ZipCode,s_Tel,s_Fax,s_Email,s_LawDeputy,s_Contact,Patent,n_Country)");
            strSql.Append(" values (");
            strSql.Append("@n_CaseID,@s_Role,@s_Name,@s_OtherName,@s_Addr,@s_OtherAddr,@s_ZipCode,@s_Tel,@s_Fax,@s_Email,@s_LawDeputy,@s_Contact,@Patent,@n_Country)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_CaseID",    SqlDbType.Int,        4),
                new SqlParameter("@s_Role",      SqlDbType.NVarChar,   1),
                new SqlParameter("@s_Name",      SqlDbType.NVarChar, 300),
                new SqlParameter("@s_OtherName", SqlDbType.NVarChar, 200),
                new SqlParameter("@s_Addr",      SqlDbType.NVarChar, 300),
                new SqlParameter("@s_OtherAddr", SqlDbType.NVarChar, 300),
                new SqlParameter("@s_ZipCode",   SqlDbType.NVarChar,  50),
                new SqlParameter("@s_Tel",       SqlDbType.NVarChar,  50),
                new SqlParameter("@s_Fax",       SqlDbType.NVarChar,  50),
                new SqlParameter("@s_Email",     SqlDbType.NVarChar,  50),
                new SqlParameter("@s_LawDeputy", SqlDbType.NVarChar, 200),
                new SqlParameter("@s_Contact",   SqlDbType.NVarChar, 200),
                new SqlParameter("@Patent",      SqlDbType.Int,        4),
                new SqlParameter("@n_Country",   SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.n_CaseID;
            parameters[1].Value  = model.s_Role;
            parameters[2].Value  = model.s_Name;
            parameters[3].Value  = model.s_OtherName;
            parameters[4].Value  = model.s_Addr;
            parameters[5].Value  = model.s_OtherAddr;
            parameters[6].Value  = model.s_ZipCode;
            parameters[7].Value  = model.s_Tel;
            parameters[8].Value  = model.s_Fax;
            parameters[9].Value  = model.s_Email;
            parameters[10].Value = model.s_LawDeputy;
            parameters[11].Value = model.s_Contact;
            parameters[12].Value = model.Patent;
            parameters[13].Value = model.n_Country;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TPCase_OppositePersons GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_ID,n_CaseID,s_Role,s_Name,s_OtherName,s_Addr,s_OtherAddr,s_ZipCode,s_Tel,s_Fax,s_Email,s_LawDeputy,s_Contact,Patent,n_Country from TPCase_OppositePersons ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

            IPSP.Model.TPCase_OppositePersons model = new IPSP.Model.TPCase_OppositePersons();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TPCase_OppositePersons DataRowToModel(DataRow row)
 {
     IPSP.Model.TPCase_OppositePersons model = new IPSP.Model.TPCase_OppositePersons();
     if (row != null)
     {
         if (row["n_ID"] != null && row["n_ID"].ToString() != "")
         {
             model.n_ID = int.Parse(row["n_ID"].ToString());
         }
         if (row["n_CaseID"] != null && row["n_CaseID"].ToString() != "")
         {
             model.n_CaseID = int.Parse(row["n_CaseID"].ToString());
         }
         if (row["s_Role"] != null)
         {
             model.s_Role = row["s_Role"].ToString();
         }
         if (row["s_Name"] != null)
         {
             model.s_Name = row["s_Name"].ToString();
         }
         if (row["s_OtherName"] != null)
         {
             model.s_OtherName = row["s_OtherName"].ToString();
         }
         if (row["s_Addr"] != null)
         {
             model.s_Addr = row["s_Addr"].ToString();
         }
         if (row["s_OtherAddr"] != null)
         {
             model.s_OtherAddr = row["s_OtherAddr"].ToString();
         }
         if (row["s_ZipCode"] != null)
         {
             model.s_ZipCode = row["s_ZipCode"].ToString();
         }
         if (row["s_Tel"] != null)
         {
             model.s_Tel = row["s_Tel"].ToString();
         }
         if (row["s_Fax"] != null)
         {
             model.s_Fax = row["s_Fax"].ToString();
         }
         if (row["s_Email"] != null)
         {
             model.s_Email = row["s_Email"].ToString();
         }
         if (row["s_LawDeputy"] != null)
         {
             model.s_LawDeputy = row["s_LawDeputy"].ToString();
         }
         if (row["s_Contact"] != null)
         {
             model.s_Contact = row["s_Contact"].ToString();
         }
         if (row["Patent"] != null && row["Patent"].ToString() != "")
         {
             model.Patent = int.Parse(row["Patent"].ToString());
         }
         if (row["n_Country"] != null && row["n_Country"].ToString() != "")
         {
             model.n_Country = int.Parse(row["n_Country"].ToString());
         }
     }
     return(model);
 }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TPCase_OppositePersons model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TPCase_OppositePersons set ");
            strSql.Append("s_Role=@s_Role,");
            strSql.Append("s_Name=@s_Name,");
            strSql.Append("s_OtherName=@s_OtherName,");
            strSql.Append("s_Addr=@s_Addr,");
            strSql.Append("s_OtherAddr=@s_OtherAddr,");
            strSql.Append("s_ZipCode=@s_ZipCode,");
            strSql.Append("s_Tel=@s_Tel,");
            strSql.Append("s_Fax=@s_Fax,");
            strSql.Append("s_Email=@s_Email,");
            strSql.Append("s_LawDeputy=@s_LawDeputy,");
            strSql.Append("s_Contact=@s_Contact,");
            strSql.Append("n_Country=@n_Country");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@s_Role",      SqlDbType.NVarChar,   1),
                new SqlParameter("@s_Name",      SqlDbType.NVarChar, 300),
                new SqlParameter("@s_OtherName", SqlDbType.NVarChar, 200),
                new SqlParameter("@s_Addr",      SqlDbType.NVarChar, 300),
                new SqlParameter("@s_OtherAddr", SqlDbType.NVarChar, 300),
                new SqlParameter("@s_ZipCode",   SqlDbType.NVarChar,  50),
                new SqlParameter("@s_Tel",       SqlDbType.NVarChar,  50),
                new SqlParameter("@s_Fax",       SqlDbType.NVarChar,  50),
                new SqlParameter("@s_Email",     SqlDbType.NVarChar,  50),
                new SqlParameter("@s_LawDeputy", SqlDbType.NVarChar, 200),
                new SqlParameter("@s_Contact",   SqlDbType.NVarChar, 200),
                new SqlParameter("@n_Country",   SqlDbType.Int,        4),
                new SqlParameter("@n_ID",        SqlDbType.Int,        4),
                new SqlParameter("@n_CaseID",    SqlDbType.Int,        4),
                new SqlParameter("@Patent",      SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.s_Role;
            parameters[1].Value  = model.s_Name;
            parameters[2].Value  = model.s_OtherName;
            parameters[3].Value  = model.s_Addr;
            parameters[4].Value  = model.s_OtherAddr;
            parameters[5].Value  = model.s_ZipCode;
            parameters[6].Value  = model.s_Tel;
            parameters[7].Value  = model.s_Fax;
            parameters[8].Value  = model.s_Email;
            parameters[9].Value  = model.s_LawDeputy;
            parameters[10].Value = model.s_Contact;
            parameters[11].Value = model.n_Country;
            parameters[12].Value = model.n_ID;
            parameters[13].Value = model.n_CaseID;
            parameters[14].Value = model.Patent;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(IPSP.Model.TPCase_OppositePersons model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(IPSP.Model.TPCase_OppositePersons model)
 {
     return(dal.Add(model));
 }