public void DeleteModel(QcmaininfologModel model) { QcmaininfologTable table = new QcmaininfologTable(); DataAccess.DefaultDB.Delete(table) .Execute(); }
public void CheckModel(QcmaininfologModel model, bool isNew) { Validator v = new Validator(); //Check model's data here. if (!v.IsValid) { throw new ValidationException(v); } }
public void AddModel(QcmaininfologModel model, DbTransaction tran) { QcmaininfologTable table = new QcmaininfologTable(); DataAccess.DefaultDB.Insert(table).SetTransaction(tran) .AddColumn(table.QualityCode, model.QualityCode) .AddColumn(table.Status, model.Status) .AddColumn(table.EditReason, model.EditReason) .AddColumn(table.EditorContent, model.EditorContent) .AddColumn(table.Editor, model.Editor) .AddColumn(table.EditorTime, model.EditorTime) .Execute(); }
protected bool Exists(QcmaininfologModel model, bool isNew) { QcmaininfologTable table = new QcmaininfologTable(); SelectSqlSection sql = DataAccess.DefaultDB.Select(table, QueryColumn.All().Count()) .Where(table.QualityCode == model.QualityCode && table.Status == model.Status && table.EditReason == model.EditReason && table.EditorContent == model.EditorContent && table.Editor == model.Editor && table.EditorTime == model.EditorTime ); return(sql.ToScalar <int>() > 0); }
public void UpdateModel(QcmaininfologModel model) { //model.UpdateTime = System.DateTime.Now; QcmaininfologTable table = new QcmaininfologTable(); DataAccess.DefaultDB.Update(table) .AddColumn(table.QualityCode, model.QualityCode) .AddColumn(table.Status, model.Status) .AddColumn(table.EditReason, model.EditReason) .AddColumn(table.EditorContent, model.EditorContent) .AddColumn(table.Editor, model.Editor) .AddColumn(table.EditorTime, model.EditorTime) .Execute(); }
public QcmaininfologModelList GetModelList(QcmaininfologModel model) { QcmaininfologTable table = new QcmaininfologTable(); SelectSqlSection sql = DataAccess.DefaultDB.Select(table, table.AllColumns()) ; using (SafeDataReader sdr = new SafeDataReader(sql.ToDataReader())) { QcmaininfologModelList result = new QcmaininfologModelList(); while (sdr.Read()) { QcmaininfologModel m = new QcmaininfologModel(); m.QualityCode = sdr.GetString(table.QualityCode); m.Status = sdr.GetString(table.Status); m.EditReason = sdr.GetString(table.EditReason); m.EditorContent = sdr.GetString(table.EditorContent); m.Editor = sdr.GetString(table.Editor); m.EditorTime = sdr.GetDateTime(table.EditorTime); result.Add(m); } return(result); } }