Ejemplo n.º 1
0
        //---------CRUD---------//

        private void createButton_Click(object sender, EventArgs e)
        {
            string name     = txtNameClient.Text;
            string lastname = txtLastnameClient.Text;
            string idType   = cmbIdentificationType.Text;
            string identif  = txtIdentification.Text;
            string bornDate = datepBornDate.Text;
            string email    = txtEmailClient.Text;

            try
            {
                if (ClientManagement.InsertClient(name, lastname, identif, idType, email, bornDate))
                {
                    Clear();
                    WireUpClientsGridView();
                    FrmMain.Instance.ToolStripLabel.Text = "Se agregó el cliente de manera correcta.";
                }
                else
                {
                    FrmMain.Instance.ToolStripLabel.Text = "Ha ocurrido un error al agregar el cliente, inténtelo nuevamente.";
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        private void AddButton_Click_1(object sender, EventArgs e)
        {
            if (IdLabel.Text.Equals("none"))
            {
                if (!string.IsNullOrEmpty(NameTextBox.Text) && !string.IsNullOrEmpty(LastNameTextBox.Text))
                {
                    DateTime fecha = DateTime.Now;

                    if (ClientManagement.InsertClient(NameTextBox.Text, LastNameTextBox.Text, IdTypeComboBox.SelectedItem.ToString(),
                                                      IdentificationTextBox.Text, EmailTextBox.Text, BornDateTimePicker.Value, fecha))
                    {
                        FrmMain.Instance.ToolStripLabel.Text = "Se agrego el Cliente correctamente.";
                        Clear();
                        ReloadClient();
                    }
                    else
                    {
                        FrmMain.Instance.ToolStripLabel.Text = "Error! No se pudo agregar el Cliente.";
                    }
                }
                else
                {
                }
            }
        }
Ejemplo n.º 3
0
        //--------------------Metodos de actualizaciones-------------------------

        private void ReloadClient()
        {
            clientModels = ClientManagement.SelectAllClients();
            ClientDataGridView.MultiSelect = false;
            ClientDataGridView.DataSource  = clientModels;

            ClientDataGridView.Columns["Id_Client"].AutoSizeMode           = DataGridViewAutoSizeColumnMode.AllCells;
            ClientDataGridView.Columns["Name"].AutoSizeMode                = DataGridViewAutoSizeColumnMode.Fill;
            ClientDataGridView.Columns["LastName"].AutoSizeMode            = DataGridViewAutoSizeColumnMode.Fill;
            ClientDataGridView.Columns["Identification_Type"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            ClientDataGridView.Columns["Identification"].AutoSizeMode      = DataGridViewAutoSizeColumnMode.AllCells;
            ClientDataGridView.Columns["Email"].AutoSizeMode               = DataGridViewAutoSizeColumnMode.AllCells;
            ClientDataGridView.Columns["Born_Date"].AutoSizeMode           = DataGridViewAutoSizeColumnMode.AllCells;
            ClientDataGridView.Columns["Registration_Date"].AutoSizeMode   = DataGridViewAutoSizeColumnMode.AllCells;

            ClientDataGridView.Columns["Id_Client"].HeaderText           = "Id";
            ClientDataGridView.Columns["Name"].HeaderText                = "Nombre";
            ClientDataGridView.Columns["LastName"].HeaderText            = "Apellidos";
            ClientDataGridView.Columns["Identification_Type"].HeaderText = "Tipo de Identificación";
            ClientDataGridView.Columns["Identification"].HeaderText      = "Identificación";
            ClientDataGridView.Columns["Email"].HeaderText               = "Correo electronico";
            ClientDataGridView.Columns["Born_Date"].HeaderText           = "Fecha de Nacimiento";
            ClientDataGridView.Columns["Registration_Date"].HeaderText   = "Fecha de Registro";

            ClientDataGridView.Columns["Id_Client"].Visible = false;
            ClientDataGridView.Columns["Born_Date"].DefaultCellStyle.Format         = "d";
            ClientDataGridView.Columns["Registration_Date"].DefaultCellStyle.Format = "d";

            ClientDataGridView.Columns["Born_Date"].DefaultCellStyle.Alignment         = DataGridViewContentAlignment.MiddleCenter;
            ClientDataGridView.Columns["Registration_Date"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            ClientDataGridView.Columns["Identification"].DefaultCellStyle.Alignment    = DataGridViewContentAlignment.MiddleCenter;
        }
Ejemplo n.º 4
0
        private void updateButton_Click(object sender, EventArgs e)
        {
            string id       = clientsGridView.CurrentRow.Cells[0].Value.ToString();
            string name     = txtNameClient.Text;
            string lastname = txtLastnameClient.Text;
            string idType   = cmbIdentificationType.Text;
            string identif  = txtIdentification.Text;
            string bornDate = datepBornDate.Text;
            string email    = txtEmailClient.Text;

            try
            {
                if (ClientManagement.UpdateClientById(id, name, lastname, identif, idType, email, bornDate))
                {
                    Clear();
                    WireUpClientsGridView();
                    FrmMain.Instance.ToolStripLabel.Text = "Se modificó el cliente de manera correcta.";
                }
                else
                {
                    FrmMain.Instance.ToolStripLabel.Text = "Ha ocurrido un error al modificar el cliente, inténtelo nuevamente.";
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 5
0
 private void ModifyButton_Click_1(object sender, EventArgs e)
 {
     if (!IdLabel.Text.Equals("none"))
     {
         if (!string.IsNullOrEmpty(NameTextBox.Text) && !string.IsNullOrEmpty(LastNameTextBox.Text) &&
             ClientDataGridView.CurrentRow.Cells[0].Value.ToString() != null)
         {
             if (MetroMessageBox.Show(this, $"¿Seguro que desea modificar al cliente: { ClientDataGridView.CurrentRow.Cells[1].Value.ToString() }?", "Modificar cliente", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
             {
                 if (ClientManagement.UpdateClientById(int.Parse(IdLabel.Text), NameTextBox.Text, LastNameTextBox.Text, IdTypeComboBox.SelectedItem.ToString(),
                                                       IdentificationTextBox.Text, EmailTextBox.Text, BornDateTimePicker.Value))
                 {
                     FrmMain.Instance.ToolStripLabel.Text = "Se modifico el cliente correctamente.";
                     Clear();
                     ReloadClient();
                 }
                 else
                 {
                     MetroMessageBox.Show(this, $"Ha ocurrido un error al modificar al cliente: { NameTextBox.Text}.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
         else
         {
         }
     }
 }
Ejemplo n.º 6
0
        public ActionResult Index()
        {
            ClientManagement clients = new ClientManagement();

            clients.Clients = unitOfWork.ClientRepository.GetClients((int)Session["UserId"]).ToList();

            return(View(clients));
        }
Ejemplo n.º 7
0
        public void Sort_shouldReturn_SortedbyBankAccount()
        {
            ClientManagement sortedList = new ClientManagement();

            CreateObjects();
            sortedList.ShowClients = clientManagement.Sort(3);
            Assert.IsTrue(sortedList.ShowClients[0] == client1 && sortedList.ShowClients[1] == client3 && sortedList.ShowClients[2] == client2);
        }
Ejemplo n.º 8
0
 public TestController()
 {
     _audit  = new AuditManagement();
     _user   = new UserManagement();
     _menu   = new MenuManagement();
     _role   = new RoleManagement();
     _client = new ClientManagement();
     _brand  = new BrandManagement();
 }
Ejemplo n.º 9
0
 private void UcAparts_Load(object sender, EventArgs e)
 {
     employeeComboBox.DataSource    = EmployeeManagement.SelectAllEmployees();
     employeeComboBox.DisplayMember = "Name";
     StoreComboBox.DataSource       = BusinessManagement.SelectAllBusiness();
     StoreComboBox.DisplayMember    = "fantasyName";
     clientComboBox.DataSource      = ClientManagement.SelectAllClients();
     clientComboBox.DisplayMember   = "Name";
     WrapProductsGridView();
 }
Ejemplo n.º 10
0
 public DolphinController()
 {
     _audit    = new AuditManagement();
     _user     = new UserManagement();
     _menu     = new MenuManagement();
     _role     = new RoleManagement();
     _client   = new ClientManagement();
     _brand    = new BrandManagement();
     _terminal = new TerminalManagement();
     _incident = new IncidentManagement();
 }
Ejemplo n.º 11
0
 private void GrdClientManagement_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (cliWindow is null)
     {
         cliWindow = new ClientManagement()
         {
             Owner = this
         }
     }
     ;
     lblContents.Content = cliWindow.Content;
     Title = "Client Management Window";
 }
Ejemplo n.º 12
0
        private void SearchTextBox_ButtonClick(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(SearchTextBox.Text))
            {
                ClientDataGridView.DataSource = ClientManagement.SelectMultipleClients(SearchTextBox.Text);

                FrmMain.Instance.ToolStripLabel.Text = "Lista de Clientes cargada correctamente.";
                Clear();
            }
            else
            {
                FrmMain.Instance.ToolStripLabel.Text = "Error! El campo buscar no puede ser vacio.";
            }
        }
Ejemplo n.º 13
0
 public GuiController()
 {
     mainMenu             = new MainMenu();
     administrationMenu   = new AdministrationMenu();
     vehicleMenuToAddData = new VehicleMenuToAddData();
     dataEditingMenu      = new DataEditingMenu();
     dataDeleteMenu       = new DataDeleteMenu();
     rentMenu             = new RentMenu();
     getInfoMenu          = new GetInfoMenu();
     searchInfoMenu       = new SearchInfoMenu();
     functionsForSQL      = new FunctionsCheckEnteredAndSQLData();
     functionsForBike     = new BikeManagement();
     functionsForCar      = new CarManagement();
     functionsForMoto     = new MotoManagement();
     functionsForClient   = new ClientManagement();
     sqlInsert            = new SQLInsert();
     sqlEdit   = new SQLEdit();
     sqlDelete = new SQLDelete();
 }
Ejemplo n.º 14
0
        //---------EVENTS---------//

        private void txtSearchClient_KeyPress(object sender, KeyPressEventArgs e)
        {
            string text = txtSearchClient.Text;

            try
            {
                if (text != "")
                {
                    clientsGridView.DataSource = ClientManagement.SelectClientByNameOrLastName(text);
                }
                else
                {
                    clientsGridView.DataSource = ClientManagement.SelectAllClients();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 15
0
 private void UcClient_Load(object sender, EventArgs e)
 {
     try
     {
         if (ClientManagement.SelectAllClients() != null)
         {
             clientModels = ClientManagement.SelectAllClients();
             WireUpClientsGridView();
             FrmMain.Instance.ToolStripLabel.Text = "Los registros de la base de datos fueron cargados.";
         }
         else
         {
             FrmMain.Instance.ToolStripLabel.Text = "No se encontraron registros en la base de datos.";
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Ejemplo n.º 16
0
        private void deleteButton_Click(object sender, EventArgs e)
        {
            string idClient = clientsGridView.CurrentRow.Cells[0].Value.ToString();

            try
            {
                if (ClientManagement.DeleteClientById(idClient))
                {
                    Clear();
                    WireUpClientsGridView();
                    FrmMain.Instance.ToolStripLabel.Text = "Se eliminó el cliente de manera correcta.";
                }
                else
                {
                    FrmMain.Instance.ToolStripLabel.Text = "Ha ocurrido un error al eliminar el cliente, inténtelo nuevamente.";
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 17
0
        private void DeleteButton_Click_1(object sender, EventArgs e)
        {
            if (!IdLabel.Text.Equals("none"))
            {
                if (!string.IsNullOrEmpty(NameTextBox.Text) && !string.IsNullOrEmpty(LastNameTextBox.Text))
                {
                    int Id = int.Parse(IdLabel.Text);

                    if (ClientManagement.DeleteClientById(Id))
                    {
                        FrmMain.Instance.ToolStripLabel.Text = "Se elimino el Cliente correctamente.";
                        Clear();
                        ReloadClient();
                    }
                    else
                    {
                        FrmMain.Instance.ToolStripLabel.Text = "Error! No se pudo eliminar el Cliente.";
                    }
                }
                else
                {
                }
            }
        }
Ejemplo n.º 18
0
 private void NewButton_Click_1(object sender, EventArgs e)
 {
     Clear();
     clientModels = ClientManagement.SelectAllClients();
     ClientDataGridView.DataSource = clientModels;
 }