Ejemplo n.º 1
0
        //public void ProcessFields2(DataRow dr, int col)
        public void ProcessFields2(int FieldID, int FieldLabelID, string FieldLabel, string FieldType, int PredecessorFieldID, int ParentFieldID,
                                   string StringValue, string FileValue, string OtherRef, string SelectedItemsIDs)
        {
            try
            {
                Field f = null;

                switch (FieldType)
                {
                case "tb":
                    f = new LabelTextBoxField(PanelIDString, FieldID, FieldLabel, StringValue);
                    break;

                case "rb":
                    f = new LabelRadioButtonFields(PanelIDString, FieldID.ToString(), FieldLabel);
                    ((LabelRadioButtonFields)f).RadioButtons.SetSelectedItems(SelectedItemsIDs);
                    break;

                case "cb":
                    f = new LabelCheckBoxFields(PanelIDString, FieldID.ToString(), FieldLabel);
                    ((LabelCheckBoxFields)f).CheckBoxes.SetSelectedItems(SelectedItemsIDs);
                    break;

                case "ddlb":
                    f = new LabelDropDownListBox(PanelIDString, FieldID.ToString(), FieldLabel);
                    ((LabelDropDownListBox)f).DropDown.SetSelectedItems(SelectedItemsIDs);
                    break;

                case "rb-item":
                case "cb-item":
                case "ddlb-item":
                    TempMultiSelectItem tmsi = new TempMultiSelectItem();
                    tmsi.StringValue = FieldLabel;
                    //tmsi.OtherRef = DBUtil.GetInt(dr, col + 8);
                    tmsi.ParentFieldID     = ParentFieldID.ToString();
                    tmsi.MultiSelectItemID = FieldID.ToString();

                    AllMultiSelectItem.Add(tmsi);
                    break;

                default:
                    break;
                }
                if (f != null)
                {
                    Fields.Add(f);
                }
            }
            catch (Exception e)
            {
                Console.Out.WriteLine(e.ToString());
            }
        }
Ejemplo n.º 2
0
        private TagBuilder ProcessNewLabelSuggestions(DataTable dt)
        {
            DataGridFieldAddMenuItem dgfAddItem = null;

            if (dt.Rows.Count > 1)
            {
                int NewSuggestedLabelID = DBUtil.GetInt(dt.Rows[0], 1);
                LabelTextBoxField lb    = new LabelTextBoxField(ID, "NewLabelID", "Suggested LabelID", NewSuggestedLabelID.ToString());

                //dgfAddItem = new DataGridFieldAddMenuItem(ID);
                dgfAddItem = new DataGridFieldAddMenuItem();
                DataGrid.Menu.AddMenu(dgfAddItem);

                dgfAddItem.AddRowDialog.AddField(lb);

                LabelCheckBoxFields lcb = new LabelCheckBoxFields(ID, "NameID", "Available languages");
                for (int r = 0; r < dt.Rows.Count; r++)
                {
                    string LangID = DBUtil.GetString(dt.Rows[r], 0);
                    lcb.CheckBoxes.AddItem(LangID, LangID, true);
                }

                if (lcb.CheckBoxes.Count > 0)
                {
                    dgfAddItem.AddRowDialog.AddField(lcb);
                }
                //DataGrid.AddRowDialog.AddField(lcb);
            }

            return(dgfAddItem.AddRowDialog.BuildDialogContent());
            //return null;

            //TagBuilder tb = new TagBuilder("div");
            //if (dt.Rows.Count > 1)
            //{
            //    int NewSuggestedLabelID = DBUtil.GetInt(dt.Rows[0], 1);
            //    LabelTextBoxField lb = new LabelTextBoxField(ID, "NewLabelID", "Suggested LabelID", NewSuggestedLabelID.ToString());
            //    tb.InnerHtml.AppendHtml(lb.BuildHtmlTag());

            //    LabelCheckBoxFields lcb = new LabelCheckBoxFields(ID, "NameID", "Available languages");
            //    for (int r = 0; r < dt.Rows.Count; r++)
            //    {
            //        string LangID = DBUtil.GetString(dt.Rows[r], 0);
            //        lcb.CheckBoxes.AddItem(LangID, LangID, true);
            //    }
            //    if (lcb.CheckBoxes.Count > 0)
            //        tb.InnerHtml.AppendHtml(lcb.BuildHtmlTag());
            //}
            //return tb;
        }
Ejemplo n.º 3
0
        public void ProcessFields(DataRow dr, int col)
        {
            try
            {
                Field f = null;

                int    FieldID            = DBUtil.GetInt(dr, col);
                string Label              = DBUtil.GetString(dr, col + 1);
                int    PredecessorFieldID = DBUtil.GetInt(dr, col + 2);
                string FieldType          = DBUtil.GetString(dr, col + 3);

                string StringValue = DBUtil.GetString(dr, col + 5);

                switch (FieldType)
                {
                case "tb":
                    f = new LabelTextBoxField(PanelIDString, FieldID, Label, StringValue);
                    break;

                case "rb":
                    //f = new LabelRBCBControl<LabelRadioButtonField>(FieldID.ToString(), Label);
                    //((LabelRBCBControl<LabelRadioButtonField>)f).OtherRef = DBUtil.GetInt(dr, col+8);
                    //((LabelRBCBControl<LabelRadioButtonField>)f).SelectedValues = StringValue.Split(',');

                    //f = new LabelRBCBControl<RadioButtonField>(FieldID.ToString(), Label);
                    //((LabelRBCBControl<RadioButtonField>)f).RBCBControl.items.OtherRef = DBUtil.GetInt(dr, col + 8);
                    //((LabelRBCBControl<RadioButtonField>)f).RBCBControl.items.SelectedValues = StringValue.Split(',');

                    f = new LabelRadioButtonFields(PanelIDString, FieldID.ToString(), Label);
                    ((LabelRadioButtonFields)f).RadioButtons.SetSelectedItems(DBUtil.GetString(dr, col + 8));

                    break;

                case "cb":
                    //f = new LabelRBCBControl<LabelCheckBoxField>(FieldID.ToString(), Label);
                    //((LabelRBCBControl<LabelCheckBoxField>)f).OtherRef = DBUtil.GetInt(dr, col + 8);
                    //((LabelRBCBControl<LabelCheckBoxField>)f).SelectedValues = StringValue.Split(',');

                    //f = new LabelRBCBControl<CheckBoxField>(FieldID.ToString(), Label);
                    //((LabelRBCBControl<CheckBoxField>)f).RBCBControl.items.OtherRef = DBUtil.GetInt(dr, col + 8);
                    //((LabelRBCBControl<CheckBoxField>)f).RBCBControl.items.SelectedValues = StringValue.Split(',');

                    f = new LabelCheckBoxFields(PanelIDString, FieldID.ToString(), Label);
                    ((LabelCheckBoxFields)f).CheckBoxes.SetSelectedItems(DBUtil.GetString(dr, col + 8));

                    break;

                case "ddlb":
                    //f = new LabelDropDownField(FieldID, Label);
                    //((LabelDropDownField)f).Dropdown.OtherRef = DBUtil.GetInt(dr, col + 8);
                    //((LabelDropDownField)f).Dropdown.SelectedValues = StringValue.Split(',');

                    f = new LabelDropDownListBox(PanelIDString, FieldID.ToString(), Label);
                    ((LabelDropDownListBox)f).DropDown.SetSelectedItems(DBUtil.GetString(dr, col + 8));
                    break;

                case "rb-item":
                case "cb-item":
                case "ddlb-item":
                    TempMultiSelectItem tmsi = new TempMultiSelectItem();
                    tmsi.StringValue = Label;
                    //tmsi.OtherRef = DBUtil.GetInt(dr, col + 8);
                    tmsi.ParentFieldID     = DBUtil.GetString(dr, col + 4);
                    tmsi.MultiSelectItemID = FieldID.ToString();

                    AllMultiSelectItem.Add(tmsi);
                    break;

                default:
                    break;
                }
                if (f != null)
                {
                    Fields.Add(f);
                }
            }
            catch (Exception e)
            {
                Console.Out.WriteLine(e.ToString());
            }
        }
Ejemplo n.º 4
0
        public void GetRandom()
        {
            Page.SideMenu.GetRandomMenu();

            int  id         = 1;
            long randonName = DateTime.Now.Ticks;

            List <Field> fields = new List <Field>();

            //TextBoxField tb = new TextBoxField((randonName++).ToString(), "Pocet projektu", "5");

            fields.Add(new LabelField("Normalni text"));
            fields.Add(new NewLine());
            fields.Add(new LabelField("Bold text", true));
            fields.Add(new NewLine());

            fields.Add(LabelTextBoxField.GetRandom(id++));
            fields.Add(LabelTextAreaField.GetRandom(id++));
            fields.Add(new NewLine());

            fields.Add(LabelRadioButtonFields.GetRandom((id++).ToString(), 3));
            fields.Add(LabelRadioButtonFields.GetRandom((id++).ToString(), 4));

            fields.Add(LabelDropDownListBox.GetRandom(id++.ToString(), 4));
            fields.Add(LabelDatePickerField.GetRandom(id++));

            fields.Add(LabelFileUploadField.GetRandom());
            fields.Add(LabelFileUploadField.GetRandom(true));

            fields.Add(LabelFileDownloadField.GetRandom());


            /*fields.Add(LabelCheckBoxesControl.GetRandom(2));
             * fields.Add(LabelRadioButtonsControl.GetRandom(2));*/


            //fields.Add(new Field { Label = "Pocet projektu", tagName = 1, Type = FieldType.Indicator, Value = "5" });
            //fields.Add(new Field { Label = "Pocet otevrenych projektu", tagName = 2, Type = FieldType.Indicator, Value = "5" });

            Panel panel = new Panel(1, "GetRandom", 1);

            //panel.Content = fields;
            fields = new List <Field>();
            fields.Add(LabelTextBoxField.GetRandom(id++));
            panel.GenerateRandomPanelMenuItems(5);
            panel.Fields = fields;
            //ToShow.Add(panel);

            Panel        panel2  = new Panel(2, "Grid", 1);
            List <Field> fields2 = new List <Field>();

            fields2.Add(LabelTextBoxField.GetRandom(id++));
            fields2.Add(LabelDataGridField.GetRandom("Grid"));

            panel2.Fields = fields2;
            panel2.GenerateRandomPanelMenuItems(2);


            //PanelList.Add(panel);
            //PanelList.Add(panel2);
        }