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

            strSql.Append("insert into TTCase_StatusHistory(");
            strSql.Append("n_CaseID,s_OldStatus,s_NewStatus,dt_StatusChangeDate,s_Notes)");
            strSql.Append(" values (");
            strSql.Append("@n_CaseID,@s_OldStatus,@s_NewStatus,@dt_StatusChangeDate,@s_Notes)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_CaseID",            SqlDbType.Int,        4),
                new SqlParameter("@s_OldStatus",         SqlDbType.NVarChar,  50),
                new SqlParameter("@s_NewStatus",         SqlDbType.NVarChar,  50),
                new SqlParameter("@dt_StatusChangeDate", SqlDbType.DateTime),
                new SqlParameter("@s_Notes",             SqlDbType.NVarChar, 800)
            };
            parameters[0].Value = model.n_CaseID;
            parameters[1].Value = model.s_OldStatus;
            parameters[2].Value = model.s_NewStatus;
            parameters[3].Value = model.dt_StatusChangeDate;
            parameters[4].Value = model.s_Notes;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TTCase_StatusHistory DataRowToModel(DataRow row)
 {
     IPSP.Model.TTCase_StatusHistory model = new IPSP.Model.TTCase_StatusHistory();
     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_OldStatus"] != null)
         {
             model.s_OldStatus = row["s_OldStatus"].ToString();
         }
         if (row["s_NewStatus"] != null)
         {
             model.s_NewStatus = row["s_NewStatus"].ToString();
         }
         if (row["dt_StatusChangeDate"] != null && row["dt_StatusChangeDate"].ToString() != "")
         {
             model.dt_StatusChangeDate = DateTime.Parse(row["dt_StatusChangeDate"].ToString());
         }
         if (row["s_Notes"] != null)
         {
             model.s_Notes = row["s_Notes"].ToString();
         }
     }
     return(model);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TTCase_StatusHistory model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TTCase_StatusHistory set ");
            strSql.Append("s_OldStatus=@s_OldStatus,");
            strSql.Append("s_NewStatus=@s_NewStatus,");
            strSql.Append("dt_StatusChangeDate=@dt_StatusChangeDate,");
            strSql.Append("s_Notes=@s_Notes");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@s_OldStatus",         SqlDbType.NVarChar,   50),
                new SqlParameter("@s_NewStatus",         SqlDbType.NVarChar,   50),
                new SqlParameter("@dt_StatusChangeDate", SqlDbType.DateTime),
                new SqlParameter("@s_Notes",             SqlDbType.NVarChar,  800),
                new SqlParameter("@n_ID",                SqlDbType.Int,         4),
                new SqlParameter("@n_CaseID",            SqlDbType.Int, 4)
            };
            parameters[0].Value = model.s_OldStatus;
            parameters[1].Value = model.s_NewStatus;
            parameters[2].Value = model.dt_StatusChangeDate;
            parameters[3].Value = model.s_Notes;
            parameters[4].Value = model.n_ID;
            parameters[5].Value = model.n_CaseID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TTCase_StatusHistory GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_ID,n_CaseID,s_OldStatus,s_NewStatus,dt_StatusChangeDate,s_Notes from TTCase_StatusHistory ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

            IPSP.Model.TTCase_StatusHistory model = new IPSP.Model.TTCase_StatusHistory();
            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.TTCase_StatusHistory model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(IPSP.Model.TTCase_StatusHistory model)
 {
     return(dal.Add(model));
 }