public void Update(CreditorAmountInfo info) { if (!this.isSubTable) { db.Open(); } string query = " UPDATE [dbo].[CreditorAmount] SET " + " [CreditorID] = @CreditorID " + ", [RowNo] = @RowNo " + ", [Currency] = @Currency " + ", [Amount] = @Amount " + ", [CreateDate] = @CreateDate " + ", [CreateUser] = @CreateUser " + ", [LastModifiedDate] = @LastModifiedDate " + ", [LastModifiedUser] = @LastModifiedUser " + " where ClientID = @ClientID and CreditorID = @CreditorID and RowNo=@RowNo "; db.Execute(query, info, this.transaction); if (!this.isSubTable) { db.Close(); } }
public void Save(CreditorAmountInfo info) { if (this.IsExisted(info)) { this.Update(info); } else { this.Insert(info); } }
public bool IsExisted(CreditorAmountInfo info) { if (!this.isSubTable) { db.Open(); } String query = "select count(*) from CreditorAmount " + " where ClientID = @ClientID and CreditorID = @CreditorID and RowNo=@RowNo "; var obj = (List <int>)db.Query <int>(query, info, this.transaction); if (!this.isSubTable) { db.Close(); } return(obj[0] > 0); }
public void Insert(CreditorAmountInfo info) { if (!this.isSubTable) { db.Open(); } string query = "INSERT INTO [dbo].[CreditorAmount] ( [ClientID] " + ",[CreditorID] " + ",[RowNo] " + ",[Currency] " + ",[Amount] " + ",[CreateDate] " + ",[CreateUser] " + ",[LastModifiedDate] " + ",[LastModifiedUser] " + ") " + "VALUES ( @ClientID " + ",@CreditorID " + ",@RowNo " + ",@Currency " + ",@Amount " + ",@CreateDate " + ",@CreateUser " + ",@LastModifiedDate " + ",@LastModifiedUser " + ") "; db.Execute(query, info, this.transaction); if (!this.isSubTable) { db.Close(); } }