コード例 #1
0
        /// <summary>
        /// Registers client arrays used for auto-populating date fields when status is updated.
        /// </summary>
        private void RegisterPerformedDateFields()
        {
            // get all fields which end in Date or DateText, which aren't in black list of fields (exclude StopDate fields)
            var allDataEntryDateFields = from icic in PageUtil.GetCaisisInputControlsInContainer(dataEntryContainer)
                                         where !string.IsNullOrEmpty(icic.Field)
                                         where (icic.Field.EndsWith("Date") || icic.Field.EndsWith("DateText")) && !icic.Field.Contains("StopDate")
                                         where !ExcludedDateFields.Contains(icic.Field)
                                         select icic as Control;

            // get a list of fields which are part of a grid
            var fieldsInGrid = from field in allDataEntryDateFields
                               where field.NamingContainer is GridViewRow
                               select field;

            // get a list of fields not part of a grid
            var fieldNotInGrid = allDataEntryDateFields.Except(fieldsInGrid);

            // register client arrays
            CLIENT_STANDARD_PERFORMED_DATE_TEXT_FIELDS = GetClientControlIdList(fieldNotInGrid);
            CLIENT_GRID_PERFORMED_DATE_TEXT_FIELDS     = GetClientControlIdList(fieldsInGrid);

            // register data entry table names
            if (dataEntryTableNames.Count() == 0)
            {
                DATA_ENTRY_TABLE_NAMES = "";
            }
            else
            {
                DATA_ENTRY_TABLE_NAMES = "'" + string.Join("','", dataEntryTableNames.ToArray()) + "'";
            }
        }
コード例 #2
0
        protected void PopulateLargeFields()
        {
            ProjectLetterOfIntent biz = new ProjectLetterOfIntent();

            biz.Get(Int32.Parse(LetterOfIntentId));
            CICHelper.SetFieldValues(this.Controls, biz);
            List <ICaisisInputControl> cicList = PageUtil.GetCaisisInputControlsInContainer(this);

            foreach (ICaisisInputControl cic in cicList)
            {
                if (cic is CaisisTextArea)
                {
                    string jsDesc = "showFieldDescription(this,'" + cic.Field + "');";

                    CaisisTextArea cicTA = cic as CaisisTextArea;
                    cicTA.Attributes.Add("onfocus", jsDesc);
                    // Locate helper HTML node used for displaying HTML content contained
                    // in TextArea node
                    string             helperHTMLDivId = cicTA.ID + "HTML";
                    HtmlGenericControl helperDIV       = this.FindControl(helperHTMLDivId) as HtmlGenericControl;
                    if (helperDIV != null)
                    {
                        helperDIV.InnerHtml = cic.Value;
                    }
                }
            }
        }
コード例 #3
0
ファイル: BaseControl.cs プロジェクト: aomiit/caisis
        /// <summary>
        /// Save/update the current form record for the given T Business object, using this component's fields.
        /// </summary>
        /// <typeparam name="T">The BusinessObject type param</typeparam>
        /// <param name="container">The container containing the input controls</param>
        /// <param name="parKey">The optional parent key</param>
        /// <param name="priKey">The optional primary key to load BusinessObject</param>
        /// <returns>A new instance of BusinessObject T with the saved record.</returns>
        public T SaveRecord <T>(Control container, int?parKey, int?priKey) where T : BusinessObject, IBusinessObject, new()
        {
            T biz = new T();

            if (priKey.HasValue)
            {
                biz.Get(priKey.Value);
            }
            else if (parKey.HasValue)
            {
                string parKeyName = biz.ParentKeyName;
                if (!string.IsNullOrEmpty(parKeyName))
                {
                    biz[parKeyName] = parKey.Value;
                }
            }
            // filter inputs by table
            var inputs = PageUtil.GetCaisisInputControlsInContainer(container).Where(i => i.Table == biz.TableName && !string.IsNullOrEmpty(i.Field) && biz.HasField(i.Field));

            foreach (var input in inputs)
            {
                if (biz.HasField(input.Field + ""))
                {
                    biz[input.Field] = input.Value;
                }
            }
            SaveBizo(biz);
            return(biz);
        }
