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

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

            //Check model's data here.
            if (!v.IsValid)
            {
                throw new ValidationException(v);
            }
        }
示例#3
0
        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);
        }
示例#4
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();
        }
示例#5
0
        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);
            }
        }