Exemplo n.º 1
0
 public Boolean insertSalary(enSalary enSalary)
 {
     try
     {
         str = "INSERT INTO salary (";
         str += "personalID,";
         str += "bank,";
         str += "accountNumber,";
         str += "calculateType,";
         str += "salary,";
         str += "shiftSalary,";
         str += "calTax,";
         str += "calSocialTax,";
         str += "lateDeduct,";
         str += "leaveDeduct";
         str += ")VALUES(";
         str += "@personalID,";
         str += "@bank,";
         str += "@accountNumber,";
         str += "@calculateType,";
         str += "@salary,";
         str += "@shiftSalary,";
         str += "@calTax,";
         str += "@calSocialTax,";
         str += "@lateDeduct,";
         str += "@leaveDeduct";
         str += ");";
         Dbcmd = db.GetSqlStringCommand(str);
         db.AddInParameter(Dbcmd, "@personalID", DbType.Int32, enSalary.personalID);
         db.AddInParameter(Dbcmd, "@bank", DbType.String, enSalary.bank);
         db.AddInParameter(Dbcmd, "@accountNumber", DbType.String, enSalary.accountNumber);
         db.AddInParameter(Dbcmd, "@calculateType", DbType.Int32, enSalary.calculateType);
         db.AddInParameter(Dbcmd, "@salary", DbType.Double, enSalary.salary);
         db.AddInParameter(Dbcmd, "@shiftSalary", DbType.Double, enSalary.shiftSalary);
         db.AddInParameter(Dbcmd, "@calTax", DbType.String, enSalary.calTax);
         db.AddInParameter(Dbcmd, "@calSocialTax", DbType.String, enSalary.calSocialTax);
         db.AddInParameter(Dbcmd, "@lateDeduct", DbType.Int32, enSalary.lateDeduct);
         db.AddInParameter(Dbcmd, "@leaveDeduct", DbType.Int32, enSalary.leaveDeduct);
         db.ExecuteNonQuery(Dbcmd);
         return true;
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemplo n.º 2
0
 public Boolean updateSalary(enSalary enSalary)
 {
     try
     {
         str = "UPDATE salary SET ";
         str += "personalID=@personalID,";
         str += "bank=@bank,";
         str += "accountNumber=@accountNumber,";
         str += "calculateType=@calculateType,";
         str += "salary=@salary,";
         str += "shiftSalary=@shiftSalary,";
         str += "calTax=@calTax,";
         str += "calSocialTax=@calSocialTax,";
         str += "lateDeduct=@lateDeduct,";
         str += "leaveDeduct=@leaveDeduct";
         str += " WHERE salaryID=@salaryID;";
         Dbcmd = db.GetSqlStringCommand(str);
         db.AddInParameter(Dbcmd, "@personalID", DbType.Int32, enSalary.personalID);
         db.AddInParameter(Dbcmd, "@bank", DbType.String, enSalary.bank);
         db.AddInParameter(Dbcmd, "@accountNumber", DbType.String, enSalary.accountNumber);
         db.AddInParameter(Dbcmd, "@calculateType", DbType.Int32, enSalary.calculateType);
         db.AddInParameter(Dbcmd, "@salary", DbType.Double, enSalary.salary);
         db.AddInParameter(Dbcmd, "@shiftSalary", DbType.Double, enSalary.shiftSalary);
         db.AddInParameter(Dbcmd, "@calTax", DbType.String, enSalary.calTax);
         db.AddInParameter(Dbcmd, "@calSocialTax", DbType.String, enSalary.calSocialTax);
         db.AddInParameter(Dbcmd, "@lateDeduct", DbType.Int32, enSalary.lateDeduct);
         db.AddInParameter(Dbcmd, "@leaveDeduct", DbType.Int32, enSalary.leaveDeduct);
         db.AddInParameter(Dbcmd, "@salaryID", DbType.Int32, enSalary.salaryID);
         db.ExecuteNonQuery(Dbcmd);
         return true;
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }