public bool IsExisted(WorkerSkillInfo info) { //db.Open(); String query = "select count(*) from WorkerSkill " + " where WorkerID = @WorkerID and RowNo = @RowNo"; var obj = (List <int>)db.Query <int>(query, info, this.transaction); //db.Close(); return(obj[0] > 0); }
public void Update(WorkerSkillInfo info) { //db.Open(); string query = " UPDATE [dbo].[WorkerSkill] SET [Description] = @Description " + " where WorkerID = @WorkerID and RowNo = @RowNo "; db.Execute(query, info, this.transaction); //db.Close(); }
public void Save(WorkerSkillInfo info) { if (this.IsExisted(info)) { this.Update(info); } else { this.Insert(info); } }
public void Insert(WorkerSkillInfo info) { //db.Open(); string query = "INSERT INTO [dbo].[WorkerSkill] ( [WorkerID] " + ",[RowNo] " + ",[Description] " + ") " + "VALUES ( @WorkerID " + ",@RowNo " + ",@Description " + ") "; db.Execute(query, info, this.transaction); //db.Close(); }