Esempio n. 1
0
        private void dgvRL_CurrentCellChanged(object sender, EventArgs e)
        {
            string str = this.dgvRL.CurrentRow.Cells[this.colDT.Name].FormattedValue.ToString();

            if (str != "" && UserProc.IsInt(str))
            {
                int num1 = -1;
                int num2 = 0;
                int num3 = (int)Convert.ToInt16(this.dgvRL.CurrentRow.Cells[this.colDT.Name].Value) - 1;
                for (int index = 0; index < UserProc.DLparaDT.Length; ++index)
                {
                    num2 += UserProc.DLparaDT[index];
                    if (num3 < num2)
                    {
                        num1 = index;
                        break;
                    }
                }
                this.lblCheng.Text = num1 >= 0 ? (num1 + 1).ToString() : "";
                this.lblDT.Text    = str;
            }
            else
            {
                this.lblCheng.Text = "";
                this.lblDT.Text    = "";
            }
            this.lblRL.Text = this.dgvRL.CurrentRow.Cells[this.colRL.Name].FormattedValue.ToString();
        }
Esempio n. 2
0
 private void Txt_Validating(object sender, CancelEventArgs e)
 {
     this.txt.Text = this.txt.Text.Trim();
     if (this.txt.Text.Length > 0)
     {
         if (this.txt.Text.Length > this._txtLen)
         {
             e.Cancel = true;
             this.errP.SetError(this, "字数不能大于:" + this._txtLen.ToString());
             return;
         }
         if (this._txtISid && !Regex.IsMatch(this.txt.Text, "[A-Z0-9-]{" + this.txt.Text.Length.ToString() + "}"))
         {
             e.Cancel = true;
             this.errP.SetError(this, "大写字母、数字、- 的组合");
             return;
         }
         if (this._txtISint && !UserProc.IsInt(this.txt.Text))
         {
             e.Cancel = true;
             this.errP.SetError(this, "整数");
             return;
         }
         if (this._txtISmoney && !UserProc.IsNumeric(this.txt.Text))
         {
             e.Cancel = true;
             this.errP.SetError(this, "数值");
             return;
         }
     }
     this.errP.SetError(this, "");
 }
Esempio n. 3
0
 private void coboEX_Validating(object sender, CancelEventArgs e)
 {
     if (this.chk.Checked)
     {
         if (this._allowInput)
         {
             this.coboex.Text = this.coboex.Text.Trim();
         }
         if (this.coboex.Text == "" && !this._allowEmpty)
         {
             e.Cancel = true;
             this.errP.SetError((Control)this, "输入数据");
             return;
         }
         if (this.coboex.Text.Length > this._txtLen)
         {
             e.Cancel = true;
             this.errP.SetError((Control)this, "字数不能大于:" + this._txtLen.ToString());
             return;
         }
         if (this._txtISbyte && (!UserProc.IsInt(this.coboex.Text) || Convert.ToInt16(this.coboex.Text) >= (short)256))
         {
             e.Cancel = true;
             this.errP.SetError((Control)this, "小于256的整数");
             return;
         }
     }
     this.errP.SetError((Control)this, "");
 }
Esempio n. 4
0
        private void dgvDH_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
        {
            if (this.dgvDH.ReadOnly || this.dgvDH.CurrentCell == null || !this.dgvDH.CurrentCell.IsInEditMode || e.ColumnIndex != this.colRLdh.Index)
            {
                return;
            }
            this.colRLdh.SortMode = DataGridViewColumnSortMode.NotSortable;
            string str1 = this.dgvDH.CurrentCell.EditedFormattedValue.ToString();

            if (str1 == "")
            {
                this.colRLdh.SortMode = DataGridViewColumnSortMode.Automatic;
            }
            else if (!UserProc.IsInt(str1) || Convert.ToInt16(str1) < (short)1 || Convert.ToInt16(str1) > (short)48)
            {
                int num = (int)MessageBox.Show((IWin32Window)this, "请输入正确 <灯号>( 1 <= 数值 <= 48 )!!!", "提示");
                e.Cancel = true;
                this.colRLdh.SortMode = DataGridViewColumnSortMode.Automatic;
            }
            else if (str1.TrimStart('0') != str1)
            {
                int num = (int)MessageBox.Show((IWin32Window)this, "灯号数值请不要以 0 开头 !!!", "提示");
                e.Cancel = true;
                this.colRLdh.SortMode = DataGridViewColumnSortMode.Automatic;
            }
            else
            {
                int int16 = (int)Convert.ToInt16(str1);
                for (int index = 0; index < this.dgvDH.RowCount; ++index)
                {
                    if (index != e.RowIndex)
                    {
                        string str2 = dgvDH.Rows[index].Cells[this.colRLdh.Name].FormattedValue.ToString();
                        if (!(str2 == "") && (int)Convert.ToInt16(str2) == int16)
                        {
                            int num = (int)MessageBox.Show((IWin32Window)this, "该灯号已存在!!!", "提示");
                            e.Cancel = true;
                            this.colRLdh.SortMode = DataGridViewColumnSortMode.Automatic;
                            return;
                        }
                    }
                }
                this.colRLdh.SortMode = DataGridViewColumnSortMode.Automatic;
            }
        }