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

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

            //Check model's data here.
            if (!v.IsValid)
            {
                throw new ValidationException(v);
            }
        }
示例#3
0
        protected bool Exists(PbknityarncountModel model, bool isNew)
        {
            PbknityarncountTable table = new PbknityarncountTable();
            SelectSqlSection     sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                         .Where(table.YarnCount == model.YarnCount &&
                                                table.IsActive == model.IsActive
                                                );

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

            DataAccess.DefaultDB.Update(table)
            .AddColumn(table.YarnCount, model.YarnCount)
            .AddColumn(table.IsActive, model.IsActive)
            .Execute();
        }
示例#5
0
        public PbknityarncountModelList GetModelList(PbknityarncountModel model)
        {
            PbknityarncountTable table = new PbknityarncountTable();
            SelectSqlSection     sql   = DataAccess.DefaultDB.Select(table, table.AllColumns())
            ;

            using (SafeDataReader sdr = new SafeDataReader(sql.ToDataReader()))
            {
                PbknityarncountModelList result = new PbknityarncountModelList();
                while (sdr.Read())
                {
                    PbknityarncountModel m = new PbknityarncountModel();
                    m.YarnCount = sdr.GetString(table.YarnCount);
                    m.IsActive  = sdr.GetString(table.IsActive);
                    result.Add(m);
                }
                return(result);
            }
        }