Example #1
0
 /// <summary>
 /// 添加平台
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void bt_add_Click(object sender, EventArgs e)
 {
     if (tb_add.Text != "")
     {
         this.DGPlatConfig.AllowUserToAddRows = true;
         try
         {
             //if (Myadapter_p.InsertPlat(int.Parse(tb_add.Text),"212.64.12.60","空闲", "空闲", "空闲", "空闲", "空闲", "空闲") != 1)
             //{
             //    MessageBox.Show("添加失败");
             //    // LogHelper.Info("添加平台失败");
             //}
             //else {
             //    MessageBox.Show("添加成功");
             //}
         }
         catch (Exception)
         {
             MessageBox.Show("添加失败,请检查此ID是否已经存在");
         }
         this.dt_PlateInfoTableAdapter.Fill(this.myDataSet.Dt_PlateInfo);
         this.DGPlatConfig.AllowUserToAddRows = false;
         DGPlatConfig.ClearSelection();
     }
     else
     {
         MessageBox.Show("请输入要添加的主机ID");
     }
 }
Example #2
0
        private void JianceConfig_Load(object sender, EventArgs e)
        {
            Myadapter_p = new Dt_PlateInfoTableAdapter();
            try
            {
                this.dt_PlateInfoTableAdapter.Fill(this.myDataSet.Dt_PlateInfo);
                DGPlatConfig.ClearSelection();
            }
            catch (Exception)
            {
                MessageBox.Show("本地数据库连接异常");
            }
            // TODO: 这行代码将数据加载到表“myDataSet.Dt_PlateInfo”中。您可以根据需要移动或删除它。
            flag = false;
            this.DGPlatConfig.AllowUserToAddRows = false;

            fc = new FormControl(this);
            fc.GetInit(this, fc);

            this.formStartX = this.Width;
            this.formStartY = this.Height;

            TB_IP.Text   = CommonFunction.dicBooks["strMainHostIP"];
            TB_PORT.Text = CommonFunction.dicBooks["strMainHostPort"];
        }
Example #3
0
 /// <summary>
 /// 删除平台
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void bt_delet_Click(object sender, EventArgs e)
 {
     if (tb_delet.Text != "")
     {
         this.DGPlatConfig.AllowUserToAddRows = true;
         try
         {
             if (Myadapter_p.DeletePlat(int.Parse(tb_delet.Text)) != 1)
             {
                 MessageBox.Show("删除失败,请检查此ID是否已经删除");
                 // LogHelper.Info("添加平台失败");
             }
             else
             {
                 MessageBox.Show("删除成功");
             }
         }
         catch (Exception)
         {
             MessageBox.Show("删除失败,请检查此ID是否已经删除");
         }
         this.dt_PlateInfoTableAdapter.Fill(this.myDataSet.Dt_PlateInfo);
         this.DGPlatConfig.AllowUserToAddRows = false;
         DGPlatConfig.ClearSelection();
     }
     else
     {
         MessageBox.Show("请输入要删除的主机ID");
     }
 }
Example #4
0
        /// <summary>
        /// 保存配置信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bt_save_Click(object sender, EventArgs e)
        {
            DataTable Changedt = this.myDataSet.Dt_PlateInfo.GetChanges();
            bool      flag2    = true;

            if (Changedt != null)
            {
                foreach (DataRow dr in Changedt.Rows)
                {
                    if (dr.RowState == System.Data.DataRowState.Modified)
                    {
                        try
                        {
                            if (Myadapter_p.UpdatePlat(dr["IP"].ToString(), dr["PlatComs"].ToString(), dr["PlatIcs"].ToString(), dr["PlatChus_msb"].ToString(), dr["PlatChus_xzy"].ToString(), dr["PlatChus_csb"].ToString(), dr["PlatZhos"].ToString(), dr["PlatComp"].ToString(), dr["PlatIcp"].ToString(), dr["PlatChup_msb"].ToString(), dr["PlatChup_xzy"].ToString(), dr["PlatChup_csb"].ToString(), dr["PlatZhop"].ToString(), Convert.ToInt32(dr["Id"].ToString())) > 0)
                            {
                                flag2 = true;
                            }
                            else
                            {
                                flag2 = false;
                            }
                        }
                        catch (Exception se)
                        {
                            MessageBox.Show("配置信息修改失败" + se.ToString());
                        }
                    }
                }
                if (flag2 == true)
                {
                    MessageBox.Show("配置信息修改成功");
                }
                else
                {
                    MessageBox.Show("配置信息修改失败");
                }
                this.dt_PlateInfoTableAdapter.Fill(this.myDataSet.Dt_PlateInfo);
                DGPlatConfig.ClearSelection();
            }
            else
            {
                MessageBox.Show("配置信息修改成功");
            }
        }
Example #5
0
 private void JianceConfig_MouseDown(object sender, MouseEventArgs e)
 {
     DGPlatConfig.ClearSelection();
 }