예제 #1
0
 public List<FormSubmission> GetAllByFormDocumentId(int FormDocumentID)
 {
     FormSubmissionDAC _formSubmissionComponent = new FormSubmissionDAC();
     IDataReader reader = _formSubmissionComponent.GetAllFormSubmission("FormDocumentID = " + FormDocumentID).CreateDataReader();
     List<FormSubmission> _formSubmissionList = new List<FormSubmission>();
     while (reader.Read())
     {
         if (_formSubmissionList == null)
             _formSubmissionList = new List<FormSubmission>();
         FormSubmission _formSubmission = new FormSubmission();
         if (reader["FormSubmissionId"] != DBNull.Value)
             _formSubmission.FormSubmissionId = Convert.ToInt32(reader["FormSubmissionId"]);
         if (reader["UserId"] != DBNull.Value)
             _formSubmission.UserId = Convert.ToInt32(reader["UserId"]);
         if (reader["IsAnonymous"] != DBNull.Value)
             _formSubmission.IsAnonymous = Convert.ToBoolean(reader["IsAnonymous"]);
         if (reader["SubmissionDate"] != DBNull.Value)
             _formSubmission.SubmissionDate = Convert.ToDateTime(reader["SubmissionDate"]);
         if (reader["IPAddress"] != DBNull.Value)
             _formSubmission.IPAddress = Convert.ToString(reader["IPAddress"]);
         if (reader["IsValid"] != DBNull.Value)
             _formSubmission.IsValid = Convert.ToBoolean(reader["IsValid"]);
         if (reader["EmailSent"] != DBNull.Value)
             _formSubmission.EmailSent = Convert.ToBoolean(reader["EmailSent"]);
         if (reader["SMSSent"] != DBNull.Value)
             _formSubmission.SMSSent = Convert.ToBoolean(reader["SMSSent"]);
         if (reader["FormDocumentID"] != DBNull.Value)
             _formSubmission.FormDocumentID = Convert.ToInt32(reader["FormDocumentID"]);
         _formSubmission.NewRecord = false;
         _formSubmissionList.Add(_formSubmission);
     } reader.Close();
     return _formSubmissionList;
 }
예제 #2
0
        public bool Vote(int FormFieldValueId, int FormFieldId)
        {
            BusinessLogicLayer.Entities.FormBuilder.FormField field = BusinessLogicLayer.Common.FormFieldLogic.GetByID(FormFieldId);
            BusinessLogicLayer.Entities.FormBuilder.FormFieldValue value = BusinessLogicLayer.Common.FormFieldValueLogic.GetByID(FormFieldValueId);
            if (field == null)
                return false;
            FormSubmission sub = new FormSubmission();
            sub.FormDocumentID = field.FormDocumentId;
            sub.UserId = 0;
            sub.SubmissionDate = DateTime.Now;
            sub.IsValid = true;
            BusinessLogicLayer.Common.FormSubmissionLogic.Insert(sub);

            BusinessLogicLayer.Entities.FormBuilder.FormSubmissionAnswer ua = new FormSubmissionAnswer();
            ua.FormSubmissionId = sub.FormSubmissionId;
            ua.Answer = value.FieldValue;
            ua.FormFieldId = FormFieldId;
            ua.FormFieldValueId = FormFieldValueId;
            BusinessLogicLayer.Common.FormSubmissionAnswerLogic.Insert(ua);
            return true;
        }