コード例 #4
0
        /// <summary>
        /// During pre-render, get the late bound clientid of the identifier field and register validation script on control
        /// </summary>
        private void RegisterScript()
        {
            List <string> validateFields = new List <string>();

            if (!string.IsNullOrEmpty(IdentifierControlId))
            {
                Control idField = PageUtil.RecursiveFindControl(this, IdentifierControlId);
                if (idField != null)
                {
                    validateFields.Add((idField as Control).ClientID);
                }
            }
            else
            {
                foreach (ICaisisInputControl icic in PageUtil.GetCaisisInputControlsInContainer(Page))
                {
                    if (!string.IsNullOrEmpty(icic.Table) && icic.Table == "Patients" && !string.IsNullOrEmpty(icic.Field) && icic.Field == Patient.PtMRN)
                    {
                        string IdFieldClientId = (icic as Control).ClientID;
                        validateFields.Add(IdFieldClientId);
                    }
                }
            }
            if (validateFields.Count > 0)
            {
                string clientScriptKey  = "ValidateIdentifier";
                string clientFieldArray = "['" + string.Join("','", validateFields.ToArray()) + "']";
                string clientScript     = string.Format("initValidateIdentifierFields({0});", clientFieldArray);
                Page.ClientScript.RegisterStartupScript(this.GetType(), clientScriptKey, clientScript, true);
            }
        }
コード例 #5
0
        /// <summary>
        /// Loads a component into the container Panel
        /// </summary>
        /// <param name="componentPath"></param>
        protected void LoadComponent(string componentPath)
        {
            componentPath = Server.UrlDecode(componentPath);
            Control componenet = Page.LoadControl(componentPath);

            if (componenet != null)
            {
                ComponentHolder.Controls.Add(componenet);

                // generate XML debug
                var eFormDebug = new XElement("EformComponent",
                                              from eControl in PageUtil.GetCaisisInputControlsInContainer(componenet).OfType <IEformInputField>()
                                              let table = eControl.Table
                                                          let recordId = eControl.RecordId
                                                                         let parentRecordId                         = eControl.ParentRecordId
                                                                                                          let depth = BOL.BusinessObjectFactory.CanBuildBusinessObject(table) ? BOL.BusinessObject.GetTableDepth(table) : int.MaxValue
                                                                                                                      group eControl by new { Table = table, RecordId = recordId, Depth = depth } into g
                                              let sortOrder = !string.IsNullOrEmpty(g.Key.RecordId) ? int.Parse(g.Key.RecordId) : 0
                                                              orderby g.Key.Depth ascending, sortOrder ascending, g.Key.Table ascending
                                              select new XElement(g.Key.Table,
                                                                  g.Key.RecordId != null ? new XAttribute("RecordId", g.Key.RecordId) : null,
                                                                  from e in g
                                                                  orderby e.Field ascending
                                                                  select new XElement(e.Field, string.Empty)));

                EFromXMLDebug.Text = eFormDebug.ToString();
            }
            else
            {
                EFromXMLDebug.Text = string.Empty;
            }
        }
