예제 #1
0
        private void btnAddVar_Click(object sender, EventArgs e)
        {
            var tmpFrmTaskVar = new FrmTaskVar(WorkConst.STATE_ADD)
            {
                TaskVarId          = BusinessLogic.NewGuid(),
                VarDataBaseName    = "",
                VarDataTableName   = "",
                VarTableColumnName = ""
            };

            tmpFrmTaskVar.ShowDialog();
            var dlr = tmpFrmTaskVar.DialogResult;

            if (dlr == DialogResult.OK)
            {
                if (varExists(tmpFrmTaskVar.tbxVarName.Text))
                {
                    MessageBoxHelper.ShowWarningMsg("变量" + tmpFrmTaskVar.tbxVarName.Text + "已存在,不能填加!");
                    return;
                }

                var lvi1 = new ListViewItem(tmpFrmTaskVar.tbxVarName.Text, 0);
                lvi1.SubItems.Add(tmpFrmTaskVar.TaskVarId);
                lvi1.SubItems.Add(tmpFrmTaskVar.cbxVarType.SelectedItem.ToString());
                lvi1.SubItems.Add(tmpFrmTaskVar.cbxVarModule.SelectedItem.ToString());
                lvi1.SubItems.Add(tmpFrmTaskVar.VarDataBaseName);
                lvi1.SubItems.Add(tmpFrmTaskVar.cbxDataTable.Text);
                lvi1.SubItems.Add(tmpFrmTaskVar.cbxTableColumns.Text);
                lvi1.SubItems.Add(tmpFrmTaskVar.tbxIniValue.Text);
                lvi1.SubItems.Add(tmpFrmTaskVar.cbxAccessType.SelectedIndex.ToString());
                lvi1.SubItems.Add(tmpFrmTaskVar.comboBoxbx.Text);
                lvExVar.Items.Add(lvi1);
            }
        }
예제 #2
0
        private void btnModifyVar_Click(object sender, EventArgs e)
        {
            if (lvExVar.SelectedItems.Count > 0)
            {
                var lvi1     = lvExVar.SelectedItems[0];
                var isSysVar = SystemVarData.IsSystemVar(lvi1.Text);
                if (isSysVar)
                {
                    return;          //跳过系统变量
                }
                var tmpFrmTaskVar = new FrmTaskVar(WorkConst.STATE_MOD)
                {
                    tbxVarName         = { Text = lvi1.Text },
                    TaskVarId          = lvi1.SubItems[1].Text,
                    cbxVarType         = { Text = lvi1.SubItems[2].Text },
                    cbxVarModule       = { Text = lvi1.SubItems[3].Text },
                    VarDataBaseName    = lvi1.SubItems[4].Text,
                    VarDataTableName   = lvi1.SubItems[5].Text,
                    VarTableColumnName = lvi1.SubItems[6].Text,
                    tbxIniValue        = { Text = lvi1.SubItems[7].Text },
                    comboBoxbx         = { Text = lvi1.SubItems[9].Text },
                    SortField          = lvi1.SubItems[9].Text
                };

                var accessType = lvi1.SubItems[8].Text;
                if (accessType.Trim().Length == 0)
                {
                    tmpFrmTaskVar.cbxAccessType.SelectedIndex = 0;
                }
                else
                {
                    if (char.IsNumber(accessType[0]))
                    {
                        tmpFrmTaskVar.cbxAccessType.SelectedIndex = Convert.ToInt16(accessType);
                    }
                }
                tmpFrmTaskVar.ShowDialog();
                var dlr = tmpFrmTaskVar.DialogResult;
                if (dlr == DialogResult.OK)
                {
                    if (lvi1.Text != tmpFrmTaskVar.tbxVarName.Text && varExists(tmpFrmTaskVar.tbxVarName.Text))
                    {
                        MessageBoxHelper.ShowWarningMsg("变量" + tmpFrmTaskVar.tbxVarName.Text + "已存在,请使用其他名称!");
                        return;
                    }
                    lvi1.Text             = tmpFrmTaskVar.tbxVarName.Text;
                    lvi1.SubItems[1].Text = tmpFrmTaskVar.TaskVarId;
                    lvi1.SubItems[2].Text = tmpFrmTaskVar.cbxVarType.SelectedItem.ToString();
                    lvi1.SubItems[3].Text = tmpFrmTaskVar.cbxVarModule.SelectedItem.ToString();
                    lvi1.SubItems[4].Text = tmpFrmTaskVar.VarDataBaseName;
                    lvi1.SubItems[5].Text = tmpFrmTaskVar.cbxDataTable.Text;
                    lvi1.SubItems[6].Text = tmpFrmTaskVar.cbxTableColumns.Text;
                    lvi1.SubItems[7].Text = tmpFrmTaskVar.tbxIniValue.Text;
                    lvi1.SubItems[8].Text = tmpFrmTaskVar.cbxAccessType.SelectedIndex.ToString();
                    lvi1.SubItems[9].Text = tmpFrmTaskVar.comboBoxbx.Text;
                }
            }
        }