Exemplo n.º 1
0
        public void DeleteModel(PbknitparameterModel model)
        {
            PbknitparameterTable table = new PbknitparameterTable();

            DataAccess.DefaultDB.Delete(table)
            .Execute();
        }
Exemplo n.º 2
0
        public void CheckModel(PbknitparameterModel model, bool isNew)
        {
            Validator v = new Validator();

            //Check model's data here.
            if (!v.IsValid)
            {
                throw new ValidationException(v);
            }
        }
Exemplo n.º 3
0
        protected bool Exists(PbknitparameterModel model, bool isNew)
        {
            PbknitparameterTable table = new PbknitparameterTable();
            SelectSqlSection     sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                         .Where(table.Sort == model.Sort &&
                                                table.Parameter == model.Parameter &&
                                                table.IsActive == model.IsActive
                                                );

            return(sql.ToScalar <int>() > 0);
        }
Exemplo n.º 4
0
        public void UpdateModel(PbknitparameterModel model)
        {
            //model.UpdateTime = System.DateTime.Now;
            PbknitparameterTable table = new PbknitparameterTable();

            DataAccess.DefaultDB.Update(table)
            .AddColumn(table.Sort, model.Sort)
            .AddColumn(table.Parameter, model.Parameter)
            .AddColumn(table.IsActive, model.IsActive)
            .Execute();
        }
Exemplo n.º 5
0
        public PbknitparameterModelList GetModelList(PbknitparameterModel model)
        {
            PbknitparameterTable table = new PbknitparameterTable();
            SelectSqlSection     sql   = DataAccess.DefaultDB.Select(table, table.AllColumns())
            ;

            using (SafeDataReader sdr = new SafeDataReader(sql.ToDataReader()))
            {
                PbknitparameterModelList result = new PbknitparameterModelList();
                while (sdr.Read())
                {
                    PbknitparameterModel m = new PbknitparameterModel();
                    m.Sort      = sdr.GetString(table.Sort);
                    m.Parameter = sdr.GetString(table.Parameter);
                    m.IsActive  = sdr.GetString(table.IsActive);
                    result.Add(m);
                }
                return(result);
            }
        }