コード例 #1
0
        protected void SaveClick(object sender, CommandEventArgs e)
        {
            Protocol        Protocol = new Protocol();
            ProtocolVersion Version  = new ProtocolVersion();

            foreach (Control con in Form.Controls)
            {
                if (con is ICaisisInputControl)
                {
                    ICaisisInputControl cic = (ICaisisInputControl)con;
                    if (cic.Required && cic.Value.Trim() == "")
                    {
                        UserMessage.Text = "<span class=\"requiredField\">Fields named in red are required.</span>";
                        return;
                    }
                    string fieldName = cic.Field;
                    if (cic.Table == "Protocols")
                    {
                        Protocol[fieldName] = cic.Value;
                    }
                    else
                    {
                        Version[fieldName] = cic.Value;
                    }
                }
            }

            // need to set entered
            Protocol[Protocol.EnteredBy]   = EnteredBy.Text;
            Protocol[Protocol.EnteredTime] = EnteredTime.Text;

            if (e.CommandName.Equals("Lock"))
            {
                Protocol.Lock();
                Version.Lock();
            }
            else if (e.CommandName.Equals("Unlock"))
            {
                Protocol.Unlock();
                Version.Unlock();
            }
            else
            {
                Protocol.Save();
                if (!String.IsNullOrEmpty(Protocol[Protocol.ProtocolId].ToString()))
                {
                    Version[ProtocolVersion.ProtocolId] = Protocol[Protocol.ProtocolId];
                    Version.Save();
                }
            }

            RegisterUpdatePageScript();
        }
コード例 #2
0
        /// <summary>
        /// Deletes the association of metadatasurvey a protocol version
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void DeleteAssociationClick(object sender, EventArgs e)
        {
            // get versionid for this row and remove association
            int             rowIndex  = ((sender as ImageButton).NamingContainer as GridViewRow).RowIndex;
            int             versionId = (int)ProtocolVersionsGrid.DataKeys[rowIndex][ProtocolVersion.ProtocolVersionId];
            ProtocolVersion version   = new ProtocolVersion();

            version.Get(versionId);
            version[ProtocolVersion.MetadataSurveyId] = string.Empty;
            version.Save();
            // rebind list to show changes
            BindProtocolVersions();
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void UpdateAssociationClick(object sender, EventArgs e)
        {
            // locate selected survey
            GridViewRow row          = (sender as ImageButton).NamingContainer as GridViewRow;
            string      metaSurveyId = (row.FindControl("AssociatedSurveyList") as DropDownList).SelectedValue;

            if (!string.IsNullOrEmpty(metaSurveyId))
            {
                // get pri key
                int             versionId = int.Parse(ProtocolVersionsGrid.DataKeys[row.RowIndex][ProtocolVersion.ProtocolVersionId].ToString());
                ProtocolVersion biz       = new ProtocolVersion();
                biz.Get(versionId);
                biz[ProtocolVersion.MetadataSurveyId] = metaSurveyId;
                biz.Save();
                // rebind list of versions
                BindProtocolVersions();
                // load survey
                BuildEligibilityQuestionnaire(int.Parse(metaSurveyId));
            }
        }
コード例 #4
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            // validate approval date
            DateTime testDate = DateTime.Now;

            if (string.IsNullOrEmpty(ApprovalDate.Text) || !DateTime.TryParse(ApprovalDate.Text, out testDate))
            {
                ApprovalDateValidator.IsValid = false;
            }
            else
            {
                ProtocolVersion biz        = new ProtocolVersion();
                int             protocolId = int.Parse(BaseProtocolId);
                // copying
                if (!string.IsNullOrEmpty(CopyVersionId))
                {
                    biz = ProtocolMgmtController.CopyProtocolVersion(int.Parse(CopyVersionId));
                }
                else
                {
                    // updating
                    if (numVersionId != -1)
                    {
                        biz.Get(numVersionId);
                    }
                    // new record
                    else
                    {
                        biz[ProtocolVersion.ProtocolId] = protocolId;
                    }
                }
                CICHelper.SetBOValues(Form.Controls, biz, protocolId);
                biz.Save();
                RefreshMainScreen((int)biz[biz.PrimaryKeyName]);
            }
        }