/// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TPCase_Patent GetModel(int n_CaseID, int n_LawID, int n_OrigPatInfoID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_CaseID,n_PFlowNum,n_LawID,n_PatentTypeID,s_TechnologyType,s_OldSerial,s_NPatentID,s_OrigCaseSerial,s_OrigAppNo,dt_OrigAppDate,s_PatentStatus,s_Notes,n_OrigPatInfoID,s_Inventors,dt_RequestSubmitDate,b_DivisionalCaseFlag,s_OrigCaseNo,s_AllInventorAddress,s_FristPriority,s_FirstPriorityNo,dt_FirstPriorityDate,s_FirstInventor,s_PriorityStatus,dt_PriorityStatusDate,dt_DivSubmitDate,s_DivisionAppNo,s_DivisionCaseNo from TPCase_Patent ");
            strSql.Append(" where n_CaseID=@n_CaseID and n_LawID=@n_LawID and n_OrigPatInfoID=@n_OrigPatInfoID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_CaseID",        SqlDbType.Int, 4),
                new SqlParameter("@n_LawID",         SqlDbType.Int, 4),
                new SqlParameter("@n_OrigPatInfoID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_CaseID;
            parameters[1].Value = n_LawID;
            parameters[2].Value = n_OrigPatInfoID;

            IPSP.Model.TPCase_Patent model = new IPSP.Model.TPCase_Patent();
            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 bool Add(IPSP.Model.TPCase_Patent model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TPCase_Patent(");
            strSql.Append("n_CaseID,n_PFlowNum,n_LawID,n_PatentTypeID,s_TechnologyType,s_OldSerial,s_NPatentID,s_OrigCaseSerial,s_OrigAppNo,dt_OrigAppDate,s_PatentStatus,s_Notes,n_OrigPatInfoID,s_Inventors,dt_RequestSubmitDate,b_DivisionalCaseFlag,s_OrigCaseNo,s_AllInventorAddress,s_FristPriority,s_FirstPriorityNo,dt_FirstPriorityDate,s_FirstInventor,s_PriorityStatus,dt_PriorityStatusDate,dt_DivSubmitDate,s_DivisionAppNo,s_DivisionCaseNo)");
            strSql.Append(" values (");
            strSql.Append("@n_CaseID,@n_PFlowNum,@n_LawID,@n_PatentTypeID,@s_TechnologyType,@s_OldSerial,@s_NPatentID,@s_OrigCaseSerial,@s_OrigAppNo,@dt_OrigAppDate,@s_PatentStatus,@s_Notes,@n_OrigPatInfoID,@s_Inventors,@dt_RequestSubmitDate,@b_DivisionalCaseFlag,@s_OrigCaseNo,@s_AllInventorAddress,@s_FristPriority,@s_FirstPriorityNo,@dt_FirstPriorityDate,@s_FirstInventor,@s_PriorityStatus,@dt_PriorityStatusDate,@dt_DivSubmitDate,@s_DivisionAppNo,@s_DivisionCaseNo)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_CaseID",              SqlDbType.Int,          4),
                new SqlParameter("@n_PFlowNum",            SqlDbType.Int,          4),
                new SqlParameter("@n_LawID",               SqlDbType.Int,          4),
                new SqlParameter("@n_PatentTypeID",        SqlDbType.Int,          4),
                new SqlParameter("@s_TechnologyType",      SqlDbType.NVarChar,    50),
                new SqlParameter("@s_OldSerial",           SqlDbType.NVarChar,    20),
                new SqlParameter("@s_NPatentID",           SqlDbType.NVarChar,    50),
                new SqlParameter("@s_OrigCaseSerial",      SqlDbType.NVarChar,    50),
                new SqlParameter("@s_OrigAppNo",           SqlDbType.NVarChar,    50),
                new SqlParameter("@dt_OrigAppDate",        SqlDbType.DateTime),
                new SqlParameter("@s_PatentStatus",        SqlDbType.NVarChar,    50),
                new SqlParameter("@s_Notes",               SqlDbType.NVarChar,   800),
                new SqlParameter("@n_OrigPatInfoID",       SqlDbType.Int,          4),
                new SqlParameter("@s_Inventors",           SqlDbType.NVarChar,  1000),
                new SqlParameter("@dt_RequestSubmitDate",  SqlDbType.DateTime),
                new SqlParameter("@b_DivisionalCaseFlag",  SqlDbType.Bit,          1),
                new SqlParameter("@s_OrigCaseNo",          SqlDbType.NVarChar,    50),
                new SqlParameter("@s_AllInventorAddress",  SqlDbType.NVarChar,   500),
                new SqlParameter("@s_FristPriority",       SqlDbType.NVarChar,   500),
                new SqlParameter("@s_FirstPriorityNo",     SqlDbType.NVarChar,   500),
                new SqlParameter("@dt_FirstPriorityDate",  SqlDbType.DateTime),
                new SqlParameter("@s_FirstInventor",       SqlDbType.NVarChar,   200),
                new SqlParameter("@s_PriorityStatus",      SqlDbType.NVarChar,     1),
                new SqlParameter("@dt_PriorityStatusDate", SqlDbType.DateTime),
                new SqlParameter("@dt_DivSubmitDate",      SqlDbType.DateTime),
                new SqlParameter("@s_DivisionAppNo",       SqlDbType.NVarChar,    50),
                new SqlParameter("@s_DivisionCaseNo",      SqlDbType.NVarChar, 50)
            };
            parameters[0].Value  = model.n_CaseID;
            parameters[1].Value  = model.n_PFlowNum;
            parameters[2].Value  = model.n_LawID;
            parameters[3].Value  = model.n_PatentTypeID;
            parameters[4].Value  = model.s_TechnologyType;
            parameters[5].Value  = model.s_OldSerial;
            parameters[6].Value  = model.s_NPatentID;
            parameters[7].Value  = model.s_OrigCaseSerial;
            parameters[8].Value  = model.s_OrigAppNo;
            parameters[9].Value  = model.dt_OrigAppDate;
            parameters[10].Value = model.s_PatentStatus;
            parameters[11].Value = model.s_Notes;
            parameters[12].Value = model.n_OrigPatInfoID;
            parameters[13].Value = model.s_Inventors;
            parameters[14].Value = model.dt_RequestSubmitDate;
            parameters[15].Value = model.b_DivisionalCaseFlag;
            parameters[16].Value = model.s_OrigCaseNo;
            parameters[17].Value = model.s_AllInventorAddress;
            parameters[18].Value = model.s_FristPriority;
            parameters[19].Value = model.s_FirstPriorityNo;
            parameters[20].Value = model.dt_FirstPriorityDate;
            parameters[21].Value = model.s_FirstInventor;
            parameters[22].Value = model.s_PriorityStatus;
            parameters[23].Value = model.dt_PriorityStatusDate;
            parameters[24].Value = model.dt_DivSubmitDate;
            parameters[25].Value = model.s_DivisionAppNo;
            parameters[26].Value = model.s_DivisionCaseNo;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TPCase_Patent DataRowToModel(DataRow row)
 {
     IPSP.Model.TPCase_Patent model = new IPSP.Model.TPCase_Patent();
     if (row != null)
     {
         if (row["n_CaseID"] != null && row["n_CaseID"].ToString() != "")
         {
             model.n_CaseID = int.Parse(row["n_CaseID"].ToString());
         }
         if (row["n_PFlowNum"] != null && row["n_PFlowNum"].ToString() != "")
         {
             model.n_PFlowNum = int.Parse(row["n_PFlowNum"].ToString());
         }
         if (row["n_LawID"] != null && row["n_LawID"].ToString() != "")
         {
             model.n_LawID = int.Parse(row["n_LawID"].ToString());
         }
         if (row["n_PatentTypeID"] != null && row["n_PatentTypeID"].ToString() != "")
         {
             model.n_PatentTypeID = int.Parse(row["n_PatentTypeID"].ToString());
         }
         if (row["s_TechnologyType"] != null)
         {
             model.s_TechnologyType = row["s_TechnologyType"].ToString();
         }
         if (row["s_OldSerial"] != null)
         {
             model.s_OldSerial = row["s_OldSerial"].ToString();
         }
         if (row["s_NPatentID"] != null)
         {
             model.s_NPatentID = row["s_NPatentID"].ToString();
         }
         if (row["s_OrigCaseSerial"] != null)
         {
             model.s_OrigCaseSerial = row["s_OrigCaseSerial"].ToString();
         }
         if (row["s_OrigAppNo"] != null)
         {
             model.s_OrigAppNo = row["s_OrigAppNo"].ToString();
         }
         if (row["dt_OrigAppDate"] != null && row["dt_OrigAppDate"].ToString() != "")
         {
             model.dt_OrigAppDate = DateTime.Parse(row["dt_OrigAppDate"].ToString());
         }
         if (row["s_PatentStatus"] != null)
         {
             model.s_PatentStatus = row["s_PatentStatus"].ToString();
         }
         if (row["s_Notes"] != null)
         {
             model.s_Notes = row["s_Notes"].ToString();
         }
         if (row["n_OrigPatInfoID"] != null && row["n_OrigPatInfoID"].ToString() != "")
         {
             model.n_OrigPatInfoID = int.Parse(row["n_OrigPatInfoID"].ToString());
         }
         if (row["s_Inventors"] != null)
         {
             model.s_Inventors = row["s_Inventors"].ToString();
         }
         if (row["dt_RequestSubmitDate"] != null && row["dt_RequestSubmitDate"].ToString() != "")
         {
             model.dt_RequestSubmitDate = DateTime.Parse(row["dt_RequestSubmitDate"].ToString());
         }
         if (row["b_DivisionalCaseFlag"] != null && row["b_DivisionalCaseFlag"].ToString() != "")
         {
             if ((row["b_DivisionalCaseFlag"].ToString() == "1") || (row["b_DivisionalCaseFlag"].ToString().ToLower() == "true"))
             {
                 model.b_DivisionalCaseFlag = true;
             }
             else
             {
                 model.b_DivisionalCaseFlag = false;
             }
         }
         if (row["s_OrigCaseNo"] != null)
         {
             model.s_OrigCaseNo = row["s_OrigCaseNo"].ToString();
         }
         if (row["s_AllInventorAddress"] != null)
         {
             model.s_AllInventorAddress = row["s_AllInventorAddress"].ToString();
         }
         if (row["s_FristPriority"] != null)
         {
             model.s_FristPriority = row["s_FristPriority"].ToString();
         }
         if (row["s_FirstPriorityNo"] != null)
         {
             model.s_FirstPriorityNo = row["s_FirstPriorityNo"].ToString();
         }
         if (row["dt_FirstPriorityDate"] != null && row["dt_FirstPriorityDate"].ToString() != "")
         {
             model.dt_FirstPriorityDate = DateTime.Parse(row["dt_FirstPriorityDate"].ToString());
         }
         if (row["s_FirstInventor"] != null)
         {
             model.s_FirstInventor = row["s_FirstInventor"].ToString();
         }
         if (row["s_PriorityStatus"] != null)
         {
             model.s_PriorityStatus = row["s_PriorityStatus"].ToString();
         }
         if (row["dt_PriorityStatusDate"] != null && row["dt_PriorityStatusDate"].ToString() != "")
         {
             model.dt_PriorityStatusDate = DateTime.Parse(row["dt_PriorityStatusDate"].ToString());
         }
         if (row["dt_DivSubmitDate"] != null && row["dt_DivSubmitDate"].ToString() != "")
         {
             model.dt_DivSubmitDate = DateTime.Parse(row["dt_DivSubmitDate"].ToString());
         }
         if (row["s_DivisionAppNo"] != null)
         {
             model.s_DivisionAppNo = row["s_DivisionAppNo"].ToString();
         }
         if (row["s_DivisionCaseNo"] != null)
         {
             model.s_DivisionCaseNo = row["s_DivisionCaseNo"].ToString();
         }
     }
     return(model);
 }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(IPSP.Model.TPCase_Patent model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(IPSP.Model.TPCase_Patent model)
 {
     return(dal.Add(model));
 }