Esempio n. 1
0
        void CreateCheckBoxControl(XmlNode node, Control container)
        {
            string engName      = node.Attributes["Name"] != null ? node.Attributes["Name"].Value : "";
            string chsName      = node.Attributes["CHName"] != null ? node.Attributes["CHName"].Value : "";
            string dataType     = node.Attributes["DataType"] != null ? node.Attributes["DataType"].Value : "";
            bool   isMuti       = node.Attributes["IsMuti"] != null ? node.Attributes["IsMuti"].Value.ToBooleanHasNull() : false;
            string idConName    = node.Attributes["IDConName"] != null ? node.Attributes["IDConName"].Value : "";
            int    w            = node.Attributes["Width"] != null ? node.Attributes["Width"].Value.ToInt32() : 60;
            int    h            = node.Attributes["Height"] != null ? node.Attributes["Height"].Value.ToInt32() : 110;
            string defaultValue = node.Attributes["DefaultValue"] != null ? node.Attributes["DefaultValue"].Value : "";
            string codeValue    = node.Attributes["CodeValue"] != null ? node.Attributes["CodeValue"].Value : "";
            string text         = node.Attributes["Text"] != null ? node.Attributes["Text"].Value : "";

            #region 标题
            ControlInfo conInfo = new ControlInfo(_form);
            if (chsName != "")
            {
                UcLabelX label = new UcLabelX();
                label.Name           = "lbl" + engName;
                label.Text           = chsName;
                label.AutoSize       = true;
                conInfo.LabelControl = label;
            }
            #endregion
            #region 创建控件
            UcCheckBox chk = new UcCheckBox();
            chk.Name             = engName;
            chk.Width            = w;
            chk.Height           = 22;
            chk.Text             = text;
            chk.AutoSize         = false;
            chk.CheckBoxStyle    = DevComponents.DotNetBar.eCheckBoxStyle.CheckBox;
            chk.Style            = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
            chk.Visible          = true;
            chk.TextVisible      = true;
            conInfo.InputControl = chk;
            conInfo.KeyName      = container.Name;
            if (!_dicControl.ContainsKey(engName))
            {
                _dicControl.Add(engName, conInfo);
            }
            #endregion
            #region 属性行为控制
            defaultValue = GetDefaultValue(defaultValue);
            if (defaultValue != null)
            {
                chk.Checked = defaultValue.ToLower() == "true" ? true : false;
            }
            #endregion
        }
Esempio n. 2
0
        void CreateTextBox(XmlNode node, Control container)
        {
            string      engName      = node.Attributes["Name"] != null ? node.Attributes["Name"].Value : "";
            string      chsName      = node.Attributes["CHName"] != null ? node.Attributes["CHName"].Value : "";
            string      dataType     = node.Attributes["DataType"] != null ? node.Attributes["DataType"].Value : "";
            bool        isMuti       = node.Attributes["IsMuti"] != null ? node.Attributes["IsMuti"].Value.ToBooleanHasNull() : false;
            string      idConName    = node.Attributes["IDConName"] != null ? node.Attributes["IDConName"].Value : "";
            int         w            = node.Attributes["Width"] != null ? node.Attributes["Width"].Value.ToInt32() : 80;
            int         h            = node.Attributes["Height"] != null ? node.Attributes["Height"].Value.ToInt32() : 28;
            string      defaultValue = node.Attributes["DefaultValue"] != null ? node.Attributes["DefaultValue"].Value : "";
            ControlInfo conInfo      = new ControlInfo(_form);

            #region 标题
            if (chsName != "")
            {
                UcLabelX label = new UcLabelX();
                label.Name           = "lbl" + engName;
                label.Text           = chsName;
                label.AutoSize       = true;
                conInfo.LabelControl = label;
            }
            #endregion
            #region 隐藏的控件
            UcTextBox txtHid = new UcTextBox();
            txtHid.Name             = idConName;
            txtHid.Visible          = false;
            conInfo.HidInputControl = txtHid;
            #endregion
            #region 创建文本控件
            UcTextBox txt = new UcTextBox();
            txt.Name             = engName;
            txt.Width            = w;
            txt.Border.Class     = "TextBoxBorder";
            conInfo.InputControl = txt;
            conInfo.KeyName      = container.Name;
            if (!_dicControl.ContainsKey(engName))
            {
                _dicControl.Add(engName, conInfo);
            }
            #endregion

            #region 属性行为控制
            defaultValue = GetDefaultValue(defaultValue);
            if (defaultValue != null)
            {
                txt.Text = defaultValue;
            }
            SetTextDataType(dataType, isMuti, idConName, txt);
            #endregion
        }
Esempio n. 3
0
        void CreateDateControl(XmlNode node, Control container)
        {
            string engName      = node.Attributes["Name"] != null ? node.Attributes["Name"].Value : "";
            string chsName      = node.Attributes["CHName"] != null ? node.Attributes["CHName"].Value : "";
            string dataType     = node.Attributes["DataType"] != null ? node.Attributes["DataType"].Value : "";
            bool   isMuti       = node.Attributes["IsMuti"] != null ? node.Attributes["IsMuti"].Value.ToBooleanHasNull() : false;
            string idConName    = node.Attributes["IDConName"] != null ? node.Attributes["IDConName"].Value : "";
            int    w            = node.Attributes["Width"] != null ? node.Attributes["Width"].Value.ToInt32() : 110;
            int    h            = node.Attributes["Height"] != null ? node.Attributes["Height"].Value.ToInt32() : 110;
            string defaultValue = node.Attributes["DefaultValue"] != null ? node.Attributes["DefaultValue"].Value : "";
            string codeValue    = node.Attributes["CodeValue"] != null ? node.Attributes["CodeValue"].Value : "";

            #region 标题
            ControlInfo conInfo = new ControlInfo(_form);
            if (chsName != "")
            {
                UcLabelX label = new UcLabelX();
                label.Name           = "lbl" + engName;
                label.Text           = chsName;
                label.AutoSize       = true;
                conInfo.LabelControl = label;
            }
            #endregion
            #region 创建文本控件
            UcDateTimeInput dta = new UcDateTimeInput();
            dta.Name                   = engName;
            dta.Width                  = w;
            dta.CustomFormat           = "yyyy-MM-dd";
            dta.Format                 = DevComponents.Editors.eDateTimePickerFormat.Custom;
            dta.ButtonDropDown.Visible = true;
            dta.ButtonClear.Visible    = true;
            conInfo.InputControl       = dta;
            conInfo.KeyName            = container.Name;
            if (!_dicControl.ContainsKey(engName))
            {
                _dicControl.Add(engName, conInfo);
            }
            #endregion
            #region 属性行为控制
            defaultValue = GetDefaultValue(defaultValue);
            if (defaultValue != null)
            {
                dta.Text = defaultValue;
            }
            #endregion
        }
Esempio n. 4
0
        void CreateRadioBoxControl(XmlNode node, Control container)
        {
            string  engName      = node.Attributes["Name"] != null ? node.Attributes["Name"].Value : "";
            string  chsName      = node.Attributes["CHName"] != null ? node.Attributes["CHName"].Value : "";
            string  dataType     = node.Attributes["DataType"] != null ? node.Attributes["DataType"].Value : "";
            bool    isMuti       = node.Attributes["IsMuti"] != null ? node.Attributes["IsMuti"].Value.ToBooleanHasNull() : false;
            string  idConName    = node.Attributes["IDConName"] != null ? node.Attributes["IDConName"].Value : "";
            int     w            = node.Attributes["Width"] != null ? node.Attributes["Width"].Value.ToInt32() : 60;
            int     h            = node.Attributes["Height"] != null ? node.Attributes["Height"].Value.ToInt32() : 20;
            string  defaultValue = node.Attributes["DefaultValue"] != null ? node.Attributes["DefaultValue"].Value : "";
            string  codeValue    = node.Attributes["CodeValue"] != null ? node.Attributes["CodeValue"].Value : "";
            string  text         = node.Attributes["Text"] != null ? node.Attributes["Text"].Value : "";
            string  groupName    = node.Attributes["GroupName"] != null ? node.Attributes["GroupName"].Value : "";
            int     slcIdx       = node.Attributes["SelectIndex"] != null ? node.Attributes["SelectIndex"].Value.ToInt32() : 0;
            Control panel;

            if (_dicRadioGroup.ContainsKey(groupName))
            {
                panel = _dicRadioGroup[groupName];
            }
            else
            {
                panel = new UcPanel(); panel.Width = 1;
            }
            #region 标题
            ControlInfo conInfo = new ControlInfo(_form);
            if (chsName != "")
            {
                UcLabelX label = new UcLabelX();
                label.Name           = "lbl" + engName;
                label.Text           = chsName;
                label.AutoSize       = true;
                conInfo.LabelControl = label;
            }
            #endregion
            #region 创建控件
            string[]   arrText = text.ToStringHasNull().Split(';');
            string[]   arrTextEx;
            UcRadioBox chk; int idx = 0;
            foreach (string s in arrText)
            {
                arrTextEx = s.Split(',');
                chk       = new UcRadioBox();
                chk.Name  = engName;
                chk.Width = w;
                chk.Text  = arrTextEx.Length > 1 ? arrTextEx[1] : "";
                chk.Tag   = arrTextEx.Length > 0 ? arrTextEx[0] : "";
                chk.Dock  = DockStyle.Left;
                if (slcIdx == idx)
                {
                    chk.Checked = true;
                }
                panel.Width += chk.Width;
                panel.Height = 22;
                panel.Controls.Add(chk);
                idx++;
            }
            conInfo.InputControl = panel;
            conInfo.KeyName      = container.Name;
            if (!_dicControl.ContainsKey(engName))
            {
                _dicControl.Add(engName, conInfo);
            }
            #endregion
        }
Esempio n. 5
0
        void CreateDropDownList(XmlNode node, Control container)
        {
            string engName      = node.Attributes["Name"] != null ? node.Attributes["Name"].Value : "";
            string chsName      = node.Attributes["CHName"] != null ? node.Attributes["CHName"].Value : "";
            string dataType     = node.Attributes["DataType"] != null ? node.Attributes["DataType"].Value : "";
            bool   isMuti       = node.Attributes["IsMuti"] != null ? node.Attributes["IsMuti"].Value.ToBooleanHasNull() : false;
            string idConName    = node.Attributes["IDConName"] != null ? node.Attributes["IDConName"].Value : "";
            int    w            = node.Attributes["Width"] != null ? node.Attributes["Width"].Value.ToInt32() : 80;
            int    h            = node.Attributes["Height"] != null ? node.Attributes["Height"].Value.ToInt32() : 28;
            string defaultValue = node.Attributes["DefaultValue"] != null ? node.Attributes["DefaultValue"].Value : "";
            string codeValue    = node.Attributes["CodeValue"] != null ? node.Attributes["CodeValue"].Value : "";
            //ListValue  For ComboBox
            string ListValue = node.Attributes["ListValue"] != null ? node.Attributes["ListValue"].Value : "";

            #region 标题
            ControlInfo conInfo = new ControlInfo(_form);
            if (chsName != "")
            {
                UcLabelX label = new UcLabelX();
                label.Name           = "lbl" + engName;
                label.Text           = chsName;
                label.AutoSize       = true;
                conInfo.LabelControl = label;
            }
            #endregion
            #region 创建文本控件
            UcComboBox cmb = new UcComboBox();
            cmb.Name             = engName;
            cmb.Width            = w;
            cmb.Style            = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
            cmb.DrawMode         = DrawMode.OwnerDrawFixed;
            conInfo.InputControl = cmb;
            conInfo.KeyName      = container.Name;
            if (!_dicControl.ContainsKey(engName))
            {
                _dicControl.Add(engName, conInfo);
            }

            #endregion
            #region 属性行为控制
            if (!string.IsNullOrEmpty(ListValue))//绑定用户枚举列表
            {
                List <SYS_DictItemLineResult> lstSR = new List <SYS_DictItemLineResult>();
                string[] arr1 = new string[] { };
                string[] arr2 = new string[] { };
                arr1 = ListValue.Split(';');
                foreach (string s in arr1)
                {
                    arr2 = s.Split(',');
                    if (arr2.Length < 1)
                    {
                        continue;
                    }
                    lstSR.Add(new SYS_DictItemLineResult()
                    {
                        ItemValue = arr2[0], ItemValue2 = arr2[1]
                    });
                }
                cmb.DisplayMember = "ItemValue2";
                cmb.ValueMember   = "ItemValue";
                cmb.DataSource    = lstSR;
                cmb.SelectedIndex = -1;
            }
            else if (string.IsNullOrEmpty(codeValue))//绑定字典表数据
            {
                _dictLineLogic.BindComboBox(cmb, codeValue, _dictItemList);
            }
            defaultValue = GetDefaultValue(defaultValue);
            if (defaultValue != null)
            {
                if (string.IsNullOrEmpty(codeValue))
                {
                    SYS_DictItemLineLogic.SetCombolSelectedIndex(cmb, defaultValue, true);
                }
                else
                {
                    cmb.SelectedValue = defaultValue;
                }
            }
            #endregion
        }