コード例 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(CardCenter.Entity.FileList model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update FileList set ");
            strSql.Append("FileType=@FileType,");
            strSql.Append("FileName=@FileName,");
            strSql.Append("JobID=@JobID,");
            strSql.Append("ListID=@ListID,");
            strSql.Append("IsDelete=@IsDelete,");
            strSql.Append("Remark=@Remark");
            strSql.Append(" where Guid=@Guid ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FileType", SqlDbType.NVarChar,   8),
                new SqlParameter("@FileName", SqlDbType.NVarChar, 128),
                new SqlParameter("@JobID",    SqlDbType.NVarChar,  64),
                new SqlParameter("@ListID",   SqlDbType.NVarChar,  64),
                new SqlParameter("@IsDelete", SqlDbType.Bit,        1),
                new SqlParameter("@Remark",   SqlDbType.NVarChar, 512),
                new SqlParameter("@Guid",     SqlDbType.NVarChar, 64)
            };
            parameters[0].Value = model.FileType;
            parameters[1].Value = model.FileName;
            parameters[2].Value = model.JobID;
            parameters[3].Value = model.ListID;
            parameters[4].Value = model.IsDelete;
            parameters[5].Value = model.Remark;
            parameters[6].Value = model.Guid;

            TranHelper.AddTran(strSql, parameters);
        }
コード例 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(CardCenter.Entity.FileList model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into FileList(");
            strSql.Append("Guid,FileType,FileName,JobID,ListID,IsDelete,Remark)");
            strSql.Append(" values (");
            strSql.Append("@Guid,@FileType,@FileName,@JobID,@ListID,@IsDelete,@Remark)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Guid",     SqlDbType.NVarChar,  64),
                new SqlParameter("@FileType", SqlDbType.NVarChar,   8),
                new SqlParameter("@FileName", SqlDbType.NVarChar, 128),
                new SqlParameter("@JobID",    SqlDbType.NVarChar,  64),
                new SqlParameter("@ListID",   SqlDbType.NVarChar,  64),
                new SqlParameter("@IsDelete", SqlDbType.Bit,        1),
                new SqlParameter("@Remark",   SqlDbType.NVarChar, 512)
            };
            parameters[0].Value = model.Guid;
            parameters[1].Value = model.FileType;
            parameters[2].Value = model.FileName;
            parameters[3].Value = model.JobID;
            parameters[4].Value = model.ListID;
            parameters[5].Value = model.IsDelete;
            parameters[6].Value = model.Remark;

            TranHelper.AddTran(strSql, parameters);
        }
コード例 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public CardCenter.Entity.FileList DataRowToModel(DataRow row)
 {
     CardCenter.Entity.FileList model = new CardCenter.Entity.FileList();
     if (row != null)
     {
         if (row["Guid"] != null)
         {
             model.Guid = row["Guid"].ToString();
         }
         if (row["FileType"] != null)
         {
             model.FileType = row["FileType"].ToString();
         }
         if (row["FileName"] != null)
         {
             model.FileName = row["FileName"].ToString();
         }
         if (row["JobID"] != null)
         {
             model.JobID = row["JobID"].ToString();
         }
         if (row["ListID"] != null)
         {
             model.ListID = row["ListID"].ToString();
         }
         if (row["IsDelete"] != null && row["IsDelete"].ToString() != "")
         {
             if ((row["IsDelete"].ToString() == "1") || (row["IsDelete"].ToString().ToLower() == "true"))
             {
                 model.IsDelete = true;
             }
             else
             {
                 model.IsDelete = false;
             }
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
     }
     return(model);
 }
コード例 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public CardCenter.Entity.FileList GetModel(string Guid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Guid,FileType,FileName,JobID,ListID,IsDelete,Remark from FileList ");
            strSql.Append(" where Guid=@Guid ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Guid", SqlDbType.NVarChar, 64)
            };
            parameters[0].Value = Guid;

            CardCenter.Entity.FileList model = new CardCenter.Entity.FileList();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }