Example #1
0
        public int Add(FileTypeModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into F_FileType(");
            builder.Append("TypeId,TypeName,TypeImg,TypeSuffix)");
            builder.Append(" values (");
            builder.Append("@TypeId,@TypeName,@TypeImg,@TypeSuffix)");
            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@TypeId", SqlDbType.NVarChar, 0x40), new SqlParameter("@TypeName", SqlDbType.NVarChar, 0x40), new SqlParameter("@TypeImg", SqlDbType.NVarChar, 200), new SqlParameter("@TypeSuffix", SqlDbType.NVarChar, 0x40) };
            commandParameters[0].Value = model.TypeId;
            commandParameters[1].Value = model.TypeName;
            commandParameters[2].Value = model.TypeImg;
            commandParameters[3].Value = model.TypeSuffix;
            return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters));
        }
Example #2
0
        public int Update(FileTypeModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update F_FileType set ");
            builder.Append("TypeName=@TypeName,");
            builder.Append("TypeImg=@TypeImg,");
            builder.Append("TypeSuffix=@TypeSuffix");
            builder.Append(" where TypeId=@TypeId ");
            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@TypeId", SqlDbType.NVarChar, 0x40), new SqlParameter("@TypeName", SqlDbType.NVarChar, 0x40), new SqlParameter("@TypeImg", SqlDbType.NVarChar, 200), new SqlParameter("@TypeSuffix", SqlDbType.NVarChar, 0x40) };
            commandParameters[0].Value = model.TypeId;
            commandParameters[1].Value = model.TypeName;
            commandParameters[2].Value = model.TypeImg;
            commandParameters[3].Value = model.TypeSuffix;
            return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters));
        }
Example #3
0
        public FileTypeModel GetModel(string TypeId)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("select TypeId,TypeName,TypeImg,TypeSuffix from F_FileType ");
            builder.Append(" where TypeId=@TypeId ");
            FileTypeModel model = null;

            using (IDataReader reader = SqlHelper.ExecuteReader(CommandType.Text, builder.ToString(), new SqlParameter[] { new SqlParameter("@TypeId", TypeId) }))
            {
                if (reader.Read())
                {
                    model = this.ReaderBind(reader);
                }
            }
            return(model);
        }
Example #4
0
 public int Update(FileTypeModel model)
 {
     return(this.fileType.Update(model));
 }
Example #5
0
 public int Add(FileTypeModel model)
 {
     return(this.fileType.Add(model));
 }