Exemple #1
0
 public object QueryPar(string parName)
 {
     return(OnRequestPar?.Invoke(parName));
 }
Exemple #2
0
        public object QueryPar(string parName)
        {
            //判断是否系统参数
            object parValue = OnRequestPar?.Invoke(parName);

            if (parValue == null && _layoutControls != null)
            {
                //判断是否本地控件录入参数
                foreach (ViewItem vi in _layoutControls)
                {
                    if (vi.InstanceName != parName)
                    {
                        continue;
                    }

                    string value = "";

                    switch (vi.ControlType)
                    {
                    case ViewControlType.Lab:
                        value = (vi.ReleationInstance as Label).Text;

                        if (string.IsNullOrEmpty(value))
                        {
                            return("");
                        }
                        else
                        {
                            return((value + "-").Split('-')[0]);
                        }

                    case ViewControlType.Txt:
                        value = (vi.ReleationInstance as TextBox).Text;

                        if (string.IsNullOrEmpty(value))
                        {
                            return("");
                        }
                        else
                        {
                            return((value + "-").Split('-')[0]);
                        }

                    case ViewControlType.Cbx:
                        value = "";

                        object curValue = (vi.ReleationInstance as ComboBox).SelectedValue;
                        if (curValue != null && curValue is string)
                        {
                            value = curValue.ToString();
                        }

                        if (string.IsNullOrEmpty(value))
                        {
                            value = (vi.ReleationInstance as ComboBox).Text;
                        }


                        if (string.IsNullOrEmpty(value))
                        {
                            return("");
                        }
                        else
                        {
                            return((value + "-").Split('-')[0]);
                        }

                    case ViewControlType.Dtp:
                        return((vi.ReleationInstance as DateTimePicker).Value);

                    case ViewControlType.Checkbox:
                        return((vi.ReleationInstance as CheckBox).Checked);

                    default:
                        return(null);
                    }
                }
            }

            return(parValue);
        }