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

            strSql.Append("insert into TCode_PreferentialPolicyInCombine(");
            strSql.Append("n_Sequence,n_CodePreferentialCombineID,n_PreferentialPolicyID)");
            strSql.Append(" values (");
            strSql.Append("@n_Sequence,@n_CodePreferentialCombineID,@n_PreferentialPolicyID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_Sequence",                  SqlDbType.Int, 4),
                new SqlParameter("@n_CodePreferentialCombineID", SqlDbType.Int, 4),
                new SqlParameter("@n_PreferentialPolicyID",      SqlDbType.Int, 4)
            };
            parameters[0].Value = model.n_Sequence;
            parameters[1].Value = model.n_CodePreferentialCombineID;
            parameters[2].Value = model.n_PreferentialPolicyID;

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

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

            strSql.Append("update TCode_PreferentialPolicyInCombine set ");
            strSql.Append("n_Sequence=@n_Sequence,");
            strSql.Append("n_PreferentialPolicyID=@n_PreferentialPolicyID");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_Sequence",                  SqlDbType.Int, 4),
                new SqlParameter("@n_PreferentialPolicyID",      SqlDbType.Int, 4),
                new SqlParameter("@n_ID",                        SqlDbType.Int, 4),
                new SqlParameter("@n_CodePreferentialCombineID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.n_Sequence;
            parameters[1].Value = model.n_PreferentialPolicyID;
            parameters[2].Value = model.n_ID;
            parameters[3].Value = model.n_CodePreferentialCombineID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TCode_PreferentialPolicyInCombine DataRowToModel(DataRow row)
 {
     IPSP.Model.TCode_PreferentialPolicyInCombine model = new IPSP.Model.TCode_PreferentialPolicyInCombine();
     if (row != null)
     {
         if (row["n_ID"] != null && row["n_ID"].ToString() != "")
         {
             model.n_ID = int.Parse(row["n_ID"].ToString());
         }
         if (row["n_Sequence"] != null && row["n_Sequence"].ToString() != "")
         {
             model.n_Sequence = int.Parse(row["n_Sequence"].ToString());
         }
         if (row["n_CodePreferentialCombineID"] != null && row["n_CodePreferentialCombineID"].ToString() != "")
         {
             model.n_CodePreferentialCombineID = int.Parse(row["n_CodePreferentialCombineID"].ToString());
         }
         if (row["n_PreferentialPolicyID"] != null && row["n_PreferentialPolicyID"].ToString() != "")
         {
             model.n_PreferentialPolicyID = int.Parse(row["n_PreferentialPolicyID"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TCode_PreferentialPolicyInCombine GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_ID,n_Sequence,n_CodePreferentialCombineID,n_PreferentialPolicyID from TCode_PreferentialPolicyInCombine ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

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