⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datainputform.cs

📁 一个使用免疫算法实现物流调度的源代码
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using immune_algorithm.wlddDataSetTableAdapters;
namespace immune_algorithm
{
    public partial class DataInputForm : Form
    {
        private Guid projectid = Guid.NewGuid();
        private int cOrs;//创建(1)还是选择(2)
        private wlddDataSet.missionNodeDataTable missionNodeDatTable;


        public DataInputForm(Guid projectid,int cOrs)
        {
            this.cOrs = cOrs;
            this.projectid = projectid;
            InitializeComponent();
        }

        public DataInputForm()
        {
            InitializeComponent();
        }

        private void DataInputForm_Load(object sender, EventArgs e)
        {
            // TODO: 这行代码将数据加载到表“wlddDataSet.linkPath”中。您可以根据需要移动或移除它。
            this.linkPathTableAdapter.Fill(this.wlddDataSet.linkPath);
            // TODO: 这行代码将数据加载到表“wlddDataSet.missionNode”中。您可以根据需要移动或移除它。
            this.missionNodeTableAdapter.Fill(this.wlddDataSet.missionNode);
            AllProjectTableAdapter projectTableAdapter = new AllProjectTableAdapter();
            wlddDataSet.AllProjectDataTable allpdt = projectTableAdapter.GetDataBy(this.projectid);
            missionNodeTableAdapter missionNodeAdapter = new missionNodeTableAdapter();
            missionNodeDatTable = missionNodeTableAdapter.GetDataBy(this.projectid);

            this.nodeViewGrid.Visible = false;
          if (allpdt.Rows.Count != 0)//对项目选择窗口过来的数据进行处理
          {
              this.projectText.Text =(allpdt.Rows[0]["projectName"]).ToString();
              this.idLbl.Text = (allpdt.Rows[0]["projectId"]).ToString();           
              this.nodeViewGrid.DataSource = missionNodeDatTable;
              this.nodeViewGrid.Visible = true;
          }
          else
          {
              this.idLbl.Text = Guid.NewGuid().ToString();             
          }
          if (this.cOrs == 1)
          {
              sureBtn.Visible = true;
          }
          else
          {
              sureBtn.Visible = false;
          }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.missionNodeTableAdapter.Update(missionNodeDatTable);
        }

        private void sureBtn_Click(object sender, EventArgs e)
        {
            wlddDataSet dataset = new wlddDataSet();
            dataset.AllProject.AddAllProjectRow(this.projectid, this.projectText.Text.ToString());
            AllProjectTableAdapter allAdapter = new AllProjectTableAdapter();
            allAdapter.Update(dataset.AllProject);
            missionNodeTableAdapter mnAdapter = new missionNodeTableAdapter();
            missionNodeDatTable = mnAdapter.GetDataBy(this.projectid);
            this.nodeViewGrid.DataSource = missionNodeDatTable;
            this.nodeViewGrid.Rows[0].Cells["projectId"].Value= this.projectid;
            this.nodeViewGrid.Columns["missionid"].Visible = false;
            this.nodeViewGrid.Columns["projectid"].Visible = false;
            this.nodeViewGrid.Visible = true;           
        }

        private void nodeViewGrid_UserAddedRow(object sender, DataGridViewRowEventArgs e)
        {
            this.nodeViewGrid.Rows[this.nodeViewGrid.NewRowIndex-1].Cells[0].Value = Guid.NewGuid();
            this.nodeViewGrid.Rows[this.nodeViewGrid.NewRowIndex-1].Cells[1].Value = this.projectid;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -