Пример #1
0
        public void DeleteModel(PbknityarntypeModel model)
        {
            PbknityarntypeTable table = new PbknityarntypeTable();

            DataAccess.DefaultDB.Delete(table)
            .Execute();
        }
Пример #2
0
        public void CheckModel(PbknityarntypeModel model, bool isNew)
        {
            Validator v = new Validator();

            //Check model's data here.
            if (!v.IsValid)
            {
                throw new ValidationException(v);
            }
        }
Пример #3
0
        protected bool Exists(PbknityarntypeModel model, bool isNew)
        {
            PbknityarntypeTable table = new PbknityarntypeTable();
            SelectSqlSection    sql   = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count())
                                        .Where(table.YarnType == model.YarnType &&
                                               table.Description == model.Description &&
                                               table.IeDescription == model.IeDescription &&
                                               table.CustomerDescription == model.CustomerDescription &&
                                               table.IsActive == model.IsActive
                                               );

            return(sql.ToScalar <int>() > 0);
        }
Пример #4
0
        public void UpdateModel(PbknityarntypeModel model)
        {
            //model.UpdateTime = System.DateTime.Now;
            PbknityarntypeTable table = new PbknityarntypeTable();

            DataAccess.DefaultDB.Update(table)
            .AddColumn(table.YarnType, model.YarnType)
            .AddColumn(table.Description, model.Description)
            .AddColumn(table.IeDescription, model.IeDescription)
            .AddColumn(table.CustomerDescription, model.CustomerDescription)
            .AddColumn(table.IsActive, model.IsActive)
            .Execute();
        }
Пример #5
0
        public PbknityarntypeModelList GetModelList(PbknityarntypeModel model)
        {
            PbknityarntypeTable table = new PbknityarntypeTable();
            SelectSqlSection    sql   = DataAccess.DefaultDB.Select(table, table.AllColumns()).Where(table.YarnType == model.YarnType)
            ;

            using (SafeDataReader sdr = new SafeDataReader(sql.ToDataReader()))
            {
                PbknityarntypeModelList result = new PbknityarntypeModelList();
                while (sdr.Read())
                {
                    PbknityarntypeModel m = new PbknityarntypeModel();
                    m.YarnType            = sdr.GetString(table.YarnType);
                    m.Description         = sdr.GetString(table.Description);
                    m.IeDescription       = sdr.GetString(table.IeDescription);
                    m.CustomerDescription = sdr.GetString(table.CustomerDescription);
                    m.IsActive            = sdr.GetString(table.IsActive);
                    result.Add(m);
                }
                return(result);
            }
        }