public void DeleteModel(PbknitdyemethodModel model)
        {
            PbknitdyemethodTable table = new PbknitdyemethodTable();

            DataAccess.DefaultDB.Delete(table)
            .Execute();
        }
        public void CheckModel(PbknitdyemethodModel model, bool isNew)
        {
            Validator v = new Validator();

            //Check model's data here.
            if (!v.IsValid)
            {
                throw new ValidationException(v);
            }
        }
        protected bool Exists(PbknitdyemethodModel model, bool isNew)
        {
            PbknitdyemethodTable table = new PbknitdyemethodTable();
            SelectSqlSection     sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                         .Where(table.DyeMethod == model.DyeMethod &&
                                                table.DyeType == model.DyeType &&
                                                table.Description == model.Description
                                                );

            return(sql.ToScalar <int>() > 0);
        }
        public void UpdateModel(PbknitdyemethodModel model)
        {
            //model.UpdateTime = System.DateTime.Now;
            PbknitdyemethodTable table = new PbknitdyemethodTable();

            DataAccess.DefaultDB.Update(table)
            .AddColumn(table.DyeMethod, model.DyeMethod)
            .AddColumn(table.DyeType, model.DyeType)
            .AddColumn(table.Description, model.Description)
            .Execute();
        }
        public PbknitdyemethodModelList GetModelList(PbknitdyemethodModel model)
        {
            PbknitdyemethodTable table = new PbknitdyemethodTable();
            SelectSqlSection     sql   = DataAccess.DefaultDB.Select(table, table.AllColumns())
            ;

            using (SafeDataReader sdr = new SafeDataReader(sql.ToDataReader()))
            {
                PbknitdyemethodModelList result = new PbknitdyemethodModelList();
                while (sdr.Read())
                {
                    PbknitdyemethodModel m = new PbknitdyemethodModel();
                    m.DyeMethod   = sdr.GetString(table.DyeMethod);
                    m.DyeType     = sdr.GetString(table.DyeType);
                    m.Description = sdr.GetString(table.Description);
                    result.Add(m);
                }
                return(result);
            }
        }