Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            IConverter c       = ConverterProvider.CreateConverter(cboType.Text);
            XmlElement element = XmlHelper.ParseAsDOM(txtContent.Text);

            element.SetAttribute("Name", txtName.Text);
            element.SetAttribute("Type", cboType.SelectedItem + string.Empty);
            c.Load(element);

            _converter = c;
            Completed.Invoke(this, EventArgs.Empty);
            this.Close();
        }
Exemplo n.º 2
0
        private void cboType_SelectedIndexChanged(object sender, EventArgs e)
        {
            string type = cboType.Text;

            if (_converter != null && type == _converter.Type)
            {
                txtContent.Text = _converter.Output().OuterXml;
            }
            else
            {
                IConverter converter = ConverterProvider.CreateConverter(type);
                txtContent.Text = converter.GetSample().OuterXml;
            }
            txtContent.FormatXml();
        }
Exemplo n.º 3
0
        private ServiceEntity(XmlElement definition)
        {
            XmlHelper h = new XmlHelper(definition);

            this.SQLTemplate      = h.GetText("SQLTemplate");
            ResponseRecordElement = h.GetText("ResponseRecordElement");
            RequestRecordElement  = h.GetText("RequestRecordElement");
            FieldList             = new FieldList(h.GetElement("FieldList"));
            ConditionList         = new ConditionList(h.GetElement("Conditions"));
            Orders     = new OrderList(h.GetElement("Orders"));
            Pagination = new Pagination(h.GetElement("Pagination"));

            ServiceAction action = ServiceAction.Select;

            if (!Enum.TryParse <ServiceAction>(h.GetText("Action"), true, out action))
            {
                action = ServiceAction.Select;
            }
            Action = action;

            this.Variables = new List <IVariable>();
            foreach (XmlElement varElement in h.GetElements("InternalVariable/Variable"))
            {
                IVariable v = VariableFactory.Parse(varElement);
                if (v != null)
                {
                    Variables.Add(v);
                }
            }

            this.Converters = new List <IConverter>();
            foreach (XmlElement cvElement in h.GetElements("Converters/Converter"))
            {
                string     type = cvElement.GetAttribute("Type");
                IConverter c    = ConverterProvider.CreateConverter(type);
                c.Load(cvElement);

                this.Converters.Add(c);
            }

            this.Preprocesses = new List <Preprocess>();
            foreach (XmlElement preElement in h.GetElements("Preprocesses/Preprocess"))
            {
                Preprocess p = Preprocess.Parse(preElement);
                this.Preprocesses.Add(p);
            }
        }