public static bool RequestResetPasswordUpdate(string[] args, string IdNumber) { if (Globals.ExecuteScalar(DataAccess.EmployeeResetPasswordUpdate, args, ref errorNumber, ref errorMessage, MethodBase.GetCurrentMethod) > 0) { Trainee emp = Trainee.ByIdNumber(IdNumber); if (emp != null) { string[] emailargs = { emp.Name, emp.Surname }; Communication.GenericCommunication.SMS(emp.CellPhoneNumber, Message.smsForgotPasswordResetSuccess()); if (Communication.GenericCommunication.SendEmail(emp.EmailAddress, "Reset Password Success", Message.ForgotPasswordResetSuccess(emailargs))) { return(true); } } } return(false); }
public static Trainee ByEnrolId(string enrollID) { string[] args = { enrollID }; Trainee trainee = new Trainee(); try { List <Trainee> returnList = Globals.ExecuteReaderList <Trainee>(DataAccess.TraineeByEnrolId, args, ref errorNumber, ref errorMessage, MethodBase.GetCurrentMethod); if (returnList != null) { foreach (Trainee traineeItem in returnList) { if (!string.IsNullOrEmpty(traineeItem.Name)) { trainee.Name = traineeItem.Name; trainee.Surname = traineeItem.Surname; trainee.EmailAddress = traineeItem.EmailAddress; trainee.CellPhoneNumber = traineeItem.CellPhoneNumber; trainee.A1Name = traineeItem.A1Name; trainee.A1Surname = traineeItem.A1Surname; trainee.ApproverEmailAddress = traineeItem.ApproverEmailAddress; trainee.A2Name = traineeItem.A2Name; trainee.A2Surname = traineeItem.A2Surname; trainee.Approver2EmailAddress = traineeItem.Approver2EmailAddress; trainee.ApproverCellPhone = traineeItem.ApproverCellPhone; trainee.Approver2CellPhone = traineeItem.Approver2CellPhone; } } } } finally { GC.Collect(); } return(trainee); }