private void btnList_Click(object sender, EventArgs e) { removeAllManagamentControls(); switch (this.Mantenimiento) { case "Users": ViewUsers viewUser = new ViewUsers(); UserCtrl userCtrl = new UserCtrl(); viewUser.Height = Parent.Height; viewUser.Width = Parent.Width; this.result = userCtrl.getAllUsers(); if (this.result["code"] == Result.Failed) { MessageBox.Show(this.result["msg"]); return; } if (this.result["code"] == Result.Processed) { viewUser.loadDataGrid(this.result["content"]); Parent.Controls.Add(viewUser); } break; case "Clients": ClientsList clientsList = new ClientsList(); ClientsController cont = new ClientsController(); clientsList.Height = Parent.Height; clientsList.Width = Parent.Width; Dictionary <Object, dynamic> res = cont.getAllClients(); if (res["code"] == Result.Failed) { MessageBox.Show(res["msg"]); return; } if (res["code"] == Result.Processed) { clientsList.loadDataGrid(res["content"]); Parent.Controls.Add(clientsList); } break; case "States": ViewStates viewState = new ViewStates(); StateController controller = new StateController(); viewState.Height = Parent.Height; viewState.Width = Parent.Width; this.result = controller.getAllStates(); if (this.result["code"] == Result.Failed) { MessageBox.Show(this.result["msg"]); return; } if (this.result["code"] == Result.Processed) { viewState.loadDataGrid(this.result["content"]); Parent.Controls.Add(viewState); } break; case "PaymentMethods": ViewPaymentMethods viewPayment = new ViewPaymentMethods(); PaymentMethodController cnt = new PaymentMethodController(); viewPayment.Height = Parent.Height; viewPayment.Width = Parent.Width; this.result = cnt.getAllPaymentMethods(); if (this.result["code"] == Result.Failed) { MessageBox.Show(this.result["msg"]); return; } if (this.result["code"] == Result.Processed) { viewPayment.loadDataGrid(this.result["content"]); Parent.Controls.Add(viewPayment); } break; case "MaterialTypes": ViewMaterialTypes viewMaterials = new ViewMaterialTypes(); MaterialTypeController contr = new MaterialTypeController(); viewMaterials.Height = Parent.Height; viewMaterials.Width = Parent.Width; this.result = contr.getAllMaterialTypes(); if (this.result["code"] == Result.Failed) { MessageBox.Show(this.result["msg"]); return; } if (this.result["code"] == Result.Processed) { viewMaterials.loadDataGrid(this.result["content"]); Parent.Controls.Add(viewMaterials); } break; case "Materials": MaterialsList listMaterials = new MaterialsList(); MaterialController ctrl = new MaterialController(); listMaterials.Height = Parent.Height; listMaterials.Width = Parent.Width; this.result = ctrl.getMaterialsToPopulate(); if (this.result["code"] == Result.Failed) { MessageBox.Show(this.result["msg"]); return; } if (this.result["code"] == Result.Processed) { listMaterials.loadDataGrid(this.result["content"]); Parent.Controls.Add(listMaterials); } break; case "ProductTypes": ViewProductTypes viewProductTypes = new ViewProductTypes(); ProductTypeController contr2 = new ProductTypeController(); viewProductTypes.Height = Parent.Height; viewProductTypes.Width = Parent.Width; this.result = contr2.getAllProductTypes(); if (this.result["code"] == Result.Failed) { MessageBox.Show(this.result["msg"]); return; } if (this.result["code"] == Result.Processed) { viewProductTypes.loadDataGrid(this.result["content"]); Parent.Controls.Add(viewProductTypes); } break; case "Products": ViewProducts viewProducts = new ViewProducts(); ProductController contr3 = new ProductController(); viewProducts.Height = Parent.Height; viewProducts.Width = Parent.Width; this.result = contr3.getAllProducts(); if (this.result["code"] == Result.Failed) { MessageBox.Show(this.result["msg"]); return; } if (this.result["code"] == Result.Processed) { viewProducts.loadDataGrid(this.result["content"]); Parent.Controls.Add(viewProducts); } break; case "Providers": ViewProviders viewProviders = new ViewProviders(); ProviderController providerCtrl = new ProviderController(); viewProviders.Height = Parent.Height; viewProviders.Width = Parent.Width; this.result = providerCtrl.getAllProviders(); if (this.result["code"] == Result.Failed) { MessageBox.Show(this.result["msg"]); return; } if (this.result["code"] == Result.Processed) { viewProviders.loadDataGrid(this.result["content"]); Parent.Controls.Add(viewProviders); } break; } }