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

            strSql.Append("insert into T_EmailInFolder(");
            strSql.Append("n_EmailID,n_FolderID)");
            strSql.Append(" values (");
            strSql.Append("@n_EmailID,@n_FolderID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_EmailID",  SqlDbType.Int, 4),
                new SqlParameter("@n_FolderID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.n_EmailID;
            parameters[1].Value = model.n_FolderID;

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

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

            strSql.Append("update T_EmailInFolder set ");
#warning 系统发现缺少更新的字段,请手工确认如此更新是否正确!
            strSql.Append("n_ID=@n_ID,");
            strSql.Append("n_EmailID=@n_EmailID,");
            strSql.Append("n_FolderID=@n_FolderID");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID",       SqlDbType.Int, 4),
                new SqlParameter("@n_EmailID",  SqlDbType.Int, 4),
                new SqlParameter("@n_FolderID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.n_ID;
            parameters[1].Value = model.n_EmailID;
            parameters[2].Value = model.n_FolderID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.T_EmailInFolder DataRowToModel(DataRow row)
 {
     IPSP.Model.T_EmailInFolder model = new IPSP.Model.T_EmailInFolder();
     if (row != null)
     {
         if (row["n_ID"] != null && row["n_ID"].ToString() != "")
         {
             model.n_ID = int.Parse(row["n_ID"].ToString());
         }
         if (row["n_EmailID"] != null && row["n_EmailID"].ToString() != "")
         {
             model.n_EmailID = int.Parse(row["n_EmailID"].ToString());
         }
         if (row["n_FolderID"] != null && row["n_FolderID"].ToString() != "")
         {
             model.n_FolderID = int.Parse(row["n_FolderID"].ToString());
         }
     }
     return(model);
 }
Esempio n. 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.T_EmailInFolder GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

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

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