Beispiel #1
0
        private static GlobalMenuItem ProcessMenu(DataTable dt)
        {
            NavFromDB nav = new NavFromDB();

            for (int r = 0; r < dt.Rows.Count; r++)
            {
                NavItemFromDB ni = new NavItemFromDB();
                ni.NavID = DBUtil.GetInt(dt.Rows[r], 0);
                ni.Label = DBUtil.GetString(dt.Rows[r], 1);
                ni.Icon  = Encoding.UTF8.GetBytes(DBUtil.GetString(dt.Rows[r], 2));
                ni.SetChildrenNavIDs(DBUtil.GetString(dt.Rows[r], 3));
                ni.Type    = DBUtil.GetString(dt.Rows[r], 4);
                ni.Url     = DBUtil.GetString(dt.Rows[r], 5);
                ni.LabelID = DBUtil.GetInt(dt.Rows[r], 6);

                nav.navs.Add(ni);
            }

            GlobalMenuItem root = new GlobalMenuItem(0, "", -1, 0, "");

            root.Populate(nav, nav.GetRootChildren("gm-root"));
            return(root);
        }
Beispiel #2
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());
            }
        }