예제 #3
0
        public List<FormSubmissionAnswer> ViewSubmissionAnswers(int FormDocumentID)
        {
            FormSubmissionAnswerDAC _formSubmissionAnswerComponent = new FormSubmissionAnswerDAC();
            IDataReader reader = _formSubmissionAnswerComponent.ViewSubmissionAnswers("FormDocumentID = " + FormDocumentID).CreateDataReader();
            List<FormSubmissionAnswer> _formSubmissionAnswerList = new List<FormSubmissionAnswer>();
            while (reader.Read())
            {
                if (_formSubmissionAnswerList == null)
                    _formSubmissionAnswerList = new List<FormSubmissionAnswer>();
                FormSubmissionAnswer _formSubmissionAnswer = new FormSubmissionAnswer();
                #region FormSubmissionAnswer Fields
                if (reader["FormSubmissionAnswerId"] != DBNull.Value)
                    _formSubmissionAnswer.FormSubmissionAnswerId = Convert.ToInt32(reader["FormSubmissionAnswerId"]);
                if (reader["FormSubmissionId"] != DBNull.Value)
                    _formSubmissionAnswer.FormSubmissionId = Convert.ToInt32(reader["FormSubmissionId"]);
                if (reader["FormFieldId"] != DBNull.Value)
                    _formSubmissionAnswer.FormFieldId = Convert.ToInt32(reader["FormFieldId"]);
                if (reader["Answer"] != DBNull.Value)
                    _formSubmissionAnswer.Answer = Convert.ToString(reader["Answer"]);
                if (reader["FormFieldColumnId"] != DBNull.Value)
                    _formSubmissionAnswer.FormFieldColumnId = Convert.ToInt32(reader["FormFieldColumnId"]);
                if (reader["FormFieldValueId"] != DBNull.Value)
                    _formSubmissionAnswer.FormFieldValueId = Convert.ToInt32(reader["FormFieldValueId"]);
                if (reader["Grade"] != DBNull.Value)
                    _formSubmissionAnswer.Grade = Convert.ToInt32(reader["Grade"]);
                #endregion

                #region FormSubmission Fields
                FormSubmission _formSubmission = new FormSubmission();
                if (reader["FormSubmissionId"] != DBNull.Value)
                    _formSubmission.FormSubmissionId = Convert.ToInt32(reader["FormSubmissionId"]);
                if (reader["UserId"] != DBNull.Value)
                    _formSubmission.UserId = Convert.ToInt32(reader["UserId"]);
                if (reader["IsAnonymous"] != DBNull.Value)
                    _formSubmission.IsAnonymous = Convert.ToBoolean(reader["IsAnonymous"]);
                if (reader["SubmissionDate"] != DBNull.Value)
                    _formSubmission.SubmissionDate = Convert.ToDateTime(reader["SubmissionDate"]);
                if (reader["IPAddress"] != DBNull.Value)
                    _formSubmission.IPAddress = Convert.ToString(reader["IPAddress"]);
                if (reader["IsValid"] != DBNull.Value)
                    _formSubmission.IsValid = Convert.ToBoolean(reader["IsValid"]);
                if (reader["EmailSent"] != DBNull.Value)
                    _formSubmission.EmailSent = Convert.ToBoolean(reader["EmailSent"]);
                if (reader["SMSSent"] != DBNull.Value)
                    _formSubmission.SMSSent = Convert.ToBoolean(reader["SMSSent"]);
                if (reader["FormDocumentID"] != DBNull.Value)
                    _formSubmission.FormDocumentID = Convert.ToInt32(reader["FormDocumentID"]);
                _formSubmission.NewRecord = false;

                BusinessLogicLayer.Entities.Persons.Credential _credential = new Entities.Persons.Credential();
                if (reader["UserId"] != DBNull.Value)
                    _credential.BusinessEntityId = Convert.ToInt32(reader["UserId"]);
                if (reader["Username"] != DBNull.Value)
                    _credential.Username = Convert.ToString(reader["Username"]);
                _formSubmission.User = _credential;
                _formSubmissionAnswer.FormSubmission = _formSubmission;
                #endregion

                _formSubmissionAnswer.NewRecord = false;
                _formSubmissionAnswerList.Add(_formSubmissionAnswer);
            } reader.Close();
            return _formSubmissionAnswerList;
        }
