Beispiel #1
0
        public M_Baike GetModelFromReader(DbDataReader rdr)
        {
            M_Baike model = new M_Baike();

            model.ID             = Convert.ToInt32(rdr["ID"]);
            model.Tittle         = ConverToStr(rdr["Tittle"]);
            model.UserId         = ConvertToInt(rdr["UserId"]);
            model.UserName       = ConverToStr(rdr["UserName"]);
            model.AddTime        = ConvertToDate(rdr["AddTime"]);
            model.Status         = ConvertToInt(rdr["Status"]);
            model.UpdateTime     = ConvertToDate(rdr["UpdateTime"]);
            model.Contents       = ConverToStr(rdr["Contents"]);
            model.Reference      = ConverToStr(rdr["Reference"]);
            model.Btype          = ConverToStr(rdr["Btype"]);
            model.Extend         = ConverToStr(rdr["Extend"]);
            model.Elite          = ConvertToInt(rdr["Elite"]);
            model.Brief          = ConverToStr(rdr["Brief"]);
            model.BriefImg       = ConverToStr(rdr["BriefImg"]);
            model.Classification = ConverToStr(rdr["Classification"]);
            model.Editnumb       = ConvertToInt(rdr["Editnumb"]);
            model.GradeIDS       = ConverToStr(rdr["GradeIDS"]);
            model.Flow           = ConverToStr(rdr["Flow"]);
            model.OldID          = ConvertToInt(rdr["OldID"]);
            model.VerStr         = ConverToStr(rdr["VerStr"]);
            rdr.Close();
            return(model);
        }
Beispiel #2
0
        public override SqlParameter[] GetParameters()
        {
            M_Baike model = this;

            if (AddTime <= DateTime.MinValue)
            {
                AddTime = DateTime.Now;
            }
            if (UpdateTime <= DateTime.MinValue)
            {
                UpdateTime = DateTime.Now;
            }
            if (string.IsNullOrEmpty(Flow))
            {
                Flow = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            }
            if (string.IsNullOrEmpty(VerStr))
            {
                VerStr = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            }
            SqlParameter[] sp = GetSP();
            sp[0].Value  = model.ID;
            sp[1].Value  = model.Tittle;
            sp[2].Value  = model.UserId;
            sp[3].Value  = model.UserName;
            sp[4].Value  = model.AddTime;
            sp[5].Value  = model.Status;
            sp[6].Value  = model.UpdateTime;
            sp[7].Value  = model.Contents;
            sp[8].Value  = model.Reference;
            sp[9].Value  = model.Btype;
            sp[10].Value = model.Extend;
            sp[11].Value = model.Elite;
            sp[12].Value = model.Brief;
            sp[13].Value = model.Classification;
            sp[14].Value = model.Editnumb;
            sp[15].Value = model.GradeIDS;
            sp[16].Value = model.BriefImg;
            sp[17].Value = model.Flow;
            sp[18].Value = model.OldID;
            sp[19].Value = model.VerStr;
            return(sp);
        }