Ejemplo n.º 1
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            Common.IsNew = true;
            switch (Common.NowMobule)
            {
            case "peoplemanage":
                Create create1 = new Create(this);
                create1.ShowDialog();
                break;

            case "machinemanage":
                MachineManageDialog machineManageDialog = new MachineManageDialog(this);
                machineManageDialog.ShowDialog();
                break;

            case "materialmanage":
                MaterialManageDialog materialManageDialog = new MaterialManageDialog(this);
                materialManageDialog.ShowDialog();
                break;

            case "tunnelmanage":
                TunnelManageDialog tunnelManageDialog = new TunnelManageDialog(this);
                tunnelManageDialog.ShowDialog();
                break;
            }
        }
Ejemplo n.º 2
0
        private void gv_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (gv.Columns[e.ColumnIndex].Name == "btnEdit")
            {
                Common.IsNew = false;

                switch (Common.NowMobule)
                {
                case "peoplemanage":
                    Common.Id = gv.Rows[e.RowIndex].Cells["card_num"].Value.ToString();
                    Create create1 = new Create(this);
                    create1.ShowDialog();
                    break;

                case "machinemanage":
                    Common.Id = gv.Rows[e.RowIndex].Cells["id"].Value.ToString();
                    MachineManageDialog machineManageDialog = new MachineManageDialog(this);
                    machineManageDialog.ShowDialog();
                    break;

                case "materialmanage":
                    Common.Id = gv.Rows[e.RowIndex].Cells["serial_num"].Value.ToString();
                    MaterialManageDialog materialManageDialog = new MaterialManageDialog(this);
                    materialManageDialog.ShowDialog();
                    break;

                case "tunnelmanage":
                    Common.Id = gv.Rows[e.RowIndex].Cells["id"].Value.ToString();
                    TunnelManageDialog tunnelManageDialog = new TunnelManageDialog(this);
                    tunnelManageDialog.ShowDialog();
                    break;
                }
            }
            else if (gv.Columns[e.ColumnIndex].Name == "btnDelete")
            {
                DialogResult result =
                    MessageBox.Show(
                        "确实要删除吗?",
                        "确认",
                        MessageBoxButtons.OKCancel,
                        MessageBoxIcon.Question);
                if (result == DialogResult.OK)
                {
                    //确认处理
                    switch (Common.NowMobule)
                    {
                    case "peoplemanage":
                        new PeopleManageBll().DeletePeople(gv.Rows[e.RowIndex].Cells["card_num"].Value.ToString());
                        break;

                    case "machinemanage":
                        new MachineManageBll().DeleteMachine(gv.Rows[e.RowIndex].Cells["id"].Value.ToString());
                        break;

                    case "materialmanage":
                        new MaterialManageBll().DeleteMaterial(gv.Rows[e.RowIndex].Cells["serial_num"].Value.ToString());
                        break;

                    case "tunnelmanage":
                        new TunnelManageBll().DeleteTunnel(gv.Rows[e.RowIndex].Cells["id"].Value.ToString());
                        break;
                    }
                    callBack();
                }
            }
        }