Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        public FieldSet.Builder FieldSet(FieldSet component)
        {
#if MVC
            component.ViewContext = this.HtmlHelper != null ? this.HtmlHelper.ViewContext : null;
#endif
            return(new FieldSet.Builder(component));
        }
Ejemplo n.º 2
0
        public override string XGetDesignTimeHtml(DesignerRegionCollection regions)
        {
            EditableDesignerRegion region = new EditableDesignerRegion(this, "Body", false);

            regions.Add(region);

            StringWriter   writer     = new StringWriter(CultureInfo.CurrentCulture);
            HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);

            FieldSet c = (FieldSet)this.Control;

            string width  = " width: {0};".FormatWith(c.Width.ToString());
            string height = " height: {0}px;".FormatWith((c.Height.Value - 39).ToString());

            string buttons = "";

            buttons += (c.CheckboxToggle && !c.Collapsible) ? "<input name=\"ext-comp-1002-checkbox\" type=\"checkbox\">" : "";
            buttons += (c.Collapsible && !c.CheckboxToggle) ? "<div class=\"x-tool x-tool-toggle\">&nbsp;</div>" : "";

            /*
             * 0 - ClientID
             * 1 - Title
             * 2 - Width
             * 3 - Height
             * 4 - Buttons
             * 5 - BodyStyle
             */

            object[] args = new object[6];
            args[0] = c.ClientID;
            args[1] = c.Title;
            args[2] = width;
            args[3] = height;
            args[4] = buttons;
            args[5] = c.BodyStyle;

            LiteralControl topCtrl = new LiteralControl(string.Format(this.HtmlBegin, args));

            topCtrl.RenderControl(htmlWriter);

            HtmlGenericControl div = (HtmlGenericControl)c.ContentContainer;

            div.Attributes[DesignerRegion.DesignerRegionAttributeName] = "0";
            div.InnerHtml = this.GetEditableDesignerRegionContent(region);
            div.RenderControl(htmlWriter);

            LiteralControl bottomCtrl = new LiteralControl(this.HtmlEnd);

            bottomCtrl.RenderControl(htmlWriter);

            return(writer.ToString());
        }
Ejemplo n.º 3
0
    public void GetChildControl(Ext.Net.Component wrapperComponent)
    {
        switch (wrapperComponent.ToString())
        {
        case "Ext.Net.Window":
            Ext.Net.Window window = (Ext.Net.Window)wrapperComponent;
            GenSql(window.Items);
            break;

        case "Ext.Net.Container":
            Ext.Net.Container ctainer = (Ext.Net.Container)wrapperComponent;
            GenSql(ctainer.Items);
            break;

        case "Ext.Net.FieldSet":
            Ext.Net.FieldSet fs = (Ext.Net.FieldSet)wrapperComponent;
            GenSql(fs.Items);
            break;

        default:
            break;
        }
    }
Ejemplo n.º 4
0
 /// <summary>Adds the fieldset to a parent container and returns it.</summary>
 /// <param name="container">The parent container onto which to add the container defined by this interface.</param>
 /// <returns>The newly added fieldset.</returns>
 public override Control AddTo(Control container)
 {
     FieldSet fieldSet = new FieldSet
     {
         ID = "FieldSet" + Name,
         Title = Legend,
         Collapsible = Collapsible,
         Collapsed = Collapsed,
         LabelAlign = LabelAlign.Top,
         Padding = 5,
         LabelSeparator = " "
     };
     if (container is ContentPanel)
     {
         ((ContentPanel) container).ContentControls.Add(fieldSet);
         ((ContentPanel) container).ContentControls.Add(new LiteralControl("<br />"));
     }
     else
     {
         container.Controls.Add(fieldSet);
         container.Controls.Add(new LiteralControl("<br />"));
     }
     return fieldSet;
 }
Ejemplo n.º 5
0
 protected virtual void AddToContainer(Control container, ItemEditView itemEditor, ContentItem item)
 {
     FieldSet fs = new FieldSet();
     string status = (item.ID != 0) ? "ID #" + item.ID : "(Unsaved)";
     fs.Title = (item.ID != 0) ? Zeus.Context.Current.ContentTypes[item.GetType()].ContentTypeAttribute.Title + " " + status : "New Item " + status;
     container.Controls.Add(fs);
     fs.ContentControls.Add(itemEditor);
 }
        private void _Count_Radio(System.Web.UI.ControlCollection objcol, string radname)
        {
            try
            {
                int iID;
                int iNO;

                foreach (object obj in objcol)
                {
                    System.Type itype = obj.GetType();
                    if (itype.Namespace == "Ext.Net" || itype.Namespace == "System.Web.UI.HtmlControls")
                    {
                        switch (itype.Name)
                        {
                        case "HtmlForm":
                            System.Web.UI.HtmlControls.HtmlForm htmlform = (System.Web.UI.HtmlControls.HtmlForm)obj;
                            _Count_Radio(htmlform.Controls, radname);
                            break;

                        case "Viewport":
                            Ext.Net.Viewport viewport = (Ext.Net.Viewport)obj;
                            _Count_Radio(viewport.Controls, radname);
                            break;

                        case "FormPanel":
                            Ext.Net.FormPanel formpanel = (Ext.Net.FormPanel)obj;
                            _Count_Radio(formpanel.Controls, radname);
                            break;

                        case "Panel":
                            Ext.Net.Panel panel = (Ext.Net.Panel)obj;
                            _Count_Radio(panel.Controls, radname);
                            break;

                        case "TabPanel":
                            Ext.Net.TabPanel tabpanel = (Ext.Net.TabPanel)obj;
                            _Count_Radio(tabpanel.Controls, radname);
                            break;

                        case "Container":
                            Ext.Net.Container container = (Ext.Net.Container)obj;
                            _Count_Radio(container.Controls, radname);
                            break;

                        case "FieldSet":
                            Ext.Net.FieldSet fieldset = (Ext.Net.FieldSet)obj;
                            _Count_Radio(fieldset.Controls, radname);
                            break;

                        case "ContentContainer":
                            Ext.Net.ContentContainer contentcontainer = (Ext.Net.ContentContainer)obj;
                            _Count_Radio(contentcontainer.Controls, radname);
                            break;

                        case "RadioGroup":
                            Ext.Net.RadioGroup radioGroup = (Ext.Net.RadioGroup)obj;
                            _Count_Radio(radioGroup.Controls, radname);
                            break;

                        case "Radio":
                            Ext.Net.Radio radio = (Ext.Net.Radio)obj;

                            string[] s = radio.ID.Split('_');
                            iID = Convert.ToInt16(s[1]);
                            iNO = Convert.ToInt16(s[2]);

                            if (iID > 1 && iID < 38)
                            {
                                if (radio.Value.Equals(true))
                                {
                                    iSCORE = iSCORE + iNO - 1;
                                }
                            }
                            break;

                        case "":

                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _ErrorMsgShow(ex.Message.ToString());
            }
        }
Ejemplo n.º 7
0
    /// <summary>
    /// Lấy fieldname và giá trị
    /// </summary>
    /// <param name="control"></param>
    /// <param name="value"></param>
    /// <returns></returns>
    private string GetFieldName(Ext.Net.Component control, ref object value)
    {
        switch (control.ToString())
        {
        case "Ext.Net.TextField":
            Ext.Net.TextField txtControl = (Ext.Net.TextField)control;
            value = txtControl.Text;
            if (!txtControl.ID.Contains("_"))
            {
                return("");
            }
            else
            {
                return(txtControl.ID.Substring(txtControl.ID.IndexOf("_") + 1));
            }

        case "Ext.Net.Hidden":
            Ext.Net.Hidden hdfControl = (Ext.Net.Hidden)control;
            value = hdfControl.Text;
            if (!hdfControl.ID.Contains("_"))
            {
                return("");
            }
            else
            {
                return(hdfControl.ID.Substring(hdfControl.ID.IndexOf("_") + 1));
            }

        case "Ext.Net.Checkbox":
            Ext.Net.Checkbox chk = (Ext.Net.Checkbox)control;
            value = chk.Checked == true ? 1 : 0;
            if (!chk.ID.Contains("_"))
            {
                return("");
            }
            else
            {
                return(chk.ID.Substring(chk.ID.IndexOf("_") + 1));
            }

        case "Ext.Net.DateField":
            Ext.Net.DateField dfDate = (Ext.Net.DateField)control;
            if (!SoftCore.Util.GetInstance().IsDateNull(dfDate.SelectedDate))
            {
                value = dfDate.SelectedDate.Month + "/" + dfDate.SelectedDate.Day + "/" + dfDate.SelectedDate.Year;
            }
            else
            {
                value = "";
            }
            if (!dfDate.ID.Contains("_"))
            {
                return("");
            }
            else
            {
                return(dfDate.ID.Substring(dfDate.ID.IndexOf("_") + 1));
            }

        case "Ext.Net.NumberField":
            Ext.Net.NumberField nbf = (Ext.Net.NumberField)control;
            value = nbf.Text;
            if (!nbf.ID.Contains("_"))
            {
                return("");
            }
            else
            {
                return(nbf.ID.Substring(nbf.ID.IndexOf("_") + 1));
            }

        case "Ext.Net.ComboBox":
            Ext.Net.ComboBox cbBox = (Ext.Net.ComboBox)control;
            value = cbBox.SelectedItem.Value;
            if (!cbBox.ID.Contains("_"))
            {
                return("");
            }
            else
            {
                return(cbBox.ID.Substring(cbBox.ID.IndexOf("_") + 1));
            }

        case "Ext.Net.SpinnerField":
            Ext.Net.SpinnerField spinnerField = (Ext.Net.SpinnerField)control;
            value = spinnerField.Text;
            if (!spinnerField.ID.Contains("_"))
            {
                return("");
            }
            else
            {
                return(spinnerField.ID.Substring(spinnerField.ID.IndexOf("_") + 1));
            }

        case "Ext.Net.TextArea":
            Ext.Net.TextArea txtArea = (Ext.Net.TextArea)control;
            value = txtArea.Text;
            if (!txtArea.ID.Contains("_"))
            {
                return("");
            }
            else
            {
                return(txtArea.ID.Substring(txtArea.ID.IndexOf("_") + 1));
            }

        case "Ext.Net.Container":
            Ext.Net.Container cContainer = (Ext.Net.Container)control;
            GetChildControl(cContainer);
            break;

        case "Ext.Net.FieldSet":
            Ext.Net.FieldSet fieldSet = (Ext.Net.FieldSet)control;
            GetChildControl(fieldSet);
            break;

        case "Ext.Net.HtmlEditor":
            Ext.Net.HtmlEditor htmlEditor = (Ext.Net.HtmlEditor)control;
            value = htmlEditor.Text;
            if (!htmlEditor.ID.Contains("_"))
            {
                return("");
            }
            else
            {
                return(htmlEditor.ID.Substring(htmlEditor.ID.IndexOf("_") + 1));
            }
        }
        return("");
    }
Ejemplo n.º 8
0
 /// <summary>
 ///
 /// </summary>
 public FieldSet.Builder FieldSet(FieldSet component)
 {
     return(new FieldSet.Builder(component));
 }
 /// <summary>
 /// metodo que carrega as pesquisas existentes
 /// </summary>
 private void CarregarPesquisas()
 {
     foreach (PesquisaOpiniaoVO p in Pesquisas)
     {
         FieldSet fds = new FieldSet() { AutoWidth = true, AutoHeight = true, Title = p.Pergunta, TitleCollapse = true, Collapsible = true, Collapsed = false, AnimCollapse = true };
         Hidden hdf = new Hidden() { ID = "hdf_" + p.Id, Value = p.Id.ToString() };
         Ext.Net.RadioGroup group = new RadioGroup() { AutoWidth=true, ColumnsNumber = 1, GroupName = "group_" + p.Id, ID="group_"+p.Id, InvalidText="Selecione uma resposta.", AllowBlank = !(p.Status == StatusPesquisa.Iniciada), MsgTarget = MessageTarget.Side };
         foreach (RespostaVO r in p.Respostas)
         {
             Radio radio = new Radio() { BoxLabel = r.Descricao, HideLabel = true, AutoWidth = true, MinWidth = 150, ID = "radio_"+r.Id, Checked = r.Usuarios.Any(x=> x.Id == UsuarioLogado.Id) };
             group.Items.Add(radio);
         }
         fds.Items.Add(hdf);
         fds.Items.Add(group);
         if (p.Status == StatusPesquisa.Finalizada && p.MostrarResultado)
         {
             Ext.Net.Button btnGrafico = new Ext.Net.Button("Resultado");
             //btnGrafico.DirectEvents.Click.EventMask = new EventMask() { Msg = "Abrindo gráfico...", ShowMask = true, Target = MaskTarget.Page };
             btnGrafico.ID = "btnGrafico" + p.Id;
             btnGrafico.Listeners.Click.Handler = "Ext.net.DirectMethods.VisualizarGrafico('" + p.Id + "');";
             btnGrafico.Icon = Ext.Net.Icon.ChartBar;
             btnGrafico.Disabled = !hdfVisualizarGraficoResponderPesquisas.Value.ToInt32().ToBoolean();
             Toolbar toolbar = new Toolbar();
             toolbar.Add(btnGrafico);
             fds.TopBar.Add(toolbar);
         }
         group.Disabled = !(p.Status == StatusPesquisa.Iniciada);
         fds.AddTo(frmPesquisas);
     }
 }