protected VLLibraryQuestion ExecuteAndGetLibraryQuestion(DbCommand cmd) { VLLibraryQuestion _retObject = null; try { cmd.Connection.Open(); using (DbDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows == false) { return(null); } reader.Read(); _retObject = new VLLibraryQuestion(reader); } } finally { cmd.Connection.Close(); } return(_retObject); }
void SetValues(VLLibraryQuestion question) { this.QuestionType.Text = question.QuestionType.ToString(); this.QuestionText.Text = question.QuestionText; this.IsRequired.Checked = question.IsRequired; this.requiredMessage.Text = question.RequiredMessage; }
/// <summary> /// /// </summary> /// <param name="accessToken"></param> /// <param name="obj"></param> /// <param name="textsLanguage"></param> /// <returns></returns> public VLLibraryQuestion CreateLibraryQuestion(Int32 accessToken, VLLibraryQuestion obj, short textsLanguage = 0) { if (obj == null) { throw new ArgumentNullException("obj"); } try { return(CreateLibraryQuestionImpl(accessToken, obj, Utility.UtcNow(), textsLanguage)); } catch { throw; } }
/// <summary> /// /// </summary> /// <param name="accessToken"></param> /// <param name="obj"></param> /// <returns></returns> public VLLibraryQuestion UpdateLibraryQuestion(Int32 accessToken, VLLibraryQuestion obj) { if (obj == null) { throw new ArgumentNullException("obj"); } try { return(UpdateLibraryQuestionImpl(accessToken, obj, Utility.UtcNow())); } catch { throw; } }
protected Collection <VLLibraryQuestion> ExecuteAndGetLibraryQuestions(DbCommand cmd) { var collection = new Collection <VLLibraryQuestion>(); try { cmd.Connection.Open(); using (DbDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { var _object = new VLLibraryQuestion(reader); collection.Add(_object); } } } finally { cmd.Connection.Close(); } return(collection); }
internal override VLLibraryQuestion UpdateLibraryQuestionImpl(Int32 accessToken, VLLibraryQuestion question, DateTime currentTimeUtc) { try { DbCommand command = CreateCommand("valis_libraryquestions_Update"); AddParameter(command, "@accessToken", accessToken, DbType.Int32); AddParameter(command, "@questionId", question.QuestionId, DbType.Int32); AddParameter(command, "@category", question.Category, DbType.Int16); AddParameter(command, "@questionType", question.QuestionType, DbType.Byte); AddParameter(command, "@isRequired", question.IsRequired, DbType.Boolean); AddParameter(command, "@requiredBehavior", question.RequiredBehavior, DbType.Byte); AddParameter(command, "@requiredMinLimit", question.RequiredMinLimit, DbType.Int16); AddParameter(command, "@requiredMaxLimit", question.RequiredMaxLimit, DbType.Int16); AddParameter(command, "@attributeFlags", question.AttributeFlags, DbType.Int32); AddParameter(command, "@validationBehavior", question.ValidationBehavior, DbType.Byte); AddParameter(command, "@validationField1", question.ValidationField1, DbType.String); AddParameter(command, "@validationField2", question.ValidationField2, DbType.String); AddParameter(command, "@validationField3", question.ValidationField3, DbType.String); AddParameter(command, "@regularExpression", question.RegularExpression, DbType.String); AddParameter(command, "@randomBehavior", question.RandomBehavior, DbType.Byte); AddParameter(command, "@otherFieldType", question.OtherFieldType, DbType.Byte); AddParameter(command, "@otherFieldRows", question.OtherFieldRows, DbType.Byte); AddParameter(command, "@otherFieldChars", question.OtherFieldChars, DbType.Byte); AddParameter(command, "@optionsSequence", question.OptionsSequence, DbType.Byte); AddParameter(command, "@columnsSequence", question.ColumnsSequence, DbType.Byte); AddParameter(command, "@rangeStart", question.RangeStart, DbType.Int32); AddParameter(command, "@rangeEnd", question.RangeEnd, DbType.Int32); AddParameter(command, "@lastUpdateDT", question.LastUpdateDT, DbType.DateTime); AddParameter(command, "@currentTimeUtc", currentTimeUtc, DbType.DateTime); AddParameter(command, "@textsLanguage", question.TextsLanguage, DbType.Int16); AddParameter(command, "@questionText", question.QuestionText, DbType.String); AddParameter(command, "@description", question.Description, DbType.String); AddParameter(command, "@helpText", question.HelpText, DbType.String); AddParameter(command, "@frontLabelText", question.FrontLabelText, DbType.String); AddParameter(command, "@afterLabelText", question.AfterLabelText, DbType.String); AddParameter(command, "@insideText", question.InsideText, DbType.String); AddParameter(command, "@requiredMessage", question.RequiredMessage, DbType.String); AddParameter(command, "@validationMessage", question.ValidationMessage, DbType.String); AddParameter(command, "@otherFieldLabel", question.OtherFieldLabel, DbType.String); return(ExecuteAndGetLibraryQuestion(command)); } catch (SqlException ex) { if (ex.Class == 14 && ex.State == 10) { throw new VLInvalidAccessTokenException(SR.GetString(SR.Invalid_accessToken_while_calling_LibrariesDao, "UpdateLibraryQuestionImpl"), ex); } else { throw new VLDataException(SR.GetString(SR.Exception_occured_at_LibrariesDao, "UpdateLibraryQuestionImpl"), ex); } } catch (Exception ex) { throw new VLDataException(SR.GetString(SR.Exception_occured_at_LibrariesDao, "UpdateLibraryQuestionImpll"), ex); } }
void GetValues(VLLibraryQuestion question) { question.QuestionText = this.QuestionText.Text; question.IsRequired = this.IsRequired.Checked; question.RequiredMessage = this.requiredMessage.Text; }
internal abstract VLLibraryQuestion CreateLibraryQuestionImpl(Int32 accessToken, VLLibraryQuestion obj, DateTime currentTimeUtc, short textsLanguage);
internal abstract VLLibraryQuestion UpdateLibraryQuestionImpl(Int32 accessToken, VLLibraryQuestion obj, DateTime currentTimeUtc);