Ejemplo n.º 1
0
        //protected internal override void UcDatePicker_Validating(object sender, CancelEventArgs e)
        //{
        //    string colName = "";
        //    string currentValue;
        //    string ctlValue;
        //    UcDatePicker control = sender as UcDatePicker;
        //    try
        //    {
        //        if (IsInSaveCancle == true || IsInCRUDIni == true)
        //            return;
        //        if (IsInFormLoading == true)
        //            return;

        //        colName = control.Tag.ToString();

        //        IsItemchkValid = true;
        //        currentValue = DRMASTER[colName] == null ? "" : DRMASTER[colName].ToString();
        //        ctlValue = control.Value == null ? "" : control.Value.ToString();
        //        if (ctlValue != currentValue)
        //        {
        //            if (WfItemCheck(sender, colName, ctlValue, DRMASTER) == false)
        //            {
        //                e.Cancel = true;
        //                IsItemchkValid = false;
        //                control.Value = OldValue;
        //            }
        //            else
        //            {
        //                IsChanged = true;
        //                DRMASTER.EndEdit();
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        e.Cancel = true;
        //        control.Value = OldValue;
        //        IsItemchkValid = false;
        //        WfShowMsg(ex.ToString());
        //    }
        //}
        #endregion

        #region UltraDateTimeEditor_Validating 時間控制項
        protected internal override void UltraDateTimeEditor_Validating(object sender, CancelEventArgs e)
        {
            string colName = "";
            //DateTime? dbValue = null;
            UltraDateTimeEditor control = sender as UltraDateTimeEditor;

            try
            {
                if (IsInSaveCancle == true || IsInCRUDIni == true)
                {
                    return;
                }
                if (IsInFormLoading == true)
                {
                    return;
                }

                //if (FormEditMode == YREditType.查詢 || FormEditMode == YREditType.NA)
                //    return;

                WfCleanBottomMsg();
                IsInItemchecking = true;
                IsItemchkValid   = true;
                colName          = control.Tag.ToString();

                if (GlobalFn.isNullRet(control.Value, "") != GlobalFn.isNullRet(OldValue, ""))
                {
                    //WfSetBllTransaction();

                    var itemCheckInfo = new ItemCheckInfo();
                    itemCheckInfo.Row    = DrMaster;
                    itemCheckInfo.Value  = control.Value;
                    itemCheckInfo.Column = colName;
                    if (WfItemCheck(sender, itemCheckInfo) == false)
                    {
                        e.Cancel       = true;
                        IsItemchkValid = false;
                        control.Value  = OldValue;
                    }
                    else
                    {
                        IsChanged = true;
                        DrMaster.EndEdit();
                    }
                }
            }
            catch (Exception ex)
            {
                e.Cancel       = true;
                IsItemchkValid = false;
                control.Value  = OldValue;
                WfShowErrorMsg(ex.ToString());
            }
            finally
            {
                //IsInButtonClick = false;
                IsInItemchecking = false;
            }
        }
        public static void ReadOnly_Control(Control ctr)
        {
            try
            {
                foreach (Control txt in ctr.Controls)
                {
                    ReadOnly_Control(txt);
                    switch (txt.GetType().Name)
                    {
                    case "UltraTextEditor":
                    {
                        UltraTextEditor Ultratxt = txt as UltraTextEditor;
                        Ultratxt.ReadOnly = true;
                        break;
                    }

                    case "TextBox":
                    {
                        TextBox textboxtxt = txt as TextBox;
                        textboxtxt.ReadOnly = true;
                        break;
                    }

                    case "UltraCombo":
                    {
                        UltraCombo textboxtxt = txt as UltraCombo;
                        textboxtxt.ReadOnly = true;
                        break;
                    }

                    case "UltraComboEditor":
                    {
                        UltraComboEditor textboxtxt = txt as UltraComboEditor;
                        textboxtxt.ReadOnly = true;
                        break;
                    }

                    case "UltraDateTimeEditor":
                    {
                        UltraDateTimeEditor textboxtxt = txt as UltraDateTimeEditor;
                        textboxtxt.ReadOnly = true;
                        break;
                    }

                    case "UltraNumericEditor":
                    {
                        UltraNumericEditor textboxtxt = txt as UltraNumericEditor;
                        textboxtxt.ReadOnly = true;
                        break;
                    }
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 3
0
        public DataRegistrazioneValidator GetDataRegistrazioneValidator(UltraDateTimeEditor dateTimeEditor)
        {
            var dataRegistrazioneValidator = new DataRegistrazioneValidator
            {
                ControlToValidate = dateTimeEditor,
                ControlToCompare = sceltaCondominioCombo1
            };

            return dataRegistrazioneValidator;
        }
Ejemplo n.º 4
0
        public void SetNullItemClickBase(object sender, DataRow currentRow)
        {
            Control sourceControl = ((ContextMenu)((MenuItem)sender).Parent).SourceControl;
            string  controlId     = "";

            if (sourceControl.Tag != null)
            {
                controlId = Conversions.ToString(sourceControl.Tag);
            }
            if (sourceControl is DeklaritComboBox)
            {
                DeklaritComboBox box = (DeklaritComboBox)sourceControl;
                if (box.ComboBox.Tag != null)
                {
                    controlId         = Conversions.ToString(box.ComboBox.Tag);
                    box.SelectedIndex = -1;
                }
            }
            if ((controlId.Length == 0) && (sourceControl.Parent != null))
            {
                sourceControl = sourceControl.Parent;
                controlId     = Conversions.ToString(sourceControl.Tag);
            }
            this.GetControl(controlId).Focus();
            if (sourceControl is TextBox)
            {
                TextBox box2 = (TextBox)sourceControl;
                box2.Text = "";
            }
            if (sourceControl is UltraDateTimeEditor)
            {
                UltraDateTimeEditor editor = (UltraDateTimeEditor)sourceControl;
                editor.Value = RuntimeHelpers.GetObjectValue(Convert.DBNull);
            }
            if (sourceControl is UltraTextEditor)
            {
                UltraTextEditor editor2 = (UltraTextEditor)sourceControl;
                editor2.Text = "";
            }
            if (sourceControl is UltraNumericEditor)
            {
                UltraNumericEditor editor3 = (UltraNumericEditor)sourceControl;
                editor3.Value = RuntimeHelpers.GetObjectValue(Convert.DBNull);
            }
            if (sourceControl is UltraMaskedEdit)
            {
                UltraMaskedEdit edit = (UltraMaskedEdit)sourceControl;
                edit.Text = "";
            }
            if (sourceControl is LinkUltraLabelPrompt)
            {
                LinkUltraLabelPrompt prompt = (LinkUltraLabelPrompt)sourceControl;
                prompt.UltraLabel.Text = "";
                prompt.UltraLabel.Focus();
                string descriptionTag = prompt.DescriptionTag;
                if ((descriptionTag != null) && (descriptionTag.Length != 0))
                {
                    currentRow[descriptionTag] = RuntimeHelpers.GetObjectValue(Convert.DBNull);
                }
            }
            currentRow[controlId] = RuntimeHelpers.GetObjectValue(Convert.DBNull);
            DataColumn column = currentRow.Table.Columns[controlId];

            if (((column != null) && (column.ExtendedProperties["TreatEmptyAsNull"] != null)) && (Convert.ToBoolean(column.ExtendedProperties["TreatEmptyAsNull"].ToString()) && !column.DataType.Equals(typeof(DateTime))))
            {
                currentRow[controlId] = RuntimeHelpers.GetObjectValue(FormHelperClass.EmptyValue(column.DataType));
            }
        }
Ejemplo n.º 5
0
 private DateTime pGetDateTimeFromControl(UltraDateTimeEditor data, UltraDateTimeEditor ora)
 {
     var dData = Convert.ToDateTime(data.Value).Date;
     var oOra = Convert.ToDateTime(ora.Value).TimeOfDay ;
     return dData.Add(oOra);
 }
Ejemplo n.º 6
0
 private void pSetDateTimeToControl(DateTime date, UltraDateTimeEditor data, UltraDateTimeEditor ora)
 {
     data.Value = date;
     ora.Value = date;
 }
Ejemplo n.º 7
0
        public Size GenerateTipsForm(Sys_PD_Module module, List<Sys_PD_Filed> filedList, Control ctr, Point p)
        {
            Sys_PD_RefModule refModule = new Sys_PD_RefModule();
            ctr.Tag = module;
            ctr.Text = module.SPM_Name;

            int iTabInex = 0;
            int xPosition = p.X;
            int yPosition = p.Y;
            int vXPosition = p.X;
            int step = 0;//控制一行已经输出多少列
            int fTI = module.SPM_TI;
            int fTX = module.SPM_TX;
            int fTY = module.SPM_TY;
            int fHeight = module.SPM_Height;
            int controlWidth = 0;
            int controlHeight = 0;

            Size lableSize = new Size(module.SPM_LX, module.SPM_LY);//标签的大小
            Size textSize = new Size(fTX, fTY);//文本框的大小
            Size areaSize = new Size((fTX * 2) + module.SPM_LX + module.SPM_LI, fTY * 3);//备注框大小
            foreach (Sys_PD_Filed field in filedList)
            {

                if (field.DCP_IsHidden == 1)
                {
                    UltraTextEditor _hiddenBox = new UltraTextEditor();
                    _hiddenBox.Location = new System.Drawing.Point(vXPosition, yPosition);
                    _hiddenBox.Name = module.SPM_TPrefix + field.DCP_ControlID;
                    _hiddenBox.Visible = false;
                    ctr.Controls.Add(_hiddenBox);
                    continue;
                }
                if (field.DCP_Style == "newline" ||
                    (field.DCP_ControlType == "textarea" &&
                    step > module.SPM_CNum - 2))
                {
                    step = 0;
                    vXPosition = xPosition;
                    yPosition += fHeight;
                }

                fTI = module.SPM_TI;
                fTX = module.SPM_TX;
                fTY = module.SPM_TY;
                fHeight = module.SPM_Height;
                textSize = new Size(fTX, fTY);//文本框的大小
                areaSize = new Size((fTX * 2) + module.SPM_LX + module.SPM_LI, fTY * 3);

                /////////如果字段有自定义的大小,则赋值到相关模块
                if (field.DCP_TI != 0 && field.DCP_TX != 0 && field.DCP_TY != 0 && field.DCP_Height != 0)
                {
                    textSize = new Size(field.DCP_TX, field.DCP_TY);
                    areaSize = new Size(field.DCP_TX, field.DCP_TY);
                    fTX = field.DCP_TX;
                    fTY = field.DCP_TY;
                    fTI = field.DCP_TI;
                    fHeight = field.DCP_Height;
                }

                Infragistics.Win.Misc.UltraLabel _lab = new Infragistics.Win.Misc.UltraLabel();
                _lab.Location = new Point(vXPosition, yPosition + 6);
                _lab.Name = module.SPM_LPrefix + field.DCP_ControlID.ToString();
                _lab.Size = lableSize;
                _lab.TabIndex = iTabInex++;
                _lab.Text = field.DCP_Label.ToString();
                ctr.Controls.Add(_lab);

                vXPosition += module.SPM_LI;

                #region 控件生成
                switch (field.DCP_ControlType)
                {
                    case "dec":
                        UltraNumericEditor _numBox = new UltraNumericEditor();
                        _numBox.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _numBox.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _numBox.Size = textSize;
                        _numBox.NumericType = NumericType.Double;
                        _numBox.TabIndex = iTabInex++;
                        _numBox.PromptChar = ' ';
                        _numBox.Nullable = true;
                        _numBox.NullText = "0";
                        if (field.DCP_IsReadonly == 1)
                        {
                            _numBox.ReadOnly = true;
                        }
                        ctr.Controls.Add(_numBox);
                        break;
                    case "int":
                        UltraNumericEditor _intBox = new UltraNumericEditor();
                        _intBox.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _intBox.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _intBox.Size = textSize;
                        _intBox.NumericType = NumericType.Integer;
                        _intBox.TabIndex = iTabInex++;
                        if (field.DCP_IsReadonly == 1)
                        {
                            _intBox.ReadOnly = true;
                        }
                        _intBox.PromptChar = ' ';
                        _intBox.Nullable = true;
                        _intBox.NullText = "";
                        ctr.Controls.Add(_intBox);
                        break;
                    case "text":
                        UltraTextEditor _textBox = new UltraTextEditor();
                        _textBox.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _textBox.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _textBox.Size = textSize;
                        _textBox.TabIndex = iTabInex++;
                        _textBox.Nullable = true;
                        if (field.DCP_IsReadonly == 1)
                        {
                            _textBox.ReadOnly = true;
                        }
                        ctr.Controls.Add(_textBox);
                        break;
                    case "textl":
                        UltraTextEditor _texBox = new UltraTextEditor();
                        _texBox.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _texBox.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _texBox.Size = new Size(textSize.Width * 2, textSize.Height);
                        _texBox.TabIndex = iTabInex++;
                        if (field.DCP_IsReadonly == 1)
                        {
                            _texBox.ReadOnly = true;
                        }
                        ctr.Controls.Add(_texBox);
                        step++;
                        vXPosition += (fTI + module.SPM_LI);
                        break;
                    case "textarea":

                        UltraTextEditor _mBox = new UltraTextEditor();
                        _mBox.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _mBox.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _mBox.Multiline = true;
                        _mBox.Size = areaSize;
                        _mBox.TabIndex = iTabInex++;
                        if (field.DCP_IsReadonly == 1)
                        {
                            _mBox.ReadOnly = true;
                        }
                        ctr.Controls.Add(_mBox);
                        break;
                    case "date":
                        UltraDateTimeEditor _dateCom = new UltraDateTimeEditor();
                        _dateCom.BackColor = System.Drawing.SystemColors.Window;
                        _dateCom.MaskInput = "yyyy-mm-dd";
                        _dateCom.SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.OnMouseEnter;
                        _dateCom.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _dateCom.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _dateCom.Size = textSize;
                        _dateCom.TabIndex = iTabInex++;
                        _dateCom.Value = DateTime.Now;
                        _dateCom.PromptChar = ' ';
                        _dateCom.Nullable = true;
                        _dateCom.NullText = DateTime.Now.ToString();
                        if (field.DCP_IsReadonly == 1)
                        {
                            _dateCom.ReadOnly = true;
                        }
                        ctr.Controls.Add(_dateCom);
                        break;
                    case "time":
                        UltraDateTimeEditor _timeCom = new UltraDateTimeEditor();
                        _timeCom.BackColor = System.Drawing.SystemColors.Window;
                        _timeCom.MaskInput = "yyyy-mm-dd hh:mm";
                        _timeCom.SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.OnMouseEnter;
                        _timeCom.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _timeCom.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _timeCom.Size = textSize;
                        _timeCom.TabIndex = iTabInex++;
                        _timeCom.Value = DateTime.Now;
                        _timeCom.PromptChar = ' ';
                        _timeCom.Nullable = true;
                        _timeCom.NullText = DateTime.Now.ToString();
                        if (field.DCP_IsReadonly == 1)
                        {
                            _timeCom.ReadOnly = true;
                        }
                        ctr.Controls.Add(_timeCom);
                        break;
                    case "dict":
                        UltraComboEditor _comEdit = new UltraComboEditor();
                        _comEdit.Location = new System.Drawing.Point(vXPosition, yPosition);
                        _comEdit.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        _comEdit.Size = textSize;
                        _comEdit.TabIndex = iTabInex++;
                        _comEdit.DropDownStyle = DropDownStyle.DropDownList;
                        _comEdit.Tag = field;
                        if (field.DCP_IsReadonly == 1)
                        {
                            _comEdit.ReadOnly = true;
                        }
                        _comEdit.ValueChanged += new EventHandler(_comEdit_ValueChanged);

                        ctr.Controls.Add(_comEdit);
                        //ExcuteWithReturnValue ddd = new ExcuteWithReturnValue(this.SetDictValue);

                        //ddd.BeginInvoke(_comEdit, field.DCP_Type, null, null);
                        SetDictValue(_comEdit, field.DCP_Type);
                        break;
                    case "ref":
                        #region UltraGrid 界面设置

                        UltraCombo uCom = new UltraCombo();
                        #endregion
                        uCom.Location = new System.Drawing.Point(vXPosition, yPosition);
                        uCom.Name = module.SPM_TPrefix + field.DCP_ControlID;
                        uCom.Size = textSize;
                        uCom.TabIndex = iTabInex++;
                        uCom.Tag = field;
                        //uCom.Text =
                        ctr.Controls.Add(uCom);
                        //if (uCom.Value == null)
                        //{
                        //    uCom.Value = "";
                        //}

                        string sql = string.Empty;
                        if (!string.IsNullOrEmpty(field.DCP_RefSQL))
                        {
                            refModule = instRef.GetListByWhere(string.Format(" and SPR_RefModule='{0}'", field.DCP_RefSQL)).FirstOrDefault();//获取参考
                            if (refModule != null)
                            {
                                sql = string.Format(refModule.SPR_RefSQL.Trim(), "", "");
                                DataTable refDate = new DataTable();
                                refDate = instField.GetRefData(sql);
                                uCom.DataSource = refDate.DefaultView;
                                uCom.DisplayMember = refModule.SPR_RefData;
                                uCom.ValueMember = refModule.SPR_RefValue;
                            }
                        }
                        if (!string.IsNullOrEmpty(field.DCP_PControl))
                        {
                            uCom.Enabled = false;
                        }

                        uCom.ValueChanged += new EventHandler(uCom_ValueChanged);
                        //uCom.BeforeDropDown += new System.ComponentModel.CancelEventHandler(uCom_BeforeDropDown);
                        uCom.TextChanged += new EventHandler(uCom_TextChanged);
                        //uCom.LostFocus += new EventHandler(uCom_LostFocus);
                        //uCom.InitializeLayout += new InitializeLayoutEventHandler(uCom_InitializeLayout);

                        if (field.DCP_IsReadonly == 1)
                        {
                            uCom.ReadOnly = true;
                        }
                        break;
                }
                #endregion

                if (field.DCP_ControlType == "textarea" && step + 2 < module.SPM_CNum - 2)
                {
                    vXPosition += fTI;//
                    step++;
                }
                else if (field.DCP_ControlType == "textarea" && step + 2 > module.SPM_CNum - 2)
                {
                    step = module.SPM_CNum - 1;

                    if (field.DCP_TI != 0 && field.DCP_TX != 0 && field.DCP_TY != 0 && field.DCP_Height != 0)
                    {
                        yPosition += fHeight;
                    }
                    else
                    {
                        yPosition += fHeight * 2 - 14; ;
                    }
                }

                vXPosition += fTI;
                if (controlWidth < vXPosition)
                {
                    controlWidth = vXPosition;
                }
                if (controlHeight < yPosition + module.SPM_Height)
                {
                    controlHeight = yPosition + module.SPM_Height;
                }
                if (step == module.SPM_CNum - 1)
                {
                    step = 0;
                    vXPosition = xPosition;
                    yPosition += module.SPM_Height;
                }
                else
                {
                    step++;
                }
            }
            ctr.Height = controlHeight;
            Size point = new Size(controlWidth + 20, controlHeight + 10);
            ctr.KeyUp += new KeyEventHandler(ctr_KeyUp);
            return point;
        }
Ejemplo n.º 8
0
        public static void SetValue(Control control, string textValue, Type columnType)
        {
            IEnumerator enumerator = null;

            if (control is TextBox)
            {
                TextBox box = (TextBox)control;
                box.Text = textValue;
            }
            if (control is Label)
            {
                Label label = (Label)control;
                label.Text = textValue;
            }
            if (control is UltraLabel)
            {
                UltraLabel label2 = (UltraLabel)control;
                label2.Text = textValue;
            }
            if (control is UltraDateTimeEditor)
            {
                UltraDateTimeEditor editor = (UltraDateTimeEditor)control;
                editor.Text = textValue;
            }
            if (control is UltraTextEditor)
            {
                UltraTextEditor editor2 = (UltraTextEditor)control;
                editor2.Text = textValue;
            }
            if (control is UltraNumericEditor)
            {
                UltraNumericEditor editor3 = (UltraNumericEditor)control;
                if (editor3.NumericType == NumericType.Double)
                {
                    editor3.Value = double.Parse(textValue, CultureInfo.CurrentCulture);
                }
                else
                {
                    editor3.Value = long.Parse(textValue, CultureInfo.CurrentCulture);
                }
            }
            if (control is UltraMaskedEdit)
            {
                UltraMaskedEdit edit = (UltraMaskedEdit)control;
                edit.Text = textValue;
            }
            if (control is UltraCheckEditor)
            {
                UltraCheckEditor editor4 = (UltraCheckEditor)control;
                if ((textValue == "true") || (textValue == "True"))
                {
                    editor4.Checked = true;
                }
                else
                {
                    editor4.Checked = false;
                }
            }
            if (control is CheckBox)
            {
                CheckBox box2 = (CheckBox)control;
                if ((textValue == "true") || (textValue == "True"))
                {
                    box2.Checked = true;
                }
                else
                {
                    box2.Checked = false;
                }
            }
            if (!(control is ComboBox))
            {
                goto Label_0252;
            }
            ComboBox box3        = (ComboBox)control;
            object   objectValue = RuntimeHelpers.GetObjectValue(box3.SelectedValue);

            if (box3.DisplayMember == box3.ValueMember)
            {
                box3.SelectedIndex = box3.FindStringExact(textValue);
                goto Label_0252;
            }
            string valueMember = box3.ValueMember;

            valueMember = valueMember.Substring(valueMember.IndexOf(".") + 1);
            try
            {
                enumerator = box3.Items.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    object      obj3 = RuntimeHelpers.GetObjectValue(enumerator.Current);
                    DataRowView view = (DataRowView)obj3;
                    if (view.Row[valueMember].ToString().Trim().Equals(textValue.Trim()))
                    {
                        box3.SelectedItem = RuntimeHelpers.GetObjectValue(obj3);
                        goto Label_023F;
                    }
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
Label_023F:
            box3.SelectedValue = RuntimeHelpers.GetObjectValue(ConvertStringToTyped(textValue, columnType));
Label_0252:
            if (typeof(DeklaritComboBox).IsAssignableFrom(control.GetType()))
            {
                DeklaritComboBox box4 = (DeklaritComboBox)control;
                object           obj4 = RuntimeHelpers.GetObjectValue(box4.Value);
                if (box4.DisplayMember == box4.ValueMember)
                {
                    box4.SelectedIndex = box4.FindStringExact(textValue);
                }
                else
                {
                    string str2 = box4.ValueMember;
                    str2 = str2.Substring(str2.IndexOf(".") + 1);
                    ValueListItemEnumerator enumerator2 = box4.Items.GetEnumerator();
                    while (enumerator2.MoveNext())
                    {
                        ValueListItem current    = enumerator2.Current;
                        DataRowView   listObject = (DataRowView)current.ListObject;
                        if (listObject.Row[str2].ToString().Trim().Equals(textValue.Trim()))
                        {
                            box4.SelectedItem = current;
                            break;
                        }
                    }
                    box4.Value = RuntimeHelpers.GetObjectValue(ConvertStringToTyped(textValue, columnType));
                }
            }
            if (typeof(UltraComboEditor).IsAssignableFrom(control.GetType()))
            {
                UltraComboEditor editor5 = (UltraComboEditor)control;
                object           obj5    = RuntimeHelpers.GetObjectValue(editor5.Value);
                if (editor5.DisplayMember == editor5.ValueMember)
                {
                    editor5.SelectedIndex = editor5.FindStringExact(textValue);
                }
                else
                {
                    string str3 = editor5.ValueMember;
                    str3 = str3.Substring(str3.IndexOf(".") + 1);
                    ValueListItemEnumerator enumerator3 = editor5.Items.GetEnumerator();
                    while (enumerator3.MoveNext())
                    {
                        ValueListItem item2 = enumerator3.Current;
                        DataRowView   view3 = (DataRowView)item2.ListObject;
                        if (view3.Row[str3].ToString().Trim().Equals(textValue.Trim()))
                        {
                            editor5.SelectedItem = item2;
                            break;
                        }
                    }
                    editor5.Value = RuntimeHelpers.GetObjectValue(ConvertStringToTyped(textValue, columnType));
                }
            }
        }
Ejemplo n.º 9
0
 public static void SetReadOnly(Control control, bool readOnlyValue)
 {
     if (control is TextBox)
     {
         TextBox box = (TextBox)control;
         box.ReadOnly = readOnlyValue;
     }
     if (control is Label)
     {
         Label label = (Label)control;
         label.Enabled = !readOnlyValue;
     }
     if (control is UltraDateTimeEditor)
     {
         UltraDateTimeEditor editor = (UltraDateTimeEditor)control;
         editor.Enabled = !readOnlyValue;
     }
     if (control is UltraTextEditor)
     {
         UltraTextEditor editor2 = (UltraTextEditor)control;
         editor2.Enabled = !readOnlyValue;
     }
     if (control is UltraNumericEditor)
     {
         UltraNumericEditor editor3 = (UltraNumericEditor)control;
         editor3.Enabled = !readOnlyValue;
     }
     if (control is UltraMaskedEdit)
     {
         UltraMaskedEdit edit = (UltraMaskedEdit)control;
         edit.Enabled = !readOnlyValue;
     }
     if (control is UltraCheckEditor)
     {
         UltraCheckEditor editor4 = (UltraCheckEditor)control;
         editor4.Enabled = !readOnlyValue;
     }
     if (control is CheckBox)
     {
         CheckBox box2 = (CheckBox)control;
         box2.Enabled = !readOnlyValue;
     }
     if (control is ComboBox)
     {
         ComboBox box3 = (ComboBox)control;
         box3.Enabled = !readOnlyValue;
     }
     if (control is Button)
     {
         Button button = (Button)control;
         button.Enabled = !readOnlyValue;
     }
     if (control is LinkUltraLabelPrompt)
     {
         LinkUltraLabelPrompt prompt = (LinkUltraLabelPrompt)control;
         prompt.Enabled = !readOnlyValue;
     }
     if (typeof(DeklaritComboBox).IsAssignableFrom(control.GetType()))
     {
         DeklaritComboBox box4 = (DeklaritComboBox)control;
         box4.Enabled = !readOnlyValue;
     }
     if (typeof(UltraComboEditor).IsAssignableFrom(control.GetType()))
     {
         UltraComboEditor editor5 = (UltraComboEditor)control;
         editor5.Enabled = !readOnlyValue;
     }
 }