コード例 #6
0
ファイル: BaseEFormControl.cs プロジェクト: aomiit/caisis
        protected void OverrideLookupCodes()
        {
            if (!String.IsNullOrEmpty(this.LookupCodes))
            {
                char[]   splitchar1 = { ',' };
                string[] lkpCodeArr = this.LookupCodes.Split(splitchar1);

                List <ICaisisInputControl> cicList = PageUtil.GetCaisisInputControlsInContainer(this);

                foreach (ICaisisInputControl con in cicList)
                {
                    if (con is ICaisisLookupControl)
                    {
                        foreach (string s in lkpCodeArr)
                        {
                            // [0] is TableName, [1] is FieldName, [2] is LookupCodeName: i.e. Procedures.ProcName.ProcName
                            char[]   splitchar2 = { '.' };
                            string[] parsed     = s.Trim().Split(splitchar2);

                            if (parsed.Length > 2 && parsed[0].Equals(con.Table) && parsed[1].Equals(con.Field))
                            {
                                ICaisisLookupControl lkpControl = (ICaisisLookupControl)con;
                                lkpControl.LookupCode = parsed[2];
                            }
                        }
                    }
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// Track changes to input controls to track "dirty" fields
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void AddChangeEventHanlders(object sender, GridViewRowEventArgs e)
        {
            var cicList = PageUtil.GetCaisisInputControlsInContainer(e.Row);

            foreach (ICaisisInputControl cic in cicList)
            {
                cic.ValueChanged += MarkRowDirty;
            }
        }
コード例 #8
0
ファイル: ProtocolsPlugin.ascx.cs プロジェクト: aomiit/caisis
        private void RegisterStartupVariables()
        {
            List <ICaisisInputControl> cicList = PageUtil.GetCaisisInputControlsInContainer(Page);

            foreach (ICaisisInputControl cic in cicList)
            {
                if (cic.Field == Protocol.ProtocolId)
                {
                    string protocolIdClientId = "var protocolIdRef = '" + (cic as Control).ClientID + "';";
                    Page.ClientScript.RegisterStartupScript(typeof(Page), "protocolIdRef", protocolIdClientId, true);
                }
            }
        }
コード例 #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SetLabelState(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                // determine if in edit of readonly mode
                bool isEdit = BtnSave.Visible;

                CaisisSelect orgs = e.Item.FindControl("OrgSel") as CaisisSelect;
                orgs.DataSource = AllOrganizations;
                orgs.DataBind();

                CaisisSelect contacts = e.Item.FindControl("ContactSel") as CaisisSelect;
                contacts.DataSource = AllContacts;
                contacts.DataBind();

                string priKeyValue = DataBinder.Eval(e.Item.DataItem, ProjectCommunicationLog.CommunicationLogId).ToString();
                // populate fields
                foreach (ICaisisInputControl icic in PageUtil.GetCaisisInputControlsInContainer(e.Item))
                {
                    icic.Value = DataBinder.Eval(e.Item.DataItem, icic.Field).ToString();
                    // show control in edit mode
                    icic.Visible = isEdit;
                    // if control has associated label, show/hide by mdoe
                    Label readOnlyLabel = e.Item.FindControl(icic.Field + "Label") as Label;
                    if (readOnlyLabel != null)
                    {
                        // special cases
                        if (icic.Field == ProjectCommunicationLog.OrganizationId)
                        {
                            readOnlyLabel.Text = GetOrganizationName(icic.Value);
                        }
                        else if (icic.Field == ProjectCommunicationLog.ContactId)
                        {
                            readOnlyLabel.Text = GetContactName(icic.Value);
                        }
                        else
                        {
                            readOnlyLabel.Text = icic.Value;
                        }
                        readOnlyLabel.Visible = !isEdit;
                    }
                }

                // finally set delete button
                ImageButton deleteBtn = e.Item.FindControl("DeleteBtn") as ImageButton;
                // only show edit button when pri key exists and in edit mode
                deleteBtn.Visible = isEdit && !string.IsNullOrEmpty(priKeyValue);
            }
        }
コード例 #10
0
 /// <summary>
 /// Set Value for CaisisSelect controls in the GridView
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void SetFieldValues(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowIndex > -1)
     {
         List <ICaisisInputControl> cicList = PageUtil.GetCaisisInputControlsInContainer(e.Row);
         foreach (ICaisisInputControl cic in cicList)
         {
             object o = DataBinder.Eval(DataBinder.GetDataItem(e.Row), cic.Field);
             if (o != null)
             {
                 cic.Value = o.ToString();
             }
         }
     }
     AddClickEventToButtons(sender, e);
 }
コード例 #11
0
 /// <summary>
 /// Fields which ends in Date, should display short date on bound
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void SetShortDateFields(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         foreach (ICaisisInputControl icic in PageUtil.GetCaisisInputControlsInContainer(e.Row))
         {
             if (!string.IsNullOrEmpty(icic.Value) && icic.Field.EndsWith("Date"))
             {
                 DateTime testDate;
                 if (DateTime.TryParse(icic.Value, out testDate))
                 {
                     icic.Value = testDate.ToShortDateString();
                 }
             }
         }
     }
 }
