Example #1
0
        private void btnUpdateEquip_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode != null)
            {
                if (dataGridViewX1.SelectedRows.Count > 0)
                {
                    string placeID    = treeView1.SelectedNode.Name;
                    string placeName  = treeView1.SelectedNode.Text;
                    string equipID    = "" + dataGridViewX1.SelectedRows[0].Tag;
                    string equipname  = "" + dataGridViewX1.SelectedRows[0].Cells[1].Value;
                    string propertyNo = "" + dataGridViewX1.SelectedRows[0].Cells[2].Value;

                    frmEquip form = new frmEquip(FormMode.Update, placeID, placeName, equipID, equipname, propertyNo);
                    form.Text        = string.Format("{0}設施", EnumDescription.Get(typeof(FormMode), FormMode.Update.ToString()));
                    form.FormClosed += delegate
                    {
                        if (form.DialogResult == DialogResult.Yes)
                        {
                            ReloadDataGridView1(placeID);
                        }
                    };
                    form.ShowDialog();
                }
            }
        }
Example #2
0
        private void btnAddEquip_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode != null && !string.IsNullOrEmpty(treeView1.SelectedNode.Name))
            {
                string placeID   = treeView1.SelectedNode.Name;
                string placeName = treeView1.SelectedNode.Text;

                frmEquip form = new frmEquip(FormMode.Add, placeID, placeName, null, null, null);
                form.Text        = string.Format("{0}設施", EnumDescription.Get(typeof(FormMode), FormMode.Add.ToString()));
                form.FormClosed += delegate
                {
                    if (form.DialogResult == DialogResult.Yes)
                    {
                        ReloadDataGridView1(placeID);
                    }
                };
                form.ShowDialog();
            }
        }