Пример #1
0
        public void SubmitSubmission(RCRSubmissionObject objSubmission)
        {
            SqlConnection conn = new SqlConnection();
            conn.ConnectionString = ConfigurationManager.AppSettings["RCRConnection"].ToString();
            conn.Open();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "spInsertSubmission";

            cmd.Parameters.Add(new SqlParameter("@FName", objSubmission.FName));
            cmd.Parameters.Add(new SqlParameter("@MName", objSubmission.MName));
            cmd.Parameters.Add(new SqlParameter("@LName", objSubmission.LName));
            cmd.Parameters.Add(new SqlParameter("@Title", objSubmission.Title));
            cmd.Parameters.Add(new SqlParameter("@DegreeId", objSubmission.DegreeId));
            cmd.Parameters.Add(new SqlParameter("@Membership", objSubmission.Membership));
            cmd.Parameters.Add(new SqlParameter("@AffiliationId", objSubmission.AffiliationId));
            cmd.Parameters.Add(new SqlParameter("@Address1", objSubmission.Address1));
            cmd.Parameters.Add(new SqlParameter("@Address2", objSubmission.Address2));
            cmd.Parameters.Add(new SqlParameter("@Address3", objSubmission.Address3));
            cmd.Parameters.Add(new SqlParameter("@City", objSubmission.City));
            cmd.Parameters.Add(new SqlParameter("@State", objSubmission.State));
            cmd.Parameters.Add(new SqlParameter("@Zip", objSubmission.Zip));
            cmd.Parameters.Add(new SqlParameter("@Email", objSubmission.Email));
            cmd.Parameters.Add(new SqlParameter("@Phone", objSubmission.Phone));
            cmd.Parameters.Add(new SqlParameter("@CA1FName", objSubmission.CA1FName));
            cmd.Parameters.Add(new SqlParameter("@CA1MName", objSubmission.CA1MName));
            cmd.Parameters.Add(new SqlParameter("@CA1LName", objSubmission.CA1LName));
            cmd.Parameters.Add(new SqlParameter("@CA1DegreeId", objSubmission.CA1DegreeId));
            cmd.Parameters.Add(new SqlParameter("@CA1AffiliationId", objSubmission.CA1AffiliationId));
            cmd.Parameters.Add(new SqlParameter("@CA2FName", objSubmission.CA2FName));
            cmd.Parameters.Add(new SqlParameter("@CA2MName", objSubmission.CA2MName));
            cmd.Parameters.Add(new SqlParameter("@CA2LName", objSubmission.CA2LName));
            cmd.Parameters.Add(new SqlParameter("@CA2DegreeId", objSubmission.CA2DegreeId));
            cmd.Parameters.Add(new SqlParameter("@CA2AffiliationId", objSubmission.CA2AffiliationId));
            cmd.Parameters.Add(new SqlParameter("@AuthorsInterest", objSubmission.AuthorsInterest));
            cmd.Parameters.Add(new SqlParameter("@TopicId", objSubmission.TopicId));
            cmd.Parameters.Add(new SqlParameter("@Biosketch", objSubmission.Biosketch));
            cmd.Parameters.Add(new SqlParameter("@LearningObjectives", objSubmission.LearningObjectives));
            cmd.Parameters.Add(new SqlParameter("@CurrDesc", objSubmission.CurrDesc));
            cmd.Parameters.Add(new SqlParameter("@SessionTypeId", objSubmission.SessionTypeId));
            cmd.Parameters.Add(new SqlParameter("@SessionTypeOther", objSubmission.SessionTypeOther));
            cmd.Parameters.Add(new SqlParameter("@CurrFormat", objSubmission.CurrFormat));
            cmd.Parameters.Add(new SqlParameter("@TeachingTools", objSubmission.TeachingTools));
            cmd.Parameters.Add(new SqlParameter("@TopicAssigned", objSubmission.TopicAssigned));
            cmd.Parameters.Add(new SqlParameter("@UnderstandAttestation1", objSubmission.UnderstandAttestation1));
            cmd.Parameters.Add(new SqlParameter("@UnderstandAttestation2", objSubmission.UnderstandAttestation2));
            cmd.Parameters.Add(new SqlParameter("@UnderstandAttestation3", objSubmission.UnderstandAttestation3));
            cmd.Parameters.Add(new SqlParameter("@DateCreated", objSubmission.DateCreated));

            cmd.Connection = conn;

            cmd.ExecuteNonQuery();

            conn.Close();
            cmd = null;
            conn = null;
        }
        protected void VerifySubmission(object sender, EventArgs e)
        {
            Boolean bReset = true;
            ResetAllDisplays(bReset);

            Boolean bValidated;
            Boolean bError = false;

            bValidated = VerifyFormat();

            if (bValidated)
            {
                bValidated = VerifyText();
            }
            if (bValidated)
            {
                bValidated = VerifySelections();
            }
            if (bValidated)
            {
                bValidated = VerifyTextCounts();
            }

            if (bValidated)
            {
                int iMembership = DetermineMembershipSelection();

                try
                {
                    RCRSubmissionObject objSubmission = new RCRSubmissionObject();

                    objSubmission.FName = txtFirstName.Text.Trim();
                    objSubmission.MName = txtMiddleName.Text.Trim();
                    objSubmission.LName = txtLastName.Text.Trim();
                    objSubmission.Title = txtTitle.Text.Trim();
                    objSubmission.DegreeId = ddlDegrees.SelectedIndex == 0 ? -1 : Convert.ToInt32(ddlDegrees.SelectedValue);
                    objSubmission.Membership = iMembership;
                    objSubmission.AffiliationId = ddlAffiliation.SelectedIndex == 0 ? -1 : Convert.ToInt32(ddlAffiliation.SelectedValue);
                    objSubmission.Address1 = txtAddress1.Text.Trim();
                    objSubmission.Address2 = txtAddress2.Text.Trim();
                    objSubmission.Address3 = txtAddress3.Text.Trim();
                    objSubmission.City = txtCity.Text.Trim();
                    objSubmission.State = ddlStates.SelectedValue;
                    objSubmission.Zip = Convert.ToInt32(txtZipCode.Text.Trim());
                    objSubmission.Email = txtEmailAddress.Text.Trim();
                    objSubmission.Phone = txtPhoneNumber.Text.Trim();
                    objSubmission.CA1FName = txtCA1FirstName.Text.Trim();
                    objSubmission.CA1MName = txtCA1MiddleName.Text.Trim();
                    objSubmission.CA1LName = txtCA1LastName.Text.Trim();
                    objSubmission.CA1DegreeId = ddlCA1Degrees.SelectedIndex == 0 ? -1 : Convert.ToInt32(ddlCA1Degrees.SelectedValue);
                    objSubmission.CA1AffiliationId = ddlCA1Affiliation.SelectedIndex == 0 ? -1 : Convert.ToInt32(ddlCA1Affiliation.SelectedValue);
                    objSubmission.CA2FName = txtCA2FirstName.Text.Trim();
                    objSubmission.CA2MName = txtCA2MiddleName.Text.Trim();
                    objSubmission.CA2LName = txtCA2LastName.Text.Trim();
                    objSubmission.CA2DegreeId = ddlCA2Degrees.SelectedIndex == 0 ? -1 : Convert.ToInt32(ddlCA2Degrees.SelectedValue);
                    objSubmission.CA2AffiliationId = ddlCA2Affiliation.SelectedIndex == 0 ? -1 : Convert.ToInt32(ddlCA2Affiliation.SelectedValue);
                    objSubmission.AuthorsInterest = taAuthorsInterest.Text.Trim();
                    objSubmission.TopicId = Convert.ToInt32(ddlTopics.SelectedValue);
                    objSubmission.Biosketch = taBiosketch.Text.Trim();
                    objSubmission.LearningObjectives = taLearningObjectives.Text.Trim();
                    objSubmission.CurrDesc = taCurrDesc.Text.Trim();
                    objSubmission.SessionTypeId = rblSessionType.SelectedValue == "" ? -1 : Convert.ToInt32(rblSessionType.SelectedValue);
                    objSubmission.SessionTypeOther = txtSessionTypeOther.Text.Trim();
                    objSubmission.CurrFormat = txtCurrFormat.Text.Trim();
                    objSubmission.TeachingTools = taTeachingTools.Text.Trim();
                    objSubmission.TopicAssigned = Convert.ToInt32(rblTopicAssigned.SelectedValue);
                    objSubmission.UnderstandAttestation1 = Convert.ToInt32(chkUnderstandAttestation1.Checked);
                    objSubmission.UnderstandAttestation2 = Convert.ToInt32(chkUnderstandAttestation2.Checked);
                    objSubmission.UnderstandAttestation3 = Convert.ToInt32(chkUnderstandAttestation3.Checked);
                    objSubmission.DateCreated = DateTime.Now;

                    RCRData objData = new RCRData();

                    objData.SubmitSubmission(objSubmission);

                    objData = null;
                }
                catch (Exception ex)
                {
                    MakeLogEntry(ex.Message);
                    bError = true;
                }

                if (!bError)
                {
                    DisplayMessage();
                }
                else
                {
                    DisplayErrorMessage();
                }
            }
        }