private void SetDefaultValue(List <eFormData.Element> elementLst, List <AppointmentPrefillFieldValue> fieldValues) { foreach (eFormData.Element element in elementLst) { if (element.GetType() == typeof(eFormData.DataElement)) { eFormData.DataElement dataE = (eFormData.DataElement)element; foreach (eFormData.DataItem item in dataE.DataItemList) { if (item.GetType() == typeof(eFormData.NumberStepper)) { eFormData.NumberStepper numberStepper = (eFormData.NumberStepper)item; foreach (AppointmentPrefillFieldValue fv in fieldValues) { if (fv.FieldId == item.Id) { numberStepper.DefaultValue = int.Parse(fv.FieldValue); } } } if (item.GetType() == typeof(eFormData.Number)) { eFormData.Number numberStepper = (eFormData.Number)item; foreach (AppointmentPrefillFieldValue fv in fieldValues) { if (fv.FieldId == item.Id) { numberStepper.DefaultValue = int.Parse(fv.FieldValue); } } } if (item.GetType() == typeof(eFormData.Comment)) { eFormData.Comment comment = (eFormData.Comment)item; foreach (AppointmentPrefillFieldValue fv in fieldValues) { if (fv.FieldId == item.Id) { comment.Value = fv.FieldValue; } } } if (item.GetType() == typeof(eFormData.Text)) { eFormData.Text text = (eFormData.Text)item; foreach (AppointmentPrefillFieldValue fv in fieldValues) { if (fv.FieldId == item.Id) { text.Value = fv.FieldValue; } } } if (item.GetType() == typeof(eFormData.None)) { eFormData.None text = (eFormData.None)item; foreach (AppointmentPrefillFieldValue fv in fieldValues) { if (fv.FieldId == item.Id) { eFormShared.CDataValue cDataValue = new eFormShared.CDataValue(); cDataValue.InderValue = fv.FieldValue; text.Description = cDataValue; } } } if (item.GetType() == typeof(eFormData.EntitySearch)) { eFormData.EntitySearch text = (eFormData.EntitySearch)item; foreach (AppointmentPrefillFieldValue fv in fieldValues) { if (fv.FieldId == item.Id) { text.DefaultValue = int.Parse(fv.FieldValue); } } } if (item.GetType() == typeof(eFormData.EntitySelect)) { eFormData.EntitySelect text = (eFormData.EntitySelect)item; foreach (AppointmentPrefillFieldValue fv in fieldValues) { if (fv.FieldId == item.Id) { text.DefaultValue = int.Parse(fv.FieldValue); } } } } } else { eFormData.GroupElement groupElement = (eFormData.GroupElement)element; SetDefaultValue(groupElement.ElementList, fieldValues); } } }
public void SetDefaultValue(List <eFormData.Element> elementLst, List <eFormData.FieldValue> fieldValues) { foreach (eFormData.Element element in elementLst) { if (element.GetType() == typeof(eFormData.DataElement)) { eFormData.DataElement dataE = (eFormData.DataElement)element; foreach (eFormData.DataItem item in dataE.DataItemList) { if (item.GetType() == typeof(eFormData.NumberStepper)) { eFormData.NumberStepper numberStepper = (eFormData.NumberStepper)item; foreach (eFormData.FieldValue fv in fieldValues) { if (fv.FieldId == item.Id) { numberStepper.DefaultValue = int.Parse(fv.Value); } } } if (item.GetType() == typeof(eFormData.Number)) { eFormData.Number numberStepper = (eFormData.Number)item; foreach (eFormData.FieldValue fv in fieldValues) { if (fv.FieldId == item.Id) { numberStepper.DefaultValue = int.Parse(fv.Value); } } } if (item.GetType() == typeof(eFormData.Comment)) { eFormData.Comment comment = (eFormData.Comment)item; foreach (eFormData.FieldValue fv in fieldValues) { if (fv.FieldId == item.Id) { comment.Value = fv.Value; } } } if (item.GetType() == typeof(eFormData.Text)) { eFormData.Text text = (eFormData.Text)item; foreach (eFormData.FieldValue fv in fieldValues) { if (fv.FieldId == item.Id) { text.Value = fv.Value; } } } } } else { eFormData.GroupElement groupElement = (eFormData.GroupElement)element; SetDefaultValue(groupElement.ElementList, fieldValues); } } }