/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.T_EmailFolder model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into T_EmailFolder("); strSql.Append("s_FolderName,n_UpperFolderID,n_UserID)"); strSql.Append(" values ("); strSql.Append("@s_FolderName,@n_UpperFolderID,@n_UserID)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@s_FolderName", SqlDbType.NVarChar, 50), new SqlParameter("@n_UpperFolderID", SqlDbType.Int, 4), new SqlParameter("@n_UserID", SqlDbType.Int, 4) }; parameters[0].Value = model.s_FolderName; parameters[1].Value = model.n_UpperFolderID; parameters[2].Value = model.n_UserID; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(IPSP.Model.T_EmailFolder model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update T_EmailFolder set "); strSql.Append("s_FolderName=@s_FolderName,"); strSql.Append("n_UpperFolderID=@n_UpperFolderID"); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@s_FolderName", SqlDbType.NVarChar, 50), new SqlParameter("@n_UpperFolderID", SqlDbType.Int, 4), new SqlParameter("@n_ID", SqlDbType.Int, 4), new SqlParameter("@n_UserID", SqlDbType.Int, 4) }; parameters[0].Value = model.s_FolderName; parameters[1].Value = model.n_UpperFolderID; parameters[2].Value = model.n_ID; parameters[3].Value = model.n_UserID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.T_EmailFolder DataRowToModel(DataRow row) { IPSP.Model.T_EmailFolder model = new IPSP.Model.T_EmailFolder(); if (row != null) { if (row["n_ID"] != null && row["n_ID"].ToString() != "") { model.n_ID = int.Parse(row["n_ID"].ToString()); } if (row["s_FolderName"] != null) { model.s_FolderName = row["s_FolderName"].ToString(); } if (row["n_UpperFolderID"] != null && row["n_UpperFolderID"].ToString() != "") { model.n_UpperFolderID = int.Parse(row["n_UpperFolderID"].ToString()); } if (row["n_UserID"] != null && row["n_UserID"].ToString() != "") { model.n_UserID = int.Parse(row["n_UserID"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public IPSP.Model.T_EmailFolder GetModel(int n_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 n_ID,s_FolderName,n_UpperFolderID,n_UserID from T_EmailFolder "); strSql.Append(" where n_ID=@n_ID"); SqlParameter[] parameters = { new SqlParameter("@n_ID", SqlDbType.Int, 4) }; parameters[0].Value = n_ID; IPSP.Model.T_EmailFolder model = new IPSP.Model.T_EmailFolder(); 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.T_EmailFolder model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(IPSP.Model.T_EmailFolder model) { return(dal.Add(model)); }