コード例 #12
0
        /// <summary>
        /// Populates fields based on biz object
        /// </summary>
        /// <param name="projectApprovalId"></param>
        protected void PopulateForm(int projectApprovalId)
        {
            ProjectLetterOfIntent biz = new ProjectLetterOfIntent();

            biz.Get(projectApprovalId);
            CICHelper.SetFieldValues(this.Controls, biz);
            List <ICaisisInputControl> cicList = PageUtil.GetCaisisInputControlsInContainer(this.Page);

            foreach (ICaisisInputControl cic in cicList)
            {
                string jsDesc = "showFieldDescription(this,'" + cic.Field + "');";
                if (cic is CaisisTextBox)
                {
                    (cic as CaisisTextBox).Attributes.Add("onfocus", jsDesc);
                }
                else if (cic is CaisisSelect)
                {
                    (cic as CaisisSelect).Attributes.Add("onfocus", jsDesc);
                }
                else if (cic is CaisisTextArea)
                {
                    CaisisTextArea cicTA = cic as CaisisTextArea;
                    cicTA.Attributes.Add("onfocus", jsDesc);
                    // Locate helper HTML node used for displaying HTML content contained
                    // in TextArea node
                    string             helperHTMLDivId = cicTA.ID + "HTML";
                    HtmlGenericControl helperDIV       = this.FindControl(helperHTMLDivId) as HtmlGenericControl;
                    if (helperDIV != null)
                    {
                        helperDIV.InnerHtml = cic.Value;
                    }
                }
                else if (cic is CaisisCheckBox)
                {
                    (cic as CaisisCheckBox).Attributes.Add("onchange", jsDesc);
                }
            }

            //if (biz.RecordCount > 0)
            if (!biz.IsEmpty)
            {
                string strDiseaseState = biz[ProjectLetterOfIntent.PopulationDiseaseState].ToString();
                diseaseStates = new List <string>(strDiseaseState.Split(','));
                PopulateDiseaseState();
            }
        }
コード例 #13
0
        /// <summary>
        /// Dynamically adds hidden fields to the grid to keep track of which rows becomes dirty
        /// when normal grid dirty functionality isn't triggered
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void WireSpecimenTrackerTextBoxes(object sender, EventArgs e)
        {
            GridView myGrid = sender as GridView;

            // Get SpecimenAccessionId and register Array of Specimens with child Speicmens
            if (myGrid.DataKeys.Count > 0)
            {
                // Get SpecimenAccessionId from first row, since all rows share SpecimenAccessionId
                object specAccKey = myGrid.DataKeys[0][Specimen.SpecimenAccessionId];
                if (specAccKey != null && !string.IsNullOrEmpty(specAccKey.ToString()))
                {
                    int specAccId             = int.Parse(specAccKey.ToString());
                    SpecimenManagerDa da      = new SpecimenManagerDa();
                    DataTable         dt      = da.GetSpecimenshavingChilds(specAccId);
                    List <string>     specIds = new List <string>();
                    foreach (DataRow row in dt.Rows)
                    {
                        string specIdWithChildren = row[Specimen.ParentSpecimenId].ToString();
                        if (!string.IsNullOrEmpty(specIdWithChildren))
                        {
                            specIds.Add(specIdWithChildren);
                        }
                    }
                    //Array of all specimenIds of specimens having children, create safe js array, insetad of new Array();
                    string jsArray = "var SpecimensWithChildren = [" + string.Join(",", specIds.ToArray()) + "];";

                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "SpecimensWithChildren", jsArray, true);
                }
            }

            foreach (GridViewRow row in myGrid.Rows)
            {
                List <ICaisisInputControl> cicList = PageUtil.GetCaisisInputControlsInContainer(row);
                foreach (ICaisisInputControl iCIC in cicList)
                {
                    if (iCIC.Field == SpecimenPosition.BoxId)
                    {
                        HiddenField tracker = new HiddenField();
                        tracker.ValueChanged += GetRecordUpdatingHandler(myGrid);
                        // Tracker ID is determined by Ref BoxId field
                        tracker.ID = (iCIC as Control).ID + "Tracker";
                        row.Cells[0].Controls.Add(tracker);
                    }
                }
            }
        }
コード例 #14
0
        /// <summary>
        /// Fired before grid is rendering, to show/hide blank rows
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void HideBlankGridRows(object sender, EventArgs e)
        {
            int rowCount = LookupCodeGrid.Rows.Count;
            int realRow  = rowCount - BLANK_LOOKUPCODE_ROWS;

            for (int i = 0; i < rowCount; i++)
            {
                // Hide all empty rows except first
                bool        hideRow       = i > realRow;
                bool        isBlankRow    = i >= realRow;
                GridViewRow row           = LookupCodeGrid.Rows[i];
                HtmlImage   img           = row.FindControl("ShowNextRowButton") as HtmlImage;
                ImageButton deleteImage   = row.FindControl("DeleteRow") as ImageButton;
                string      nextRowScript = "showNextAddRow($('" + img.ClientID + "')," + i + ");";
                // Hide all blank rows except first
                if (hideRow)
                {
                    row.CssClass = "HiddenRow";
                }
                // Show Add Button on All Blank Rows
                if (isBlankRow)
                {
                    img.Visible = true;
                    img.Attributes.Add("onclick", nextRowScript);
                }
                else
                {
                    deleteImage.Visible = true;
                }
                // Set UI Change
                List <ICaisisInputControl> cicList = PageUtil.GetCaisisInputControlsInContainer(row);
                foreach (ICaisisInputControl cic in cicList)
                {
                    string onChange = "return onRowKeyEvent(event,'" + img.ClientID + "'," + i + ");";
                    if (cic is TextBox)
                    {
                        (cic as TextBox).Attributes.Add("onkeypress", onChange);
                    }
                    else if (cic is CheckBox)
                    {
                        (cic as CheckBox).Attributes.Add("onkeypress", onChange);
                    }
                }
            }
        }
