Пример #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            btnSelectAll.Text = "全选";
            switch (selectPanleType)
            {
            case 0:    //人员巡检
                FrmEmpPathAdd frmEmpPathAdd = new FrmEmpPathAdd(1, this);
                frmEmpPathAdd.ShowDialog(this);
                break;

            case 1:    //巡检路径
                FrmPathDetailAdd frmPathDetailAdd = new FrmPathDetailAdd(1, this);
                frmPathDetailAdd.ShowDialog(this);
                break;
            }
        }
Пример #2
0
        private void btnLaws_Click(object sender, EventArgs e)
        {
            DataGridViewRow r     = null;
            DataGridViewRow rTemp = null;
            int             i     = 0;

            switch (selectPanleType)
            {
            case 0:    //人员巡检
                foreach (DataGridViewRow row in dgvMain.Rows)
                {
                    if (row.Cells[0].Value != null)
                    {
                        if (row.Cells[0].Value.Equals("True"))
                        {
                            i++;
                            if (i > 1)
                            {
                                break;
                            }
                            r = row;
                        }
                    }
                }
                if (i == 0)
                {
                    MessageBox.Show("请选择要修改的人员巡检路径配置", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
                else if (i > 1)
                {
                    MessageBox.Show("所选人员巡检路径不能大于1个,请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
                if (r != null)
                {
                    FrmEmpPathAdd frmEmpPathAdd = new FrmEmpPathAdd(2, this);
                    frmEmpPathAdd.DgvRow = r;
                    frmEmpPathAdd.ShowDialog(this);
                    btnSelectAll.Text = "全选";
                }
                break;

            case 1:    //巡检路径
                foreach (DataGridViewRow row in dgvMain.Rows)
                {
                    if (row.Cells[0].Value != null && row.Cells[0].Value.Equals("True"))
                    {
                        if (rTemp != null)
                        {
                            if (!row.Cells["pathNo"].Value.Equals(rTemp.Cells["pathNo"].Value))
                            {
                                i++;
                                if (i > 1)
                                {
                                    break;
                                }
                            }
                            //r = row;
                        }
                        else
                        {
                            i++;
                            r = row;
                        }
                        rTemp = row;
                    }
                }
                if (i == 0)
                {
                    MessageBox.Show("请选择要修改的巡检路径配置", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
                else if (i > 1)
                {
                    MessageBox.Show("所选巡检路径不能大于1个,请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
                if (r != null)
                {
                    FrmPathDetailAdd frmPathDetailAdd = new FrmPathDetailAdd(2, this);
                    frmPathDetailAdd.DgvRow = r;
                    frmPathDetailAdd.ShowDialog(this);
                    btnSelectAll.Text = "全选";
                }
                break;
            }
        }
Пример #3
0
 private void btnLaws_Click(object sender, EventArgs e)
 {
     DataGridViewRow r = null;
     DataGridViewRow rTemp = null;
     int i = 0;
     switch (selectPanleType)
     {
         case 0://人员巡检
             foreach (DataGridViewRow row in dgvMain.Rows)
             {
                 if (row.Cells[0].Value != null)
                 {
                     if (row.Cells[0].Value.Equals("True"))
                     {
                         i++;
                         if (i > 1)
                         {
                             break;
                         }
                         r = row;
                     }
                 }
             }
             if (i == 0)
             {
                 MessageBox.Show("请选择要修改的人员巡检路径配置", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 return;
             }
             else if (i > 1)
             {
                 MessageBox.Show("所选人员巡检路径不能大于1个,请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 return;
             }
             if (r != null)
             {
                 FrmEmpPathAdd frmEmpPathAdd = new FrmEmpPathAdd(2, this);
                 frmEmpPathAdd.DgvRow = r;
                 frmEmpPathAdd.ShowDialog(this);
                 btnSelectAll.Text = "全选";
             }
             break;
         case 1://巡检路径
             foreach (DataGridViewRow row in dgvMain.Rows)
             {
                 if (row.Cells[0].Value != null && row.Cells[0].Value.Equals("True"))
                 {
                     if (rTemp != null)
                     {
                         if (!row.Cells["pathNo"].Value.Equals(rTemp.Cells["pathNo"].Value))
                         {
                             i++;
                             if (i > 1)
                             {
                                 break;
                             }
                         }
                         //r = row;
                     }
                     else
                     {
                         i++;
                         r = row;
                     }
                     rTemp = row;
                 }
             }
             if (i == 0)
             {
                 MessageBox.Show("请选择要修改的巡检路径配置", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 return;
             }
             else if (i > 1)
             {
                 MessageBox.Show("所选巡检路径不能大于1个,请重新选择!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                 return;
             }
             if (r != null)
             {
                 FrmPathDetailAdd frmPathDetailAdd = new FrmPathDetailAdd(2, this);
                 frmPathDetailAdd.DgvRow = r;
                 frmPathDetailAdd.ShowDialog(this);
                 btnSelectAll.Text = "全选";
             }
             break;
     }
 }
Пример #4
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     btnSelectAll.Text = "全选";
     switch (selectPanleType)
     {
         case 0://人员巡检
             FrmEmpPathAdd frmEmpPathAdd = new FrmEmpPathAdd(1, this);
             frmEmpPathAdd.ShowDialog(this);
             break;
         case 1://巡检路径
             FrmPathDetailAdd frmPathDetailAdd = new FrmPathDetailAdd(1, this);
             frmPathDetailAdd.ShowDialog(this);
             break;
     }
 }