Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TCode_CaseProcess model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TCode_CaseProcess set ");
            strSql.Append("n_BizTypeID=@n_BizTypeID,");
            strSql.Append("s_PTCType=@s_PTCType,");
            strSql.Append("n_Country=@n_Country,");
            strSql.Append("s_IsDefault=@s_IsDefault,");
            strSql.Append("s_Notes=@s_Notes,");
            strSql.Append("s_IPType=@s_IPType");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_BizTypeID", SqlDbType.Int,        4),
                new SqlParameter("@s_PTCType",   SqlDbType.NVarChar,  50),
                new SqlParameter("@n_Country",   SqlDbType.Int,        4),
                new SqlParameter("@s_IsDefault", SqlDbType.NVarChar,   1),
                new SqlParameter("@s_Notes",     SqlDbType.NVarChar, 800),
                new SqlParameter("@s_IPType",    SqlDbType.NVarChar,   1),
                new SqlParameter("@n_ID",        SqlDbType.Int, 4)
            };
            parameters[0].Value = model.n_BizTypeID;
            parameters[1].Value = model.s_PTCType;
            parameters[2].Value = model.n_Country;
            parameters[3].Value = model.s_IsDefault;
            parameters[4].Value = model.s_Notes;
            parameters[5].Value = model.s_IPType;
            parameters[6].Value = model.n_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(IPSP.Model.TCode_CaseProcess model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TCode_CaseProcess(");
            strSql.Append("n_BizTypeID,s_PTCType,n_Country,s_IsDefault,s_Notes,s_IPType)");
            strSql.Append(" values (");
            strSql.Append("@n_BizTypeID,@s_PTCType,@n_Country,@s_IsDefault,@s_Notes,@s_IPType)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_BizTypeID", SqlDbType.Int,        4),
                new SqlParameter("@s_PTCType",   SqlDbType.NVarChar,  50),
                new SqlParameter("@n_Country",   SqlDbType.Int,        4),
                new SqlParameter("@s_IsDefault", SqlDbType.NVarChar,   1),
                new SqlParameter("@s_Notes",     SqlDbType.NVarChar, 800),
                new SqlParameter("@s_IPType",    SqlDbType.NVarChar, 1)
            };
            parameters[0].Value = model.n_BizTypeID;
            parameters[1].Value = model.s_PTCType;
            parameters[2].Value = model.n_Country;
            parameters[3].Value = model.s_IsDefault;
            parameters[4].Value = model.s_Notes;
            parameters[5].Value = model.s_IPType;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TCode_CaseProcess DataRowToModel(DataRow row)
 {
     IPSP.Model.TCode_CaseProcess model = new IPSP.Model.TCode_CaseProcess();
     if (row != null)
     {
         if (row["n_ID"] != null && row["n_ID"].ToString() != "")
         {
             model.n_ID = int.Parse(row["n_ID"].ToString());
         }
         if (row["n_BizTypeID"] != null && row["n_BizTypeID"].ToString() != "")
         {
             model.n_BizTypeID = int.Parse(row["n_BizTypeID"].ToString());
         }
         if (row["s_PTCType"] != null)
         {
             model.s_PTCType = row["s_PTCType"].ToString();
         }
         if (row["n_Country"] != null && row["n_Country"].ToString() != "")
         {
             model.n_Country = int.Parse(row["n_Country"].ToString());
         }
         if (row["s_IsDefault"] != null)
         {
             model.s_IsDefault = row["s_IsDefault"].ToString();
         }
         if (row["s_Notes"] != null)
         {
             model.s_Notes = row["s_Notes"].ToString();
         }
         if (row["s_IPType"] != null)
         {
             model.s_IPType = row["s_IPType"].ToString();
         }
     }
     return(model);
 }
Esempio n. 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TCode_CaseProcess GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_ID,n_BizTypeID,s_PTCType,n_Country,s_IsDefault,s_Notes,s_IPType from TCode_CaseProcess ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

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