protected void FillTableRequestRegistry()
    {
        VehicleBusiness vb = new VehicleBusiness();
        User currentUser = (User)Session["USER"];
        DataTable userVehiclesTable = vb.GetVehiclesFromUser(currentUser);

        foreach (DataRow dr in userVehiclesTable.Rows)
        {
            TableRow tr = new TableRow();
            tr.ForeColor = System.Drawing.Color.Black;
            int counterCells = 0;

            foreach (DataColumn dc in userVehiclesTable.Columns)
            {
                TableCell tc = new TableCell();
                if (counterCells >= 2)
                {

                }
                else
                {
                    try
                    {
                        bool isMoto = (bool)dr[dc.ColumnName];
                        if (isMoto)
                        {
                            tc.Text = string.Format("M");
                        }
                        else
                        {
                            tc.Text = string.Format("VL");
                        }
                    }
                    catch (Exception)
                    {
                        tc.Text = string.Format(dr[dc.ColumnName].ToString());
                    }

                    tr.Cells.Add(tc);
                }

                counterCells++;
                TableRequestRegistry.Rows.Add(tr);

            }
        }
    }
    protected void FillTableUserVehicles()
    {
        string idToButton = "";
        VehicleBusiness vb = new VehicleBusiness();
        User currentUser = (User)Session["USER"];
        DataTable userVehiclesTable = vb.GetVehiclesFromUser(currentUser);

        TableRow firstRow = new TableRow();

        for (int i = 0; i < 4; i++)
        {
            int counterCells = 0;
            TableCell tc = new TableCell();
            switch (counterCells)
            {
                case 0:
                tc.Text = "Placa";
                break;
                case 1:
                tc.Text = "Marca";
                break;
                case 2:
                tc.Text = "Tipo";
                break;
                case 3:
                tc.Text = "Acción";
                break;
            }
            firstRow.Cells.Add(tc);
        }
        TableRegistryVehicles.Rows.Add(firstRow);

        foreach (DataRow dr in userVehiclesTable.Rows)
        {
            TableRow tr = new TableRow();
            int counterCells = 0;

            foreach (DataColumn dc in userVehiclesTable.Columns)
            {
                TableCell tc = new TableCell();
                if (counterCells == 0)
                {
                    idToButton = dr[dc.ColumnName].ToString().Trim();
                }
                if (counterCells == 3)
                {
                    Button updateBtn = new Button();
                    updateBtn.Click += new System.EventHandler(btnEditVehicle_Click);
                    updateBtn.Text = "Editar";
                    updateBtn.ID = idToButton + "e";
                    updateBtn.CssClass = "btn-warning";

                    Button deleteBtn = new Button();
                    deleteBtn.Click += new System.EventHandler(btnDeleteVehicle_Click);
                    deleteBtn.Text = "Borrar";
                    deleteBtn.ID = idToButton + "d";
                    deleteBtn.CssClass = "btn-danger";
                    tc.Controls.Add(updateBtn);
                    tc.Controls.Add(deleteBtn);
                    tr.Cells.Add(tc);
                }
                else
                {
              try
                    {
                        bool isMoto = (bool)dr[dc.ColumnName];
                        if (isMoto)
                        {
                            tc.Text = string.Format("M");
                        }
                        else
                        {
                            tc.Text = string.Format("VL");
                        }
                    }
                    catch (Exception)
                    {
                        tc.Text = string.Format(dr[dc.ColumnName].ToString().Trim());
                    }
                    tr.Cells.Add(tc);
                }
                counterCells++;
                TableRegistryVehicles.Rows.Add(tr);
            }
        }
    }
    protected string SendMail()
    {
        string status = "";
        User currentUser = (User)Session["USER"];
        RegistryBusiness registrybusiness = new RegistryBusiness();
        VehicleBusiness vb = new VehicleBusiness();
        DataTable userVehiclesTable = vb.GetVehiclesFromUser(currentUser);

        MailMessage mail = new MailMessage("*****@*****.**", currentUser.Email);
        mail.Subject = "Activación de Marchamo";

        string htmlimg = "<img src=\"http://latinatest.azurewebsites.net/img/ulatinalogoverde.png\"/><br><br>";
        string messageBody = htmlimg;

        string htmlIntro = "ID: " + currentUser.Id + "<br>" + "Nombre: " + currentUser.Name + "<br>" +
        "Apellido(s): " + currentUser.Lastname + "<br>" + "<br><font>Vehiculos Registrados:</font><br><br>";
        string htmlTableStart = "<table style=\"border-collapse:collapse; text-align:center;\" >";
        string htmlTableEnd = "</table>";
        string htmlHeaderRowStart = "<tr style =\"background-color:#6FA1D2; color:#ffffff;\">";
        string htmlHeaderRowEnd = "</tr>";
        string htmlTrStart = "<tr style =\"color:#555555;\">";
        string htmlTrEnd = "</tr>";
        string htmlTdStart = "<td style=\" border-color:#5c87b2; border-style:solid; border-width:thin; padding: 5px;\">";
        string htmlTdEnd = "</td>";

        messageBody += htmlIntro;
        messageBody += htmlTableStart;
        messageBody += htmlHeaderRowStart;
        messageBody += htmlTdStart + "Placa" + htmlTdEnd;
        messageBody += htmlTdStart + "Marca" + htmlTdEnd;
        messageBody += htmlHeaderRowEnd;

        foreach (DataRow Row in userVehiclesTable.Rows)
        {
            int counterCells = 0;
            messageBody = messageBody + htmlTrStart;

            foreach (DataColumn dc in userVehiclesTable.Columns)
            {
                if (counterCells >= 2)
                {

                }
                else
                {
                    messageBody = messageBody + htmlTdStart + Row[dc.ColumnName].ToString().Trim() + htmlTdEnd;
                }
                counterCells++;

            }

            messageBody = messageBody + htmlTrEnd;
        }
        messageBody = messageBody + htmlTableEnd;

        mail.Body = messageBody;
        mail.IsBodyHtml = true;
        status = registrybusiness.EmailForActivationRegistry(currentUser.Email, mail);

        return status;
    }