示例#1
0
        private void rtbDataSource_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (_isLoadingDetail)
                {
                    return;
                }
                if (dataGridView1.SelectedRows.Count <= 0)
                {
                    return;
                }

                string name = dataGridView1.SelectedRows[0].Cells["Name"].Value.ToString();

                InputItem iiDetail = funcControl1.Inputs[name];

                if (iiDetail == null)
                {
                    return;
                }

                iiDetail.DataFrom = rtbDataSource.Text;
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
示例#2
0
        private void chkIsStorage_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                if (_isLoadingDetail)
                {
                    return;
                }
                if (dataGridView1.SelectedRows.Count <= 0)
                {
                    return;
                }

                string name = dataGridView1.SelectedRows[0].Cells["Name"].Value.ToString();

                InputItem iiDetail = funcControl1.Inputs[name];

                if (iiDetail == null)
                {
                    return;
                }

                iiDetail.AllowStorage = chkIsStorage.Checked;
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
示例#3
0
        private void LoadInputDetail(string name)
        {
            try
            {
                _isLoadingDetail = true;

                txtDefaultValue.Text = "";
                rtbDataSource.Text   = "";
                chkIsStorage.Checked = true;

                InputItem iiDetail = funcControl1.Inputs[name];

                if (iiDetail == null)
                {
                    return;
                }

                txtDefaultValue.Text = iiDetail.DefaultValue;
                rtbDataSource.Text   = iiDetail.DataFrom;
                chkIsStorage.Checked = iiDetail.AllowStorage;
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
            finally
            {
                _isLoadingDetail = false;
            }
        }
示例#4
0
        private void tsbNewInput_Click(object sender, EventArgs e)
        {
            try
            {
                string controlType = (sender as ToolStripButton).Text;

                InputItem iiNew = new InputItem();
                iiNew.ControlType = FuncConstDefine.Txt;

                frmFuncInput ffi = new frmFuncInput();

                ffi.OnCheckNameExists -= CheckNameExists;
                ffi.OnCheckNameExists += CheckNameExists;

                iiNew = ffi.ShowInput(this, iiNew);

                if (iiNew == null)
                {
                    return;
                }

                funcControl1.Inputs.Add(iiNew.Name, iiNew);

                BindInputData();


                LocateRow(iiNew.Name);

                funcControl1.AddInputControl(iiNew, iiNew.Name);
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
示例#5
0
        public InputItem ShowInput(IWin32Window owner, InputItem ii)
        {
            _inputItem = ii;

            this.ShowDialog(owner);

            return(_inputItem);
        }
示例#6
0
 public void CopyFrom(InputItem liSource)
 {
     Name         = liSource.Name;
     ControlType  = liSource.ControlType;
     DefaultValue = liSource.DefaultValue;
     DataFrom     = liSource.DataFrom;
     AllowStorage = liSource.AllowStorage;
     LinkControl  = liSource.LinkControl;
 }
示例#7
0
 private void butCancel_Click(object sender, EventArgs e)
 {
     try
     {
         _isOk      = false;
         _inputItem = null;
         this.Close();
     }
     catch (Exception ex)
     {
         MsgBox.ShowException(ex, this);
     }
 }
示例#8
0
 private void frmFuncInput_FormClosed(object sender, FormClosedEventArgs e)
 {
     try
     {
         if (_isOk == false)
         {
             _inputItem = null;
         }
     }
     catch (Exception ex)
     {
         MsgBox.ShowException(ex, this);
     }
 }
示例#9
0
        private void tsbModify_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataGridView1.SelectedRows.Count <= 0)
                {
                    MessageBox.Show("请选择需要修改的项目。");
                    return;
                }

                string name = dataGridView1.SelectedRows[0].Cells["Name"].Value.ToString();

                InputItem iiUpdate = funcControl1.Inputs[name];

                if (iiUpdate == null)
                {
                    MessageBox.Show("未找到对应项目配置信息。");
                    return;
                }

                frmFuncInput ffi = new frmFuncInput();

                //ffi.OnCheckNameExists -= CheckNameExists;
                //ffi.OnCheckNameExists += CheckNameExists;

                iiUpdate = ffi.ShowInput(this, iiUpdate);

                if (iiUpdate == null)
                {
                    return;
                }

                //更新明细信息
                LoadInputDetail(iiUpdate.Name);
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
示例#10
0
        public Control AddInputControl(InputItem ii, string controlName)
        {
            LayoutControlItem lci = null;

            string ctlName = controlName;

            switch (ii.ControlType.ToUpper())
            {
            case FuncConstDefine.Cbx:
                ComboBox cbx = new ComboBox();
                cbx.Name = ctlName;

                //从数据源加载数据

                //设置默认值
                cbx.Text = ii.DefaultValue;

                lci      = lcDemo.Root.AddItem(ctlName, cbx);
                lci.Text = ii.Name;

                ii.LinkControl = cbx;

                return(cbx);

            case FuncConstDefine.Txt:
                TextBox tb = new TextBox();
                tb.Name = ctlName;
                tb.Text = ii.DefaultValue;    //设置默认值

                lci      = lcDemo.Root.AddItem(ctlName, tb);
                lci.Text = ii.Name;

                ii.LinkControl = tb;

                return(tb);

            case FuncConstDefine.RTxt:
                RichTextBox rtb = new RichTextBox();
                rtb.Name = ctlName;
                rtb.Text = ii.DefaultValue;    //设置默认值

                rtb.Height = 150;

                lci      = lcDemo.Root.AddItem(ctlName, rtb);
                lci.Text = ii.Name;

                lci.Height = rtb.Height;

                ii.LinkControl = rtb;

                return(rtb);

            case FuncConstDefine.Dtp:
                DateTimePicker dtp = new DateTimePicker();
                dtp.Name = ctlName;

                try
                {
                    if (string.IsNullOrEmpty(ii.DefaultValue) == false)
                    {
                        //设置默认值
                        dtp.Value = Convert.ToDateTime(ii.DefaultValue);
                    }
                }
                catch
                { }

                lci      = lcDemo.Root.AddItem(ctlName, dtp);
                lci.Text = ii.Name;

                ii.LinkControl = dtp;

                return(dtp);

            default:
                return(null);
            }
        }