public void Update(ClientCourtJudgeInfo info) { if (!this.isSubTable) { db.Open(); } string query = " UPDATE [dbo].[ClientCourtJudge] SET " + " [RowNo] = @RowNo " + ", [Name] = @Name " + ", [Court] = @Court " + ", [Title] = @Title " + ", [CreateDate] = @CreateDate " + ", [CreateUser] = @CreateUser " + ", [LastModifiedDate] = @LastModifiedDate " + ", [LastModifiedUser] = @LastModifiedUser " + " where ClientID = @ClientID and RowNo= @RowNo"; db.Execute(query, info, this.transaction); if (!this.isSubTable) { db.Close(); } }
public void Save(ClientCourtJudgeInfo info) { if (this.IsExisted(info)) { this.Update(info); } else { this.Insert(info); } }
public bool IsExisted(ClientCourtJudgeInfo info) { if (!this.isSubTable) { db.Open(); } String query = "select count(*) from ClientCourtJudge " + " where ClientID = @ClientID 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(ClientCourtJudgeInfo info) { if (!this.isSubTable) { db.Open(); } string query = "INSERT INTO [dbo].[ClientCourtJudge] ( [ClientID] " + ",[RowNo] " + ",[Name] " + ",[Court] " + ",[Title] " + ",[CreateDate] " + ",[CreateUser] " + ",[LastModifiedDate] " + ",[LastModifiedUser] " + ") " + "VALUES ( @ClientID " + ",@RowNo " + ",@Name " + ",@Court " + ",@Title " + ",@CreateDate " + ",@CreateUser " + ",@LastModifiedDate " + ",@LastModifiedUser " + ") "; db.Execute(query, info, this.transaction); if (!this.isSubTable) { db.Close(); } }