Example #1
0
 public Boolean insertLeaveRight(enLeaveRight enLeaveRight)
 {
     try
     {
         str = "INSERT INTO leaveRight (personalID,year,description,leaveAmount,usedLeaveAmount,balanceLeaveAmount)VALUES(@personalID,@year,@description,@leaveAmount,@usedLeaveAmount,@balanceLeaveAmount);";
         Dbcmd = db.GetSqlStringCommand(str);
         db.AddInParameter(Dbcmd, "@personalID", DbType.Int32, enLeaveRight.personalID);
         db.AddInParameter(Dbcmd, "@year", DbType.String, enLeaveRight.year);
         db.AddInParameter(Dbcmd, "@description", DbType.String, enLeaveRight.description);
         db.AddInParameter(Dbcmd, "@leaveAmount", DbType.Int32, enLeaveRight.leaveAmount);
         db.AddInParameter(Dbcmd, "@usedLeaveAmount", DbType.Int32, enLeaveRight.usedLeaveAmount);
         db.AddInParameter(Dbcmd, "@balanceLeaveAmount", DbType.Int32, enLeaveRight.balanceLeaveAmount);
         db.ExecuteNonQuery(Dbcmd);
         return true;
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Example #2
0
 public Boolean updateLeaveRight(enLeaveRight enLeaveRight)
 {
     try
     {
         str = "UPDATE leaveRight SET personalID=@personalID,year=@year,description=@description,leaveAmount=@leaveAmount,usedLeaveAmount=@usedLeaveAmount,balanceLeaveAmount=@balanceLeaveAmount WHERE leaveRightID=@leaveRightID;";
         Dbcmd = db.GetSqlStringCommand(str);
         db.AddInParameter(Dbcmd, "@personalID", DbType.Int32, enLeaveRight.personalID);
         db.AddInParameter(Dbcmd, "@year", DbType.String, enLeaveRight.year);
         db.AddInParameter(Dbcmd, "@description", DbType.String, enLeaveRight.description);
         db.AddInParameter(Dbcmd, "@leaveAmount", DbType.Int32, enLeaveRight.leaveAmount);
         db.AddInParameter(Dbcmd, "@usedLeaveAmount", DbType.Int32, enLeaveRight.usedLeaveAmount);
         db.AddInParameter(Dbcmd, "@balanceLeaveAmount", DbType.Int32, enLeaveRight.balanceLeaveAmount);
         db.AddInParameter(Dbcmd, "@leaveRightID", DbType.Int32, enLeaveRight.leaveRightID);
         db.ExecuteNonQuery(Dbcmd);
         return true;
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }