コード例 #1
0
        public static void MouseDoubleClick(WinFormModelTypesList.ModelTypes typeModel, DataGridView dgv)
        {
            var typeID = dgv.SelectedRows[0].Cells[0].Value;


            if (typeModel.ToString() == ModelTypes.VehicleCategoryModel.ToString())
            {
                frmAddUpdateVehicleCategory frm = new frmAddUpdateVehicleCategory(int.Parse(typeID.ToString()));
                frm.Show();
            }

            if (typeModel.ToString() == ModelTypes.VehicleFuelTypeModel.ToString())
            {
                frmAddUpdateVFuelType frm = new frmAddUpdateVFuelType(int.Parse(typeID.ToString()));
                frm.Show();
            }

            if (typeModel.ToString() == ModelTypes.VehicleManufacturerModel.ToString())
            {
                frmAddUpdateVehicleManufacturer frm = new frmAddUpdateVehicleManufacturer(int.Parse(typeID.ToString()));
                frm.Show();
            }

            if (typeModel.ToString() == ModelTypes.VehicleTransmissionTypeModel.ToString())
            {
                frmAddUpdateVehicleTransmissionType frm = new frmAddUpdateVehicleTransmissionType(int.Parse(typeID.ToString()));
                frm.Show();
            }

            if (typeModel.ToString() == ModelTypes.VehicleTypeModel.ToString())
            {
                frmAddUpdateVehicleType frm = new frmAddUpdateVehicleType(int.Parse(typeID.ToString()));
                frm.Show();
            }
        }
コード例 #2
0
        private void GenerateContentForClickItems(string formName, bool clickForSearch)
        {
            if (formName == VehicleReports)
            {
                frmVehiclesReport frm = new frmVehiclesReport();
                frm.MdiParent   = this;
                frm.WindowState = FormWindowState.Maximized;
                frm.Show();
            }

            if (formName == Branches)
            {
                if (clickForSearch)
                {
                    frmBranch frm = new frmBranch();

                    frm.MdiParent   = this;
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
                else
                {
                    frmAddUpdateBranch frm = new frmAddUpdateBranch();
                    frm.Show();
                }
            }

            if (formName == Clients)
            {
                if (clickForSearch)
                {
                    frmClient frm = new frmClient();

                    frm.MdiParent   = this;
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
                else
                {
                    frmAddUpdateClient frm = new frmAddUpdateClient();
                    frm.Show();
                }
            }

            if (formName == Countries)
            {
                if (clickForSearch)
                {
                    frmCountries frm = new frmCountries();

                    frm.MdiParent   = this;
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
                else
                {
                    frmAddCountry frm = new frmAddCountry();
                    frm.Show();
                }
            }

            if (formName == Employees)
            {
                if (clickForSearch)
                {
                    frmEmployees frm = new frmEmployees();

                    frm.MdiParent   = this;
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
                else
                {
                    frmAddUpdateEmployee frm = new frmAddUpdateEmployee();
                    frm.Show();
                }
            }

            if (formName == EmployeeRoles)
            {
                if (clickForSearch)
                {
                    frmEmployeeRoles frm = new frmEmployeeRoles();

                    frm.MdiParent   = this;
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
                else
                {
                    frmAddUpdateEmployeeRoles frm = new frmAddUpdateEmployeeRoles();
                    frm.Show();
                }
            }

            if (formName == Insurance)
            {
                if (clickForSearch)
                {
                    frmInsurance frm = new frmInsurance();

                    frm.MdiParent   = this;
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
                else
                {
                    frmAddUpdateInsurance frm = new frmAddUpdateInsurance();
                    frm.Show();
                }
            }

            if (formName == Ratings)
            {
                if (clickForSearch)
                {
                    frmRating frm = new frmRating();

                    frm.MdiParent   = this;
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
            }

            if (formName == Reservations)
            {
                if (clickForSearch)
                {
                    frmReservation frm = new frmReservation();

                    frm.MdiParent   = this;
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
            }

            if (formName == VehicleCategories)
            {
                if (clickForSearch)
                {
                    frmVehicleCategory frm = new frmVehicleCategory();

                    frm.MdiParent   = this;
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
                else
                {
                    frmAddUpdateVehicleCategory frm = new frmAddUpdateVehicleCategory();
                    frm.Show();
                }
            }

            if (formName == Vehicles)
            {
                if (clickForSearch)
                {
                    frmVehicle frm = new frmVehicle();

                    frm.MdiParent   = this;
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
                else
                {
                    frmAddUpdateVehicle frm = new frmAddUpdateVehicle();
                    frm.Show();
                }
            }

            if (formName == VehicleFuelTypes)
            {
                if (clickForSearch)
                {
                    frmVehicleFuelType frm = new frmVehicleFuelType();

                    frm.MdiParent   = this;
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
                else
                {
                    frmAddUpdateVFuelType frm = new frmAddUpdateVFuelType();
                    frm.Show();
                }
            }

            if (formName == VehicleManufacturers)
            {
                if (clickForSearch)
                {
                    frmVehicleManufacturer frm = new frmVehicleManufacturer();

                    frm.MdiParent   = this;
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
                else
                {
                    frmAddUpdateVehicleManufacturer frm = new frmAddUpdateVehicleManufacturer();
                    frm.Show();
                }
            }

            if (formName == VehicleModels)
            {
                if (clickForSearch)
                {
                    frmVehicleModel frm = new frmVehicleModel();

                    frm.MdiParent   = this;
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
                else
                {
                    frmAddUpdateVehicleModel frm = new frmAddUpdateVehicleModel();
                    frm.Show();
                }
            }

            if (formName == VehicleTransmissionTypes)
            {
                if (clickForSearch)
                {
                    frmVehicleTransmissionType frm = new frmVehicleTransmissionType();

                    frm.MdiParent   = this;
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
                else
                {
                    frmAddUpdateVehicleTransmissionType frm = new frmAddUpdateVehicleTransmissionType();
                    frm.Show();
                }
            }

            if (formName == VehicleTypes)
            {
                if (clickForSearch)
                {
                    frmVehicleType frm = new frmVehicleType();

                    frm.MdiParent   = this;
                    frm.WindowState = FormWindowState.Maximized;
                    frm.Show();
                }
                else
                {
                    frmAddUpdateVehicleType frm = new frmAddUpdateVehicleType();
                    frm.Show();
                }
            }
        }