public bool UpdateFile(CUSTOMRP.Model.WORDFILE model) { StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE [WORDFILE] SET "); strSql.Append("[WordFileName] = @WordFileName,"); strSql.Append("[OrigFileName] = @OrigFileName,"); strSql.Append("[Description] = @Description,"); strSql.Append("[WordTemplateID] = @WordTemplateID,"); strSql.Append("[ModifyDate] = @ModifyDate,"); strSql.Append("[ModifyUser] = @ModifyUser"); strSql.Append(" WHERE [RPID] = @RPID"); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@WordFileName", model.WordFileName), new SqlParameter("@OrigFileName", model.OrigFileName), new SqlParameter("@Description", model.Description), new SqlParameter("@WordTemplateID", model.WordTemplateID), new SqlParameter("@ModifyDate", model.ModifyDate), new SqlParameter("@ModifyUser", model.ModifyUser), new SqlParameter("@RPID", model.RPID), }; int rows = DbHelperSQL.ExecuteSql(model.ModifyUser, strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public int AddFile(CUSTOMRP.Model.WORDFILE model) { StringBuilder strSql = new StringBuilder(); strSql.Append("INSERT INTO [WORDFILE]("); strSql.Append("[WordFileName],[OrigFileName],[Description],[WordTemplateID],[RPID],[ModifyDate],[ModifyUser],[CreateDate],[CreateUser]"); strSql.Append(") VALUES ("); strSql.Append("@WordFileName,@OrigFileName,@Description,@WordTemplateID,@RPID,@ModifyDate,@ModifyUser,@CreateDate,@CreateUser"); strSql.Append(");select @@IDENTITY"); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@WordFileName", model.WordFileName), new SqlParameter("@OrigFileName", model.OrigFileName), new SqlParameter("@Description", model.Description), new SqlParameter("@WordTemplateID", model.WordTemplateID), new SqlParameter("@RPID", model.RPID), new SqlParameter("@ModifyDate", model.ModifyDate), new SqlParameter("@ModifyUser", model.ModifyUser), new SqlParameter("@CreateDate", model.CreateDate), new SqlParameter("@CreateUser", model.CreateUser), }; object obj = DbHelperSQL.GetSingle(model.ModifyUser, strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// Convert DataRow to POCO object of WordFile /// </summary> /// <param name="row">DataRow to be converted</param> /// <returns></returns> private CUSTOMRP.Model.WORDFILE DataRowToModel(DataRow row) { CUSTOMRP.Model.WORDFILE model = new CUSTOMRP.Model.WORDFILE(); if (row != null) { if (row["WordFileID"] != null) { model.WordFileID = Convert.ToInt32(row["WordFileID"]); } if (row["WordFileName"] != null) { model.WordFileName = Convert.ToString(row["WordFileName"]); } if (row["OrigFileName"] != null) { model.OrigFileName = Convert.ToString(row["OrigFileName"]); } if (row["Description"] != null) { model.Description = Convert.ToString(row["Description"]); } if (row["WordTemplateID"] != null) { model.WordTemplateID = Convert.ToInt32(row["WordTemplateID"]); } if (row["RPID"] != null) { model.RPID = Convert.ToInt32(row["RPID"]); } if (row["ModifyDate"] != null) { model.ModifyDate = Convert.ToDateTime(row["ModifyDate"]); } if (row["ModifyUser"] != null) { model.ModifyUser = Convert.ToInt32(row["ModifyUser"]); } if (row["CreateDate"] != null) { model.CreateDate = Convert.ToDateTime(row["CreateDate"]); } if (row["CreateUser"] != null) { model.CreateUser = Convert.ToInt32(row["CreateUser"]); } } return(model); }
public bool UpdateFile(CUSTOMRP.Model.WORDFILE model) { return(dal.UpdateFile(model)); }
public int AddFile(CUSTOMRP.Model.WORDFILE model) { return(dal.AddFile(model)); }