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

            strSql.Append("insert into TTCase_SearchInfo(");
            strSql.Append("n_CaseID,s_SearchAim,s_SearchType,s_ReqDesc,s_SearchNumber,s_AppNumber,s_SearchAppDate,dt_AppDate,s_SearchApplicant,s_Applicant,s_SearchTMName,s_TMName,s_SearchResult,dt_SearchDate,s_SearchTypeCode)");
            strSql.Append(" values (");
            strSql.Append("@n_CaseID,@s_SearchAim,@s_SearchType,@s_ReqDesc,@s_SearchNumber,@s_AppNumber,@s_SearchAppDate,@dt_AppDate,@s_SearchApplicant,@s_Applicant,@s_SearchTMName,@s_TMName,@s_SearchResult,@dt_SearchDate,@s_SearchTypeCode)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_CaseID",          SqlDbType.Int,         4),
                new SqlParameter("@s_SearchAim",       SqlDbType.NVarChar,  200),
                new SqlParameter("@s_SearchType",      SqlDbType.NVarChar,   50),
                new SqlParameter("@s_ReqDesc",         SqlDbType.NVarChar,  500),
                new SqlParameter("@s_SearchNumber",    SqlDbType.NVarChar,    1),
                new SqlParameter("@s_AppNumber",       SqlDbType.NVarChar,   50),
                new SqlParameter("@s_SearchAppDate",   SqlDbType.NVarChar,    1),
                new SqlParameter("@dt_AppDate",        SqlDbType.DateTime),
                new SqlParameter("@s_SearchApplicant", SqlDbType.NVarChar,    1),
                new SqlParameter("@s_Applicant",       SqlDbType.NVarChar,  300),
                new SqlParameter("@s_SearchTMName",    SqlDbType.NVarChar,    1),
                new SqlParameter("@s_TMName",          SqlDbType.NVarChar,  300),
                new SqlParameter("@s_SearchResult",    SqlDbType.NVarChar,  500),
                new SqlParameter("@dt_SearchDate",     SqlDbType.DateTime),
                new SqlParameter("@s_SearchTypeCode",  SqlDbType.NVarChar, 20)
            };
            parameters[0].Value  = model.n_CaseID;
            parameters[1].Value  = model.s_SearchAim;
            parameters[2].Value  = model.s_SearchType;
            parameters[3].Value  = model.s_ReqDesc;
            parameters[4].Value  = model.s_SearchNumber;
            parameters[5].Value  = model.s_AppNumber;
            parameters[6].Value  = model.s_SearchAppDate;
            parameters[7].Value  = model.dt_AppDate;
            parameters[8].Value  = model.s_SearchApplicant;
            parameters[9].Value  = model.s_Applicant;
            parameters[10].Value = model.s_SearchTMName;
            parameters[11].Value = model.s_TMName;
            parameters[12].Value = model.s_SearchResult;
            parameters[13].Value = model.dt_SearchDate;
            parameters[14].Value = model.s_SearchTypeCode;

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

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

            strSql.Append("select  top 1 n_ID,n_CaseID,s_SearchAim,s_SearchType,s_ReqDesc,s_SearchNumber,s_AppNumber,s_SearchAppDate,dt_AppDate,s_SearchApplicant,s_Applicant,s_SearchTMName,s_TMName,s_SearchResult,dt_SearchDate,s_SearchTypeCode from TTCase_SearchInfo ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(IPSP.Model.TTCase_SearchInfo model)
 {
     return(dal.Update(model));
 }
Esempio n. 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(IPSP.Model.TTCase_SearchInfo model)
 {
     return(dal.Add(model));
 }
Esempio n. 5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TTCase_SearchInfo DataRowToModel(DataRow row)
 {
     IPSP.Model.TTCase_SearchInfo model = new IPSP.Model.TTCase_SearchInfo();
     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_SearchAim"] != null)
         {
             model.s_SearchAim = row["s_SearchAim"].ToString();
         }
         if (row["s_SearchType"] != null)
         {
             model.s_SearchType = row["s_SearchType"].ToString();
         }
         if (row["s_ReqDesc"] != null)
         {
             model.s_ReqDesc = row["s_ReqDesc"].ToString();
         }
         if (row["s_SearchNumber"] != null)
         {
             model.s_SearchNumber = row["s_SearchNumber"].ToString();
         }
         if (row["s_AppNumber"] != null)
         {
             model.s_AppNumber = row["s_AppNumber"].ToString();
         }
         if (row["s_SearchAppDate"] != null)
         {
             model.s_SearchAppDate = row["s_SearchAppDate"].ToString();
         }
         if (row["dt_AppDate"] != null && row["dt_AppDate"].ToString() != "")
         {
             model.dt_AppDate = DateTime.Parse(row["dt_AppDate"].ToString());
         }
         if (row["s_SearchApplicant"] != null)
         {
             model.s_SearchApplicant = row["s_SearchApplicant"].ToString();
         }
         if (row["s_Applicant"] != null)
         {
             model.s_Applicant = row["s_Applicant"].ToString();
         }
         if (row["s_SearchTMName"] != null)
         {
             model.s_SearchTMName = row["s_SearchTMName"].ToString();
         }
         if (row["s_TMName"] != null)
         {
             model.s_TMName = row["s_TMName"].ToString();
         }
         if (row["s_SearchResult"] != null)
         {
             model.s_SearchResult = row["s_SearchResult"].ToString();
         }
         if (row["dt_SearchDate"] != null && row["dt_SearchDate"].ToString() != "")
         {
             model.dt_SearchDate = DateTime.Parse(row["dt_SearchDate"].ToString());
         }
         if (row["s_SearchTypeCode"] != null)
         {
             model.s_SearchTypeCode = row["s_SearchTypeCode"].ToString();
         }
     }
     return(model);
 }
