public int Insert(CostsBomsRelatedModel model) { string sql = @"INSERT INTO prj_costs_boms (bom_id ,cost_id ,attribute1 ,attribute2 ,attribute3 ,attribute4 ,attribute5 ,last_update_date ,last_updated_by ,creation_date ,created_by ,enable_flag) VALUES (@bom_id ,@cost_id ,@attribute1 ,@attribute2 ,@attribute3 ,@attribute4 ,@attribute5 ,@last_update_date ,@last_updated_by ,@creation_date ,@created_by ,@enable_flag)"; return(db.Insert(sql, Take(model))); }
public void Delete(CostsBomsRelatedModel model) { string sql = @"DELETE FROM prj_costs_boms WHERE bom_id = @bom_id AND cost_id = @cost_id"; object[] parms = { "@bom_id", model.BomId, "@cost_id", model.CostId }; db.Update(sql, parms); }
private object[] Take(CostsBomsRelatedModel model) { return(new object[] { "@bom_id", model.BomId, "@cost_id", model.CostId, "@attribute1", model.CostCode, /***/ "@attribute2", model.BomNumber, /***/ "@attribute3", model.Attribute3, "@attribute4", model.Attribute4, "@attribute5", model.Attribute5, "@last_update_date", model.LastUpdateDate, "@last_updated_by", model.LastUpdatedBy, "@creation_date", model.CreationDate, "@created_by", model.CreatedBy, "@enable_flag", (model.EnableFlag) ? "Y" : "N" }); }
public void Update(CostsBomsRelatedModel model) { string sql = @"UPDATE prj_costs_boms SET bom_id = @bom_id ,cost_id = @cost_id ,attribute1 = @attribute1 ,attribute2 = @attribute2 ,attribute3 = @attribute3 ,attribute4 = @attribute4 ,attribute5 = @attribute5 ,last_update_date = @last_update_date ,last_updated_by = @last_updated_by ,enable_flag = @enable_flag WHERE bom_id = @bom_id AND cost_id = @cost_id"; db.Update(sql, Take(model)); }