示例#1
0
    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();
        }
    }
示例#2
0
 public void Save(CreditorAmountInfo info)
 {
     if (this.IsExisted(info))
     {
         this.Update(info);
     }
     else
     {
         this.Insert(info);
     }
 }
示例#3
0
    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);
    }
示例#4
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();
        }
    }