Esempio n. 6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TTCase_SearchInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TTCase_SearchInfo set ");
            strSql.Append("s_SearchAim=@s_SearchAim,");
            strSql.Append("s_SearchType=@s_SearchType,");
            strSql.Append("s_ReqDesc=@s_ReqDesc,");
            strSql.Append("s_SearchNumber=@s_SearchNumber,");
            strSql.Append("s_AppNumber=@s_AppNumber,");
            strSql.Append("s_SearchAppDate=@s_SearchAppDate,");
            strSql.Append("dt_AppDate=@dt_AppDate,");
            strSql.Append("s_SearchApplicant=@s_SearchApplicant,");
            strSql.Append("s_Applicant=@s_Applicant,");
            strSql.Append("s_SearchTMName=@s_SearchTMName,");
            strSql.Append("s_TMName=@s_TMName,");
            strSql.Append("s_SearchResult=@s_SearchResult,");
            strSql.Append("dt_SearchDate=@dt_SearchDate,");
            strSql.Append("s_SearchTypeCode=@s_SearchTypeCode");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@s_SearchAim",       SqlDbType.NVarChar,  200),
                new SqlParameter("@s_SearchType",      SqlDbType.NVarChar,   50),
                new SqlParameter("@s_ReqDesc",         SqlDbType.NVarChar,  500),
                new SqlParameter("@s_SearchNumber",    SqlDbType.NVarChar,    1),
                new SqlParameter("@s_AppNumber",       SqlDbType.NVarChar,   50),
                new SqlParameter("@s_SearchAppDate",   SqlDbType.NVarChar,    1),
                new SqlParameter("@dt_AppDate",        SqlDbType.DateTime),
                new SqlParameter("@s_SearchApplicant", SqlDbType.NVarChar,    1),
                new SqlParameter("@s_Applicant",       SqlDbType.NVarChar,  300),
                new SqlParameter("@s_SearchTMName",    SqlDbType.NVarChar,    1),
                new SqlParameter("@s_TMName",          SqlDbType.NVarChar,  300),
                new SqlParameter("@s_SearchResult",    SqlDbType.NVarChar,  500),
                new SqlParameter("@dt_SearchDate",     SqlDbType.DateTime),
                new SqlParameter("@s_SearchTypeCode",  SqlDbType.NVarChar,   20),
                new SqlParameter("@n_ID",              SqlDbType.Int,         4),
                new SqlParameter("@n_CaseID",          SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.s_SearchAim;
            parameters[1].Value  = model.s_SearchType;
            parameters[2].Value  = model.s_ReqDesc;
            parameters[3].Value  = model.s_SearchNumber;
            parameters[4].Value  = model.s_AppNumber;
            parameters[5].Value  = model.s_SearchAppDate;
            parameters[6].Value  = model.dt_AppDate;
            parameters[7].Value  = model.s_SearchApplicant;
            parameters[8].Value  = model.s_Applicant;
            parameters[9].Value  = model.s_SearchTMName;
            parameters[10].Value = model.s_TMName;
            parameters[11].Value = model.s_SearchResult;
            parameters[12].Value = model.dt_SearchDate;
            parameters[13].Value = model.s_SearchTypeCode;
            parameters[14].Value = model.n_ID;
            parameters[15].Value = model.n_CaseID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }