Exemplo n.º 1
0
 private void buttonSearch_Click(object sender, EventArgs e)
 {
     try
     {
         string projectName = textBoxProjectName.Text.Trim();
         if (projectName.Equals(string.Empty))
         {
             ZBMMessageBox.ShowInfo("请输入项目名");
             return;
         }
         ServiceClient client = new ServiceClient();
         DataTable dataTable = client.SelectDeviceByProject(projectName);
         if (dataTable != null)
         {
             if (dataTable.Rows.Count > 0)
             {
                 dataGridViewDevice.DataSource = dataTable;
             }
             else
             {
                 ZBMMessageBox.ShowInfo("此项目名下不存在设备");
             }
         }
         else
         {
             ZBMMessageBox.ShowInfo("查找失败");
         }
     }
     catch (Exception ex)
     {
         ExceptionLog.Instance.WriteLog(ex, LogType.UI);
         ZBMMessageBox.ShowError(ex);
     }
 }
Exemplo n.º 2
0
        private void dataGridViewProject_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e)
        {
            try
            {
                if (e.StateChanged == DataGridViewElementStates.Selected)
                {
                    if (dataGridViewProject.Rows.Count > 0)
                    {
                        dataRowProject = dataTableProject.Rows[e.Row.Index];
                        string projectName = Convert.ToString(dataRowProject["ProjectName"]);

                        ServiceClient client = new ServiceClient();
                        dataTableDevice = client.SelectDeviceByProject(projectName);
                        dataGridViewProjectDevice.DataSource = dataTableDevice;
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLog.Instance.WriteLog(ex, LogType.UI);
                ZBMMessageBox.ShowError(ex);
            }
        }