示例#1
0
        public override SqlParameter[] GetParameters()
        {
            M_Com_File model = this;

            if (model.CDate <= DateTime.MinValue)
            {
                model.CDate = DateTime.Now;
            }
            if (model.UpdateTime <= DateTime.MinValue)
            {
                model.UpdateTime = DateTime.Now;
            }
            if (string.IsNullOrEmpty(model.FileGuid))
            {
                model.FileGuid = Guid.NewGuid().ToString();
            }
            SqlParameter[] sp = GetSP();
            sp[0].Value  = model.ID;
            sp[1].Value  = model.FileGuid;
            sp[2].Value  = model.FileName;
            sp[3].Value  = model.FileType;
            sp[4].Value  = model.Source;
            sp[5].Value  = model.UserID;
            sp[6].Value  = model.AdminID;
            sp[7].Value  = model.CDate;
            sp[8].Value  = model.UpdateTime;
            sp[9].Value  = model.Remind;
            sp[10].Value = model.FileContent;
            return(sp);
        }
示例#2
0
        public M_Com_File GetModelFromReader(DbDataReader rdr)
        {
            M_Com_File model = new M_Com_File();

            model.ID          = Convert.ToInt32(rdr["ID"]);
            model.FileGuid    = ConverToStr(rdr["FileGuid"]);
            model.FileName    = ConverToStr(rdr["FileName"]);
            model.FileType    = ConverToStr(rdr["FileType"]);
            model.Source      = ConverToStr(rdr["Source"]);
            model.UserID      = ConvertToInt(rdr["UserID"]);
            model.AdminID     = ConvertToInt(rdr["AdminID"]);
            model.CDate       = ConvertToDate(rdr["CDate"]);
            model.UpdateTime  = ConvertToDate(rdr["UpdateTime"]);
            model.Remind      = ConverToStr(rdr["Remind"]);
            model.FileContent = ConverToBytes(rdr["FileContent"]);
            rdr.Close();
            return(model);
        }