public bool SaveMobileRRQResponse(int StudentID, int RRQID, int QuesNo, string Response) { int OptionSeq = -1; if (Response.Equals("A")) { OptionSeq = 1; } else if (Response.Equals("B")) { OptionSeq = 2; } else if (Response.Equals("C")) { OptionSeq = 3; } else if (Response.Equals("D")) { OptionSeq = 4; } else if (Response.Equals("E")) { OptionSeq = 5; } else if (Response.Equals("F")) { OptionSeq = 6; } if (OptionSeq != -1) { return(QuestionBankController.SaveMobileQuestionResponse(RRQID, QuesNo, StudentID, OptionSeq)); } return(false); }
public bool SaveRRQResponse(int sessionId, int rrqId, int QId, string remoteId, string response) { // first get the studentId // Also, can this be done in one go rather than first get the studenId? SqlParameter[] SParam = new SqlParameter[2]; SParam[0] = new SqlParameter("@RemoteNum", SqlDbType.VarChar); SParam[0].Value = remoteId; SParam[1] = new SqlParameter("@SessionID", SqlDbType.Int); SParam[1].Value = sessionId; DataTable val = DAL.GetDataTable("GetStudentIdFromRemoteAllocation", SParam); int studentId = -1; if (val.Rows.Count > 0) { studentId = Convert.ToInt32(Convert.IsDBNull(val.Rows[0]["StudentID"]) ? "-1" : val.Rows[0]["StudentID"]); } else { Debug.WriteLine("Error in retrieving student"); } int optionSeq = -1; if (response.Equals("A")) { optionSeq = 1; } else if (response.Equals("B")) { optionSeq = 2; } else if (response.Equals("C")) { optionSeq = 3; } else if (response.Equals("D")) { optionSeq = 4; } else if (response.Equals("E")) { optionSeq = 5; } else if (response.Equals("F")) { optionSeq = 6; } if (studentId != -1 && optionSeq != -1) { if (QuestionBankController.SaveQuestionResponse(rrqId, QId, studentId, optionSeq)) { return(true); } } return(false); }