public CffUserActivation ApproveUser(Guid mKey, Guid uKey) { ArgumentChecker.ThrowIfGuidEmpty(mKey, "mKey"); ArgumentChecker.ThrowIfGuidEmpty(uKey, "uKey"); CffUserActivation record = null; using (SqlConnection connection = CreateConnection()) { using (SqlDataReader dataReader = SqlHelper.ExecuteReader(connection, CommandType.StoredProcedure, "ApproveUserAccess", CreateAccessActionParameter(mKey, uKey))) { CleverReader cleverReader = new CleverReader(dataReader); while (cleverReader.Read()) { int nStatus = cleverReader.ToInteger("Status"); if (nStatus > 0) { //valid - UKey must pickup from customer-id record = new CffUserActivation(cleverReader.ToString("Name"), "", "", cleverReader.ToString("USERMAIL"), nStatus); } else { //invalid record = new CffUserActivation("", "", "", "", nStatus); } } } } return(record); }
public CffUserActivation ActivateUser(Guid uid, String pKey) { ArgumentChecker.ThrowIfNull(pKey, "pKey"); ArgumentChecker.ThrowIfGuidEmpty(uid, "uid"); CffUserActivation record = null; using (SqlConnection connection = CreateConnection()) { using (SqlDataReader dataReader = SqlHelper.ExecuteReader(connection, CommandType.StoredProcedure, "ActivateNewUser", CreateActivationParameter(uid, pKey))) { CleverReader cleverReader = new CleverReader(dataReader); while (cleverReader.Read()) { int nStatus = cleverReader.ToInteger("Status"); if (nStatus == 1) { //valid - UKey must pickup from customer-id record = new CffUserActivation(cleverReader.ToString("Name"), cleverReader.ToString("MngtEmail"), cleverReader.ToGuid("UKey").ToString(), cleverReader.ToString("USERMAIL"), nStatus); } else { //invalid record = new CffUserActivation("", "", "", "", nStatus); } } } } return(record); }
public CffUserActivation DeclineUser(Guid mKey, Guid uKey) { ArgumentChecker.ThrowIfGuidEmpty(mKey, "mKey"); ArgumentChecker.ThrowIfGuidEmpty(uKey, "uKey"); CffUserActivation record = null; String userEmployeeName = ""; String userEmail = ""; using (SqlConnection connection = CreateConnection()) { using (SqlDataReader dataReader = SqlHelper.ExecuteReader(connection, CommandType.StoredProcedure, "GetEmployeeDetailsByUID", CreateEmployeeParameter(uKey, "ALL"))) { CleverReader cleverReader = new CleverReader(dataReader); while (cleverReader.Read()) { userEmployeeName = cleverReader.ToString("EmployeeName"); userEmail = cleverReader.ToString("EmailAddress"); } } using (SqlDataReader dataReader = SqlHelper.ExecuteReader(connection, CommandType.StoredProcedure, "DeclineUserAccess", CreateAccessActionParameter(mKey, uKey))) { CleverReader cleverReader = new CleverReader(dataReader); while (cleverReader.Read()) { int nStatus = cleverReader.ToInteger("Status"); if (nStatus >= 0) { //valid - UKey must pickup from customer-id record = new CffUserActivation(userEmployeeName, "", "", userEmail, nStatus); } else { //invalid record = new CffUserActivation("", "", "", "", nStatus); } } } } return(record); }