public void DeleteModel(PbknityarncountModel model) { PbknityarncountTable table = new PbknityarncountTable(); DataAccess.DefaultDB.Delete(table) .Execute(); }
public void CheckModel(PbknityarncountModel model, bool isNew) { Validator v = new Validator(); //Check model's data here. if (!v.IsValid) { throw new ValidationException(v); } }
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); }
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(); }
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); } }