public bool SaveBodyAndVars(Info_tmp_xls info) { ExeBatchTrans exeBatchTrans = this.BatchTrans(); exeBatchTrans.Append <Info_tmp_xls> ((r, i) => { if (r.Update <Model.Tb_tmp_xls>() .Set() .Field(Model.Tb_tmp_xls.Table.Tmp_Body, info.Tmp_Body) .EndSet() .Where().And(Model.Tb_tmp_xls.Table.Tmp_Id, info.Tmp_Id) .EndWhere() .Save() < 1) { return(false); } return(true); }, info ); exeBatchTrans.Append <long> ((r, id) => { if (r.Remove <Model.Tb_tmp_xls_var>() .Where().And(Model.Tb_tmp_xls_var.Table.Tmp_Id, id) .EndWhere() .Save() < 0) { return(false); } return(true); }, info.Tmp_Id); foreach (var item in info.Vars) { exeBatchTrans.Append <Tb_tmp_xls_var> ((r, i) => { return(Add(r, item)); }, item ); } return(exeBatchTrans.Save()); }
public bool UpdateInfo(Info_tmp_xls info) { if (Repository.Update <Model.Tb_tmp_xls>() .Set() .AllFields(info) .EndSet() .Where().And(Model.Tb_tmp_xls.Table.Tmp_Id, info.Tmp_Id) .EndWhere() .Save() < 1) { return(false); } return(true); }
public override bool Remove(Info_tmp_xls t) { return(this.BatchTrans().Append <long>( (r, id) => { if (r.Remove <Model.Tb_tmp_xls>() .Where().And(Model.Tb_tmp_xls.Table.Tmp_Id, t.Tmp_Id) .EndWhere() .Save() < 1) { return false; } return true; }, t.Tmp_Id).Append <long>( (r, id) => { if (r.Remove <Model.Tb_tmp_xls_var>() .Where().And(Model.Tb_tmp_xls_var.Table.Tmp_Id, t.Tmp_Id) .EndWhere() .Save() < 1) { return false; } return true; }, t.Tmp_Id ).Append <long>( (r, id) => { if (r.Remove <Model.Tb_tmp_xls_map>() .Where().And(Model.Tb_tmp_xls_map.Table.Tmp_Id, t.Tmp_Id) .EndWhere() .Save() < 1) { return false; } return true; }, t.Tmp_Id ).Save()); }
public override bool Add(Info_tmp_xls t) { t.Tmp_Id = NewId(); return(Repository.Add(t)); }