예제 #4
0
 private static void CollectSurveyUserAnswers(List<BusinessLogicLayer.Entities.FormBuilder.FormSubmissionAnswer> SurveyUserAnswers, int SurveyId, int UserId)
 {
     FormSubmission sub = new FormSubmission();
     sub.FormDocumentID = SurveyId;
     sub.UserId = UserId;
     sub.SubmissionDate = DateTime.Now;
     sub.IsValid = true;
     BusinessLogicLayer.Common.FormSubmissionLogic.Insert(sub);
     foreach (BusinessLogicLayer.Entities.FormBuilder.FormSubmissionAnswer ua in SurveyUserAnswers)
     {
         ua.FormSubmissionId = sub.FormSubmissionId;
         BusinessLogicLayer.Common.FormSubmissionAnswerLogic.Insert(ua);
     }
 }
예제 #5
0
 public bool Update(FormSubmission formsubmission ,int old_formSubmissionId)
 {
     FormSubmissionDAC formsubmissionComponent = new FormSubmissionDAC();
     return formsubmissionComponent.UpdateFormSubmission( formsubmission.UserId,  formsubmission.IsAnonymous,  formsubmission.SubmissionDate,  formsubmission.IPAddress,  formsubmission.IsValid,  formsubmission.EmailSent,  formsubmission.SMSSent,  formsubmission.FormDocumentID,  old_formSubmissionId);
 }
예제 #6
0
 public bool Insert(FormSubmission formsubmission)
 {
     int autonumber = 0;
     FormSubmissionDAC formsubmissionComponent = new FormSubmissionDAC();
     bool endedSuccessfuly = formsubmissionComponent.InsertNewFormSubmission( ref autonumber,  formsubmission.UserId,  formsubmission.IsAnonymous,  formsubmission.SubmissionDate,  formsubmission.IPAddress,  formsubmission.IsValid,  formsubmission.EmailSent,  formsubmission.SMSSent,  formsubmission.FormDocumentID);
     if(endedSuccessfuly)
     {
         formsubmission.FormSubmissionId = autonumber;
     }
     return endedSuccessfuly;
 }
예제 #7
0
 public FormSubmission GetByID(int _formSubmissionId)
 {
     FormSubmissionDAC _formSubmissionComponent = new FormSubmissionDAC();
      IDataReader reader = _formSubmissionComponent.GetByIDFormSubmission(_formSubmissionId);
      FormSubmission _formSubmission = null;
      while(reader.Read())
      {
          _formSubmission = new FormSubmission();
          if(reader["FormSubmissionId"] != DBNull.Value)
              _formSubmission.FormSubmissionId = Convert.ToInt32(reader["FormSubmissionId"]);
          if(reader["UserId"] != DBNull.Value)
              _formSubmission.UserId = Convert.ToInt32(reader["UserId"]);
          if(reader["IsAnonymous"] != DBNull.Value)
              _formSubmission.IsAnonymous = Convert.ToBoolean(reader["IsAnonymous"]);
          if(reader["SubmissionDate"] != DBNull.Value)
              _formSubmission.SubmissionDate = Convert.ToDateTime(reader["SubmissionDate"]);
          if(reader["IPAddress"] != DBNull.Value)
              _formSubmission.IPAddress = Convert.ToString(reader["IPAddress"]);
          if(reader["IsValid"] != DBNull.Value)
              _formSubmission.IsValid = Convert.ToBoolean(reader["IsValid"]);
          if(reader["EmailSent"] != DBNull.Value)
              _formSubmission.EmailSent = Convert.ToBoolean(reader["EmailSent"]);
          if(reader["SMSSent"] != DBNull.Value)
              _formSubmission.SMSSent = Convert.ToBoolean(reader["SMSSent"]);
          if(reader["FormDocumentID"] != DBNull.Value)
              _formSubmission.FormDocumentID = Convert.ToInt32(reader["FormDocumentID"]);
      _formSubmission.NewRecord = false;             }             reader.Close();
      return _formSubmission;
 }