コード例 #1
0
        public void loadEditRepairForm(Client client = null, Device device = null)
        {
            this.client = client;
            this.device = device;
            //Load Repair number
            textBox_Number.Text = idRepair.ToString();

            //Load Date
            textBox_Date.Text = (sql.getDateByIdRepair(idRepair)).ToString();

            //Load Clients
            LoadClients();


            //Load Categories
            LoadCategories();


            //Load BrandsByCategory
            LoadBrandsByCategory();


            //Load getModelByCategoryAndBrand
            LoadModelByCategoryAndBrand();


            //Load Engineers
            LoadEngineers();


            //Load StatusRepairs
            LoadStatusRepairs();


            //Load TypesRepairs
            LoadTypesRepairs();

            //get Repair
            if (client == null && device == null)
            {
                comboBox_nameClient.Text = sql.getNameClientByIdRepair(idRepair);
                textsforTextboxes((Client)comboBox_nameClient.SelectedItem);

                sql.getRepair(idRepair, repair);

                textBox_SN.Text      = repair.SN;
                textBox_Defect.Text  = repair.Defect;
                textBox_kitView.Text = repair.KitView;
                textBox_Result.Text  = repair.Result;
                textBox_Price.Text   = repair.Price.ToString();

                comboBox_Categories.Text = sql.getNameCategoryByIdModel(repair.IdModel);

                comboBox_Brands.Text = sql.getNameBrandByIdModel(repair.IdModel);

                comboBox_Model.Text = sql.getNameModelByIdModel(repair.IdModel);

                comboBox_Engineer.Text = sql.getEngineerById(repair.IdEngineer);

                comboBox_StatusRepair.Text = sql.getStatusById(repair.IdStatus);

                comboBox_TypeRepair.Text = sql.getTypeRepairById(repair.IdType);
            }
        }