Example #1
0
    public bool IsExisted(PayrollTypeInfo info)
    {
        db.Open();
        String query = "select count(*)  from PayrollType "
                       + " where PayrollType = @PayrollType ";
        var obj = (List <int>)db.Query <int>(query, info);

        db.Close();
        return(obj[0] > 0);
    }
Example #2
0
 public void Save(PayrollTypeInfo info)
 {
     if (this.IsExisted(info))
     {
         this.Update(info);
     }
     else
     {
         this.Insert(info);
     }
 }
Example #3
0
    public void Update(PayrollTypeInfo info)
    {
        db.Open();

        string query = " UPDATE [dbo].[PayrollType] SET  "
                       + " [PayrollTypeDesc] = @PayrollTypeDesc "
                       + ", [CreateUser] = @CreateUser "
                       + ", [CreateDate] = @CreateDate "
                       + ", [LastModifyUser] = @LastModifyUser "
                       + ", [LastModifyDate] = @LastModifyDate "
                       + " where PayrollType = @PayrollType ";


        db.Execute(query, info);
        db.Close();
    }
Example #4
0
    public void Insert(PayrollTypeInfo info)
    {
        db.Open();

        string query = "INSERT INTO [dbo].[PayrollType] ( [PayrollType] "
                       + ",[PayrollTypeDesc] "
                       + ",[CreateUser] "
                       + ",[CreateDate] "
                       + ",[LastModifyUser] "
                       + ",[LastModifyDate] "
                       + ") "
                       + "VALUES ( @PayrollType "
                       + ",@PayrollTypeDesc "
                       + ",@CreateUser "
                       + ",@CreateDate "
                       + ",@LastModifyUser "
                       + ",@LastModifyDate "
                       + ") ";


        db.Execute(query, info);
        db.Close();
    }