Exemplo n.º 1
0
    public bool IsExisted(WorkerAdjustmentInfo info)
    {
        // db.Open();
        String query = "select count(*)  from WorkerAdjustment "
                       + " where WorkerID = @WorkerID and RowNo = @RowNo";
        var obj = (List <int>)db.Query <int>(query, info, this.transaction);

        //db.Close();
        return(obj[0] > 0);
    }
Exemplo n.º 2
0
 public void Save(WorkerAdjustmentInfo info)
 {
     if (this.IsExisted(info))
     {
         this.Update(info);
     }
     else
     {
         this.Insert(info);
     }
 }
Exemplo n.º 3
0
    public void Update(WorkerAdjustmentInfo info)
    {
        //db.Open();

        string query = " UPDATE [dbo].[WorkerAdjustment] SET  "
                       + " [RowNo] = @RowNo "
                       + ", [AdjustAmount] = @AdjustAmount "
                       + ", [UpdateDate] = @UpdateDate "
                       + " where WorkerID = @WorkerID and RowNo = @RowNo  ";


        db.Execute(query, info, this.transaction);
        // db.Close();
    }
Exemplo n.º 4
0
    public void Insert(WorkerAdjustmentInfo info)
    {
        string query = "INSERT INTO [dbo].[WorkerAdjustment] ( [WorkerID] "
                       + ",[RowNo] "
                       + ",[AdjustAmount] "
                       + ",[UpdateDate] "
                       + ") "
                       + "VALUES ( @WorkerID "
                       + ",@RowNo "
                       + ",@AdjustAmount "
                       + ",@UpdateDate "
                       + ") ";


        db.Execute(query, info, this.transaction);
    }