Beispiel #1
0
        public void DeleteModel(PbknitconstructionModel model)
        {
            PbknitconstructionTable table = new PbknitconstructionTable();

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

            //Check model's data here.
            if (!v.IsValid)
            {
                throw new ValidationException(v);
            }
        }
Beispiel #3
0
        protected bool Exists(PbknitconstructionModel model, bool isNew)
        {
            PbknitconstructionTable table = new PbknitconstructionTable();
            SelectSqlSection        sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                            .Where(table.Construction == model.Construction &&
                                                   table.Description == model.Description &&
                                                   table.DescriptionCn == model.DescriptionCn &&
                                                   table.SingleDouble == model.SingleDouble &&
                                                   table.IsSpecial == model.IsSpecial &&
                                                   table.IsActive == model.IsActive
                                                   );

            return(sql.ToScalar <int>() > 0);
        }
Beispiel #4
0
        public void UpdateModel(PbknitconstructionModel model)
        {
            //model.UpdateTime = System.DateTime.Now;
            PbknitconstructionTable table = new PbknitconstructionTable();

            DataAccess.DefaultDB.Update(table)
            .AddColumn(table.Construction, model.Construction)
            .AddColumn(table.Description, model.Description)
            .AddColumn(table.DescriptionCn, model.DescriptionCn)
            .AddColumn(table.SingleDouble, model.SingleDouble)
            .AddColumn(table.IsSpecial, model.IsSpecial)
            .AddColumn(table.IsActive, model.IsActive)
            .Execute();
        }
Beispiel #5
0
        public PbknitconstructionModelList GetModelList(PbknitconstructionModel model)
        {
            PbknitconstructionTable table = new PbknitconstructionTable();
            SelectSqlSection        sql   = DataAccess.DefaultDB.Select(table, table.AllColumns())
            ;

            using (SafeDataReader sdr = new SafeDataReader(sql.ToDataReader()))
            {
                PbknitconstructionModelList result = new PbknitconstructionModelList();
                while (sdr.Read())
                {
                    PbknitconstructionModel m = new PbknitconstructionModel();
                    m.Construction  = sdr.GetString(table.Construction);
                    m.Description   = sdr.GetString(table.Description);
                    m.DescriptionCn = sdr.GetString(table.DescriptionCn);
                    m.SingleDouble  = sdr.GetString(table.SingleDouble);
                    m.IsSpecial     = sdr.GetString(table.IsSpecial);
                    m.IsActive      = sdr.GetString(table.IsActive);
                    result.Add(m);
                }
                return(result);
            }
        }