示例#1
0
        public void DeleteModel(QcmaininfologModel model)
        {
            QcmaininfologTable table = new QcmaininfologTable();

            DataAccess.DefaultDB.Delete(table)
            .Execute();
        }
示例#2
0
        public void CheckModel(QcmaininfologModel model, bool isNew)
        {
            Validator v = new Validator();

            //Check model's data here.
            if (!v.IsValid)
            {
                throw new ValidationException(v);
            }
        }
示例#3
0
        public void AddModel(QcmaininfologModel model, DbTransaction tran)
        {
            QcmaininfologTable table = new QcmaininfologTable();

            DataAccess.DefaultDB.Insert(table).SetTransaction(tran)
            .AddColumn(table.QualityCode, model.QualityCode)
            .AddColumn(table.Status, model.Status)
            .AddColumn(table.EditReason, model.EditReason)
            .AddColumn(table.EditorContent, model.EditorContent)
            .AddColumn(table.Editor, model.Editor)
            .AddColumn(table.EditorTime, model.EditorTime)
            .Execute();
        }
示例#4
0
        protected bool Exists(QcmaininfologModel model, bool isNew)
        {
            QcmaininfologTable table = new QcmaininfologTable();
            SelectSqlSection   sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                       .Where(table.QualityCode == model.QualityCode &&
                                              table.Status == model.Status &&
                                              table.EditReason == model.EditReason &&
                                              table.EditorContent == model.EditorContent &&
                                              table.Editor == model.Editor &&
                                              table.EditorTime == model.EditorTime
                                              );

            return(sql.ToScalar <int>() > 0);
        }
示例#5
0
        public void UpdateModel(QcmaininfologModel model)
        {
            //model.UpdateTime = System.DateTime.Now;
            QcmaininfologTable table = new QcmaininfologTable();

            DataAccess.DefaultDB.Update(table)
            .AddColumn(table.QualityCode, model.QualityCode)
            .AddColumn(table.Status, model.Status)
            .AddColumn(table.EditReason, model.EditReason)
            .AddColumn(table.EditorContent, model.EditorContent)
            .AddColumn(table.Editor, model.Editor)
            .AddColumn(table.EditorTime, model.EditorTime)
            .Execute();
        }
示例#6
0
        public QcmaininfologModelList GetModelList(QcmaininfologModel model)
        {
            QcmaininfologTable table = new QcmaininfologTable();
            SelectSqlSection   sql   = DataAccess.DefaultDB.Select(table, table.AllColumns())
            ;

            using (SafeDataReader sdr = new SafeDataReader(sql.ToDataReader()))
            {
                QcmaininfologModelList result = new QcmaininfologModelList();
                while (sdr.Read())
                {
                    QcmaininfologModel m = new QcmaininfologModel();
                    m.QualityCode   = sdr.GetString(table.QualityCode);
                    m.Status        = sdr.GetString(table.Status);
                    m.EditReason    = sdr.GetString(table.EditReason);
                    m.EditorContent = sdr.GetString(table.EditorContent);
                    m.Editor        = sdr.GetString(table.Editor);
                    m.EditorTime    = sdr.GetDateTime(table.EditorTime);
                    result.Add(m);
                }
                return(result);
            }
        }