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

            strSql.Append("insert into TPCase_ReviewInfo(");
            strSql.Append("n_CaseID,dt_RejectDate,s_Reason)");
            strSql.Append(" values (");
            strSql.Append("@n_CaseID,@dt_RejectDate,@s_Reason)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_CaseID",      SqlDbType.Int,       4),
                new SqlParameter("@dt_RejectDate", SqlDbType.DateTime),
                new SqlParameter("@s_Reason",      SqlDbType.NVarChar, 1000)
            };
            parameters[0].Value = model.n_CaseID;
            parameters[1].Value = model.dt_RejectDate;
            parameters[2].Value = model.s_Reason;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TPCase_ReviewInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TPCase_ReviewInfo set ");
            strSql.Append("dt_RejectDate=@dt_RejectDate,");
            strSql.Append("s_Reason=@s_Reason");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@dt_RejectDate", SqlDbType.DateTime),
                new SqlParameter("@s_Reason",      SqlDbType.NVarChar,1000),
                new SqlParameter("@n_ID",          SqlDbType.Int,       4),
                new SqlParameter("@n_CaseID",      SqlDbType.Int, 4)
            };
            parameters[0].Value = model.dt_RejectDate;
            parameters[1].Value = model.s_Reason;
            parameters[2].Value = model.n_ID;
            parameters[3].Value = model.n_CaseID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TPCase_ReviewInfo DataRowToModel(DataRow row)
 {
     IPSP.Model.TPCase_ReviewInfo model = new IPSP.Model.TPCase_ReviewInfo();
     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["dt_RejectDate"] != null && row["dt_RejectDate"].ToString() != "")
         {
             model.dt_RejectDate = DateTime.Parse(row["dt_RejectDate"].ToString());
         }
         if (row["s_Reason"] != null)
         {
             model.s_Reason = row["s_Reason"].ToString();
         }
     }
     return(model);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TPCase_ReviewInfo GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_ID,n_CaseID,dt_RejectDate,s_Reason from TPCase_ReviewInfo ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(IPSP.Model.TPCase_ReviewInfo model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(IPSP.Model.TPCase_ReviewInfo model)
 {
     return(dal.Add(model));
 }