コード例 #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OnLookupGridRowUpdaing(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row = LookupCodeGrid.Rows[e.RowIndex];
            List <ICaisisInputControl> cicList = PageUtil.GetCaisisInputControlsInContainer(row);
            LookupCode biz    = new LookupCode();
            object     priKey = LookupCodeGrid.DataKeys[e.RowIndex].Value;

            // Insert/No Key Present
            if (!priKey.ToString().Equals(string.Empty))
            {
                int lkpCodeId = (int)priKey;
                biz.Get(lkpCodeId);
            }
            if (Request.Form["lkpName"] != null)
            {
                biz[LookupCode.LkpFieldName] = Request.Form["lkpName"];
            }
            else if (!string.IsNullOrEmpty(lkpFieldName.Value))
            {
                biz[LookupCode.LkpFieldName] = lkpFieldName.Value;
            }
            else if (!string.IsNullOrEmpty(fieldName.SelectedValue))
            {
                biz[LookupCode.LkpFieldName] = fieldName.SelectedValue;
            }
            else
            {
                return;
            }
            // Manually Extract values to fix issues with LkpSupress
            foreach (ICaisisInputControl cic in cicList)
            {
                if (cic is CaisisCheckBox)
                {
                    CaisisCheckBox cb = cic as CaisisCheckBox;
                    biz[cic.Field] = cb.Checked;
                }
                else
                {
                    biz[cic.Field] = cic.Value;
                }
            }
            biz.Save();
        }
コード例 #16
0
        /// <summary>
        /// Attaches databind event handers to CaisisInputControl in each GridRow.
        /// Values are set based on underlying DataTable and corresponding CIC Fields.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected void WireControlDataBoundEvents(object sender, GridViewRowEventArgs args)
        {
            List <ICaisisInputControl> cicList = PageUtil.GetCaisisInputControlsInContainer(args.Row);

            foreach (ICaisisInputControl cic in cicList)
            {
                // Add events handler which sets values on controls based on field and table name
                // Event handler added during databinding, except for selects (dropdownlist)
                (cic as Control).DataBinding += CaisisGridView.CICDataBinderHandler;
                if (cic is TextBox)
                {
                    (cic as TextBox).TextChanged += MarkGridRowDirty;
                }
                else if (cic is CheckBox)
                {
                    (cic as CheckBox).CheckedChanged += MarkGridRowDirty;
                }
            }
        }
コード例 #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="container"></param>
        private void CollectClientCTCAEFields(Control container)
        {
            // find controls in container
            Dictionary <string, ICaisisInputControl> lookup = new Dictionary <string, ICaisisInputControl>();
            var cicList = PageUtil.GetCaisisInputControlsInContainer(container, new List <Type>()
            {
                typeof(GridView), typeof(Repeater)
            });

            foreach (ICaisisInputControl icic in cicList)
            {
                if (!lookup.ContainsKey(icic.Field))
                {
                    lookup.Add(icic.Field, icic);
                }
            }
            // tox name is required key
            if (lookup.ContainsKey(Toxicity.ToxName))
            {
                // collect client ids based on Field Name
                string[] clientIDs = new string[ToxFieldKeys.Length];
                for (var i = 0; i < ToxFieldKeys.Length; i++)
                {
                    string clientId  = string.Empty;
                    string fieldName = ToxFieldKeys[i];
                    if (lookup.ContainsKey(fieldName))
                    {
                        clientId = (lookup[fieldName] as Control).ClientID;
                    }
                    else
                    {
                        clientId = string.Empty;
                    }
                    clientIDs[i] = clientId;
                }

                string key          = string.Format("'{0}'", clientIDs[2]);
                string value        = string.Format("['{0}']", string.Join("','", clientIDs));
                string clientObject = string.Format("{0} : {1}", key, value);
                // add client object 'key' : ['a1','a2','a3','a4']
                ClientCTCAEArgumentList.Add(clientObject);
            }
        }
