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