Esempio n. 1
0
        /// <summary>add GeneratedReadSetControls</summary>
        public override void ApplyDerivedFunctionality(TFormWriter writer, TControlDef control)
        {
            TControlDef ctrl        = writer.CodeStorage.GetControl(control.xmlNode.Name);
            string      numericType = ctrl.GetAttribute("Format");

            if (numericType == "Currency")
            {
                ReportControls.GenerateReadSetControls(writer, control.xmlNode, writer.Template, "DECIMALTEXTBOX");
            }
        }
Esempio n. 2
0
        /// <summary>add GeneratedReadSetControls</summary>
        public override void ApplyDerivedFunctionality(TFormWriter writer, TControlDef ctrl)
        {
            ReportControls.GenerateReadSetControls(writer, ctrl.xmlNode, writer.Template, "CHECKBOX");

            // we are not doing it the same way as in RadioGroupComplexReportGenerator.
            // difference here: we will always store the value of the dependant controls, even when the checkbox is not ticked
            foreach (TControlDef childCtrl in ctrl.Children)
            {
                childCtrl.SetAttribute("DependsOnRadioButton", "");
                IControlGenerator ctrlGenerator = writer.FindControlGenerator(childCtrl);
                ctrlGenerator.ApplyDerivedFunctionality(writer, childCtrl);
                childCtrl.SetAttribute("DependsOnRadioButton", "true");
            }
        }
Esempio n. 3
0
        /// <summary>add GeneratedReadSetControls, and all dependent controls</summary>
        public override void ApplyDerivedFunctionality(TFormWriter writer, TControlDef control)
        {
            string paramName = ReportControls.GetParameterName(control.xmlNode);

            if (paramName == null)
            {
                return;
            }

            StringCollection Controls =
                TYml2Xml.GetElements(TXMLParser.GetChild(control.xmlNode, "Controls"));

            foreach (string controlName in Controls)
            {
                TControlDef rbtCtrl  = writer.CodeStorage.GetControl(controlName);
                string      rbtValue = rbtCtrl.Label;
                rbtValue = StringHelper.UpperCamelCase(rbtValue.Replace("'", "").Replace(" ", "_"), false, false);

                if (rbtCtrl.HasAttribute("ParameterValue"))
                {
                    rbtValue = rbtCtrl.GetAttribute("ParameterValue");
                }

                string rbtName = "rbt" + controlName.Substring(3);

                if (controlName.StartsWith("layoutPanel"))
                {
                    // the table layouts of sub controls for each radio button need to be skipped
                    continue;
                }

                ProcessTemplate RadioButtonReadControlsSnippet = writer.Template.GetSnippet("RADIOBUTTONREADCONTROLS");
                RadioButtonReadControlsSnippet.SetCodelet("RBTNAME", rbtName);
                RadioButtonReadControlsSnippet.SetCodelet("PARAMNAME", paramName);
                RadioButtonReadControlsSnippet.SetCodelet("RBTVALUE", rbtValue);
                RadioButtonReadControlsSnippet.SetCodelet("READCONTROLS", "");

                XmlNode childControls = TXMLParser.GetChild(rbtCtrl.xmlNode, "Controls");

                // only assign variables that make sense
                if (childControls != null)
                {
                    StringCollection childControlNames = TYml2Xml.GetElements(childControls);

                    foreach (string childName in childControlNames)
                    {
                        if (childName.StartsWith("layoutPanel"))
                        {
                            continue;
                        }

                        TControlDef       childCtrl = writer.CodeStorage.GetControl(childName);
                        IControlGenerator generator = writer.FindControlGenerator(childCtrl);

                        // make sure we ignore Button etc
                        if (generator.GetType().ToString().EndsWith("ReportGenerator"))
                        {
                            childCtrl.SetAttribute("DependsOnRadioButton", "");
                            ReportControls.GenerateReadSetControls(writer,
                                                                   childCtrl.xmlNode,
                                                                   RadioButtonReadControlsSnippet,
                                                                   generator.TemplateSnippetName);
                            childCtrl.SetAttribute("DependsOnRadioButton", "true");
                        }
                    }
                }

                writer.Template.InsertSnippet("READCONTROLS", RadioButtonReadControlsSnippet);

                ProcessTemplate RadioButtonSetControlsSnippet = writer.Template.GetSnippet("RADIOBUTTONSETCONTROLS");
                RadioButtonSetControlsSnippet.SetCodelet("RBTNAME", rbtName);
                RadioButtonSetControlsSnippet.SetCodelet("PARAMNAME", paramName);
                RadioButtonSetControlsSnippet.SetCodelet("RBTVALUE", rbtValue);

                // only assign variables that make sense
                if (childControls != null)
                {
                    StringCollection childControlNames = TYml2Xml.GetElements(childControls);

                    foreach (string childName in childControlNames)
                    {
                        if (childName.StartsWith("layoutPanel"))
                        {
                            continue;
                        }

                        TControlDef       childCtrl = writer.CodeStorage.GetControl(childName);
                        IControlGenerator generator = writer.FindControlGenerator(childCtrl);

                        // make sure we ignore Button etc
                        if (generator.GetType().ToString().EndsWith("ReportGenerator"))
                        {
                            childCtrl.SetAttribute("DependsOnRadioButton", "");
                            ReportControls.GenerateReadSetControls(writer,
                                                                   childCtrl.xmlNode,
                                                                   RadioButtonSetControlsSnippet,
                                                                   generator.TemplateSnippetName);
                            childCtrl.SetAttribute("DependsOnRadioButton", "true");
                        }
                    }
                }

                writer.Template.InsertSnippet("SETCONTROLS", RadioButtonSetControlsSnippet);
            }
        }
Esempio n. 4
0
 /// <summary>add GeneratedReadSetControls</summary>
 public override void ApplyDerivedFunctionality(TFormWriter writer, TControlDef control)
 {
     ReportControls.GenerateReadSetControls(writer, control.xmlNode, writer.Template, "TTXTPETRADATE");
 }