コード例 #18
0
ファイル: BaseControl.cs プロジェクト: aomiit/caisis
 /// <summary>
 /// Initialize required variables, i.e., patientId and events
 /// </summary>
 protected void InitControl()
 {
     patientId   = int.Parse(Session[SessionKey.PatientId].ToString());
     isFormDirty = false;
     // track field changes on load
     this.Load += (o, e) =>
     {
         var inputs = PageUtil.GetCaisisInputControlsInContainer(this);
         foreach (var input in inputs)
         {
             input.ValueChanged += MarkFormDirty;
         }
         var grid = PageUtil.GetControls <GridView>(this).Cast <Control>();
         var rptr = PageUtil.GetControls <Repeater>(this).Cast <Control>();;
         var dataBoundComponenets = grid.Concat(rptr);
         foreach (var componenet in dataBoundComponenets)
         {
             InitDirtyControlTracking(componenet);
         }
     };
 }
コード例 #19
0
        private void RestoreLargeFieldsFromHidden()
        {
            List <ICaisisInputControl> cicList = PageUtil.GetCaisisInputControlsInContainer(this.Page);

            foreach (ICaisisInputControl cic in cicList)
            {
                string jsDesc = "showFieldDescription(this,'" + cic.Field + "');";
                if (cic is CaisisTextArea)
                {
                    CaisisTextArea cicTA = cic as CaisisTextArea;
                    cicTA.Attributes.Add("onfocus", jsDesc);
                    // Locate helper HTML node used for displaying HTML content contained
                    // in TextArea node
                    string             helperHTMLDivId = cicTA.ID + "HTML";
                    HtmlGenericControl helperDIV       = this.FindControl(helperHTMLDivId) as HtmlGenericControl;
                    if (helperDIV != null)
                    {
                        helperDIV.InnerHtml = cic.Value;
                    }
                }
            }
        }
コード例 #20
0
        protected void UpdateProjectRecord(object sender, EventArgs e)
        {
            Project biz = new Project();

            biz.Get(projectId);

            List <ICaisisInputControl> cicList = PageUtil.GetCaisisInputControlsInContainer(Form);

            foreach (ICaisisInputControl cic in cicList)
            {
                if (biz.TableName == cic.Table && biz.HasField(cic.Field))
                {
                    if (cic.Enabled)
                    {
                        biz[cic.Field] = cic.Value;
                    }
                }
            }

            bool bAddFormChanged = false;

            if (biz["AdditionalFormNames"] != IncludeFormRadioList.SelectedValue)
            {
                biz["AdditionalFormNames"] = IncludeFormRadioList.SelectedValue;
                bAddFormChanged            = true;
            }

            //CICHelper.SetBOValues(Form.Controls, biz, -1);
            biz.Save();

            SetView();

            if (bAddFormChanged)
            {
                AddNewLOIRecord();
                RefreshMainList();
            }
        }
コード例 #21
0
        /// <summary>
        /// Populates the fiels on this form with a PatientDevaition record
        /// </summary>
        private void PopulateForm()
        {
            if (!string.IsNullOrEmpty(PatientItemId.Value))
            {
                // Populate patient item scheduled field
                int         patientItemId = int.Parse(base.DecrypyValue(PatientItemId.Value));
                PatientItem item          = new PatientItem();
                item.Get(patientItemId);
                if (item[PatientItem.ScheduledDate] != null && item[PatientItem.ScheduledDate].ToString() != "")
                {
                    string sDate = ((DateTime)item[PatientItem.ScheduledDate]).ToShortDateString();
                    ScheduledDate.Value     = sDate;
                    ScheduledDateText.Value = sDate;
                }

                // populate deviation
                if (!string.IsNullOrEmpty(PatientDeviationId.Value))
                {
                    int pdi = int.Parse(PatientDeviationId.Value);
                    PatientDeviation deviation = new PatientDeviation();
                    deviation.Get(pdi);
                    base.PopulateForm(deviation);
                    // cleanup date field display
                    var inputs = PageUtil.GetCaisisInputControlsInContainer(this);
                    foreach (var input in inputs)
                    {
                        if (input.Table == "ProtocolMgr_PatientDeviations" && input.Field.Contains("DeviationDate"))
                        {
                            if (!deviation.IsNull(input.Field))
                            {
                                input.Value = string.Format("{0:d}", deviation[input.Field]);
                            }
                        }
                    }
                }
            }
        }
コード例 #22
0
        /// <summary>
        /// Set SurveyType client id, as well as generate lookup array [field,field client id].
        /// </summary>
        private void RegisterInitScript()
        {
            Survey surveyBiz = new Survey();

            List <ICaisisInputControl> iCICs = PageUtil.GetCaisisInputControlsInContainer(Page);

            foreach (ICaisisInputControl iCIC in iCICs)
            {
                // set survey type client id, for getting user selected SurveyType
                if (iCIC.Table == surveyBiz.TableName && iCIC.Field == Survey.SurveyType)
                {
                    Control iControl = iCIC as Control;
                    SurveyTypeClientId = iControl.ClientID;
                    activeSurveyType   = iCIC.Value;
                    break;
                }
            }
            // build js array of [field,client id]
            IEnumerable <string> fieldsToClientId = from field in iCICs
                                                    where field.Table == surveyBiz.TableName && field.Field != Survey.SurveyType
                                                    select string.Format("['{0}','{1}']", field.Field, (field as Control).ClientID);

            clientSurveyFieldsLookup = string.Join(",", fieldsToClientId.ToArray());
        }
コード例 #23
0
ファイル: ValidateEForm.aspx.cs プロジェクト: aomiit/caisis
        /****************************************************************************************************************
        ***************************** Events that fire during validation ******************************************
        ****************************************************************************************************************/



        protected void WriteInvalidFields()
        {
            //1) loop over ALL files that comprise the eform
            //2) find input controls that match the field names in the invalidArray
            //3) if match is found add that file to the placholder
            //4) change style of invalid field

            // 1.
            string      modFolder     = Caisis.UI.Core.Classes.XmlUtil.GetParentModuleDirectory(base.EFormFileName + ".xml", "EForms");
            XmlDocument eformsXml     = XmlUtil.GetXmlDoc("~\\Modules\\" + modFolder + "\\EForms\\" + base.EFormFileName + ".xml");
            XmlNodeList eformSections = eformsXml.SelectNodes("eform[@name='" + base.EFormName + "']/eformSection");

            holder.Controls.Clear();

            foreach (XmlNode sectionNode in eformSections)
            {
                foreach (XmlNode controlNode in sectionNode)
                {
                    //DEBUG: Response.Write("<BR>"+controlNode.Attributes["controlName"].Value);

                    // need to iterate over all files included in this eform
                    System.Web.UI.UserControl eFormControl = base.GetEFormControl(controlNode.Attributes["controlName"].Value + ".ascx");

                    // 2.
                    foreach (Control con in PageUtil.GetCaisisInputControlsInContainer(eFormControl))
                    {
                        if (con is IEformInputField)
                        {
                            if (((IEformInputField)con).Field != null)
                            {
                                foreach (string[] s in invalidFields)
                                {
                                    string nodeName = s[0];
                                    string recordId = s[1];


                                    // only add field when record id and name of node matches
                                    if (recordId != null && ((IEformInputField)con).RecordId != null && ((IEformInputField)con).RecordId.Equals(recordId) && ((IEformInputField)con).Field.Equals(nodeName))
                                    {
                                        //Response.Write("<BR>MATCH Node: " + nodeName + " RECORDID: " + recordId);
                                        // 3.
                                        holder.Controls.Add(eFormControl);

                                        // 4.
                                        base.SetInvalidStyle(con, "yellow");
                                    }
                                    // no record id, just match name of node
                                    else if (((IEformInputField)con).Field.Equals(nodeName) && recordId == null)
                                    {
                                        //Response.Write("<BR>MATCH Node: " + nodeName);
                                        // 3.
                                        holder.Controls.Add(eFormControl);

                                        // 4.
                                        base.SetInvalidStyle(con, "yellow");
                                    }
                                }
                                //DEBUG: Response.Write("<BR>FIELD:" + ((IEformInputField)con).Field);
                            }
                        }
                    }
                }
            }
        }