Exemplo n.º 1
0
        private void btn增加物资验收记录_Click(object sender, EventArgs e)
        {
            物资验收记录 form = new 物资验收记录(mainform);

            form.Show();
            if (dataGridView1.Rows.Count > 0)
            {
                dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.Rows.Count - 1;
            }
        }
Exemplo n.º 2
0
        void tsi_Click(object sender, EventArgs e)
        {
            SqlDataAdapter da;
            DataTable      dt;

            if (this.Name == sender.ToString())
            {
                return;
            }
            int id;

            if (this.Name == "物资验收记录")
            {
                id = Convert.ToInt32(dtOuter.Rows[0]["ID"]);
            }
            else
            {
                id = Convert.ToInt32(dtOuter.Rows[0]["物资验收记录ID"]);
            }
            try
            {
                switch (sender.ToString())
                {
                case "物资验收记录":
                    物资验收记录 form1 = new 物资验收记录(mainform, id);
                    form1.Show();
                    break;

                case "物资请验单":
                    da = new SqlDataAdapter("select * from 物资请验单 where 物资验收记录ID=" + id, mySystem.Parameter.conn);
                    dt = new DataTable();
                    da.Fill(dt);
                    物资请验单 form2 = new 物资请验单(mainform, Convert.ToInt32(dt.Rows[0]["ID"]));
                    form2.Show();
                    break;

                case "检验记录":
                    da = new SqlDataAdapter("select * from 检验记录 where 物资验收记录ID=" + id, mySystem.Parameter.conn);
                    dt = new DataTable();
                    da.Fill(dt);
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("没有关联的检验记录");
                    }
                    foreach (DataRow dr in dt.Rows)
                    {
                        (new  验记录(mainform, Convert.ToInt32(dr["ID"]))).Show();                                //form3.Show();
                    }
                    break;

                case "取样记录":
                    da = new SqlDataAdapter("select * from 取样记录 where 物资验收记录ID=" + id, mySystem.Parameter.conn);
                    dt = new DataTable();
                    da.Fill(dt);
                    取样记录 form4 = new 取样记录(mainform, Convert.ToInt32(dt.Rows[0]["ID"]));
                    form4.Show();
                    break;
                }
            }
            catch
            {
                MessageBox.Show("关联失败,请检查是否有相应数据");
            }
            //MessageBox.Show(this.Name + "\n" + sender.ToString());
        }