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