private void button1_Click(object sender, EventArgs e)
        {
            switch (isAddOrUpdate)
            {
            case 0:    //add
                if (HandelControls.Msg("是否确认添加?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (RegexString())
                    {
                        isAddOrUpdateMethod();
                    }
                }
                break;

            case 1:    //update
                if (HandelControls.Msg("是否确认修改?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (RegexString())
                    {
                        isAddOrUpdateMethod();
                    }
                }
                break;

            default: break;
            }
            this.Close();
        }
        private void QueryDeviceData(string number)
        {
            var theDevice = (from data in theSettingGrop.TheDeviceDataSetting where data.RemoteAToID == number || data.RemoteBToID == number || data.RemoteCToID == number select data).FirstOrDefault();

            if (theDevice != null)
            {
                string str = "";//所属路线
                if (theDevice.RemoteAToID == number)
                {
                    str = "1";
                }
                else if (theDevice.RemoteBToID == number)
                {
                    str = "2";
                }
                else if (theDevice.RemoteCToID == number)
                {
                    str = "3";
                }
                //读取地址和路线的集合
                List <ReadSqlLiteData> remoteArray       = HandelControls.returnRemoteArray(theDevice.DeviceDataID, str);
                List <ReadSqlLiteData> telemeteringArray = HandelControls.returnTelemeteringArray(theDevice.DeviceDataID, str);
                ShowQueryData          theShowQueryData  = new ShowQueryData(remoteArray, telemeteringArray, str);
                theShowQueryData.Text = "第" + str + "路遥信遥测数据";
                theShowQueryData.ShowDialog();
            }
            else
            {
                HandelControls.Msg("暂无数据", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
 //修改线路
 private void button10_Click(object sender, EventArgs e)
 {
     if (CircuitView.SelectedRows.Count > 0 && ValidateData.CellIsNullOrZero(CircuitView.SelectedRows[0].Cells["CircuitID"]))
     {
         Circuit theCircuit = new Circuit();
         theCircuit.CircuitName   = CircuitView.SelectedRows[0].Cells["CircuitName"].Value.ToString();
         theCircuit.CircuitID     = CircuitView.SelectedRows[0].Cells["CircuitID"].Value.ToString();
         theCircuit.CircuitNumber = CircuitView.SelectedRows[0].Cells["CircuitNumber"].Value.ToString();
         theCircuit.CircuitToID   = CircuitView.SelectedRows[0].Cells["CircuitToID"].Value.ToString();
         MsgCircuit theMsgCircuit = new MsgCircuit(theCircuit);
         theMsgCircuit.Text          = "修改线路";
         theMsgCircuit.isAddOrUpdate = 1;
         theMsgCircuit.ShowDialog();
     }
     else
     {
         HandelControls.Msg("请选择要修改的数据", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 //修改母线
 private void button7_Click(object sender, EventArgs e)
 {
     if (GeneratrixView.SelectedRows.Count > 0 && ValidateData.CellIsNullOrZero(GeneratrixView.SelectedRows[0].Cells["GeneratrixID"]))
     {
         Generatrix theGeneratrix = new Generatrix();
         theGeneratrix.GeneratrixName   = GeneratrixView.SelectedRows[0].Cells["GeneratrixName"].Value.ToString();
         theGeneratrix.GeneratrixNumber = GeneratrixView.SelectedRows[0].Cells["GeneratrixNumber"].Value.ToString();
         theGeneratrix.GeneratrixID     = GeneratrixView.SelectedRows[0].Cells["GeneratrixID"].Value.ToString();
         theGeneratrix.GeneratrixToID   = GeneratrixView.SelectedRows[0].Cells["GeneratrixToID"].Value.ToString();
         MsgGeneratrix theGeneratrixHandel = new MsgGeneratrix(theGeneratrix);
         theGeneratrixHandel.Text          = "修改变母线";
         theGeneratrixHandel.isAddOrUpdate = 1;
         theGeneratrixHandel.ShowDialog();
     }
     else
     {
         HandelControls.Msg("请选择要修改的数据", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 //修改变电站
 private void button4_Click(object sender, EventArgs e)
 {
     if (ConvertingStationView.SelectedRows.Count > 0 && ValidateData.CellIsNullOrZero(ConvertingStationView.SelectedRows[0].Cells["stationID"]))
     {
         ConvertingStation content = new ConvertingStation()
         {
             stationName    = ConvertingStationView.SelectedRows[0].Cells["stationName"].Value.ToString(),
             stationID      = ConvertingStationView.SelectedRows[0].Cells["stationID"].Value.ToString(),
             stationRemarks = ConvertingStationView.SelectedRows[0].Cells["stationRemarks"].Value.ToString()
         };
         MsgConvertingStation theConvertingStationHandel = new MsgConvertingStation(content);
         theConvertingStationHandel.Text          = "修改变电站";
         theConvertingStationHandel.isAddOrUpdate = 1;
         theConvertingStationHandel.ShowDialog();
     }
     else
     {
         HandelControls.Msg("请选择要修改的数据", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 //修改设备
 private void button15_Click(object sender, EventArgs e)
 {
     if (DeviceDataView.SelectedRows.Count > 0 && ValidateData.CellIsNullOrZero(DeviceDataView.SelectedRows[0].Cells["DeviceDataID"]))
     {
         DeviceDataSetting theDeviceDataSetting = new DeviceDataSetting();
         theDeviceDataSetting.DeviceDataName = DeviceDataView.SelectedRows[0].Cells["DeviceDataName"].Value.ToString();
         theDeviceDataSetting.DeviceDataID   = DeviceDataView.SelectedRows[0].Cells["DeviceDataID"].Value.ToString();
         theDeviceDataSetting.RemoteAToID    = DeviceDataView.SelectedRows[0].Cells["RemoteAToID"].Value.ToString();
         theDeviceDataSetting.RemoteBToID    = DeviceDataView.SelectedRows[0].Cells["RemoteBToID"].Value.ToString();
         theDeviceDataSetting.RemoteCToID    = DeviceDataView.SelectedRows[0].Cells["RemoteCToID"].Value.ToString();
         theDeviceDataSetting.DeviceDataToID = DeviceDataView.SelectedRows[0].Cells["DeviceDataToID"].Value.ToString();
         MsgDeviceSetting theMsgDeviceSetting = new MsgDeviceSetting(theDeviceDataSetting);
         theMsgDeviceSetting.Text          = "修改设备";
         theMsgDeviceSetting.isAddOrUpdate = 1;
         theMsgDeviceSetting.ShowDialog();
     }
     else
     {
         HandelControls.Msg("请选择要修改的数据", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            switch (isAddOrUpdate)
            {
            case 0:
                if (ValidateData.ValidateString(textBox1.Text))
                {
                    if (HandelControls.Msg("是否确认添加?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        isAddOrUpdateMethod();
                        this.Close();
                    }
                }
                else
                {
                    label3.Visible = true;
                }
                break;

            case 1:
                if (ValidateData.ValidateString(textBox1.Text))
                {
                    if (HandelControls.Msg("是否确认修改?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        isAddOrUpdateMethod();
                        this.Close();
                    }
                }
                else
                {
                    label3.Visible = true;
                }
                break;

            default: break;
            }
        }
 //修改检测点
 private void button13_Click(object sender, EventArgs e)
 {
     if (DetectionView.SelectedRows.Count > 0 && ValidateData.CellIsNullOrZero(DetectionView.SelectedRows[0].Cells["DetectionID"]))
     {
         Detection theDetection = new Detection();
         theDetection.DetectionID         = DetectionView.SelectedRows[0].Cells["DetectionID"].Value.ToString();
         theDetection.DetectionName       = DetectionView.SelectedRows[0].Cells["DetectionName"].Value.ToString();
         theDetection.DetectionNumber     = DetectionView.SelectedRows[0].Cells["DetectionNumber"].Value.ToString();
         theDetection.DetectionToSecondID = DetectionView.SelectedRows[0].Cells["DetectionToSecondID"].Value.ToString();
         theDetection.RemoteA             = DetectionView.SelectedRows[0].Cells["RemoteA"].Value.ToString();
         theDetection.RemoteB             = DetectionView.SelectedRows[0].Cells["RemoteB"].Value.ToString();
         theDetection.RemoteC             = DetectionView.SelectedRows[0].Cells["RemoteC"].Value.ToString();
         theDetection.DetectionToID       = DetectionView.SelectedRows[0].Cells["DetectionToID"].Value.ToString();
         theDetection.DetectionToName     = DetectionView.SelectedRows[0].Cells["DetectionToName"].Value.ToString();
         MsgDetection theMsgDetection = new MsgDetection(theDetection);
         theMsgDetection.Text          = "修改检测点";
         theMsgDetection.isAddOrUpdate = 1;
         theMsgDetection.ShowDialog();
     }
     else
     {
         HandelControls.Msg("请选择要修改的数据", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }