// MARCAS
    private void data_gridMarca()
    {
        tb_pt_marcaBL BL = new tb_pt_marcaBL();
        tb_pt_marca BE = new tb_pt_marca();
        DataTable dt = new DataTable();

        switch (cmb_marca.SelectedValue)
        {
            case "01":
                BE.marcaid = txt_buscar2.Text.Trim().ToUpper();
                break;
            case "02":
                BE.marcaname = txt_buscar2.Text.Trim().ToUpper();
                break;
            default:
                //**
                break;
        }
        try
        {
            //Eliminar Columnas Actuales(Opcional):
            dgb_marca.Columns.Clear();
            dgb_marca.Width = 535;
            //Objeto Columna:
            CommandField image;
            //Crear Columna:
            image = new CommandField();
            image.ButtonType = ButtonType.Image;
            image.SelectImageUrl = "~/Images/go-search.png";
            image.ShowSelectButton = true;
            image.ItemStyle.Width = 10;
            image.ItemStyle.Wrap = true;
            dgb_marca.Columns.Add(image);

            BoundField MARCAID;
            MARCAID = new BoundField();
            MARCAID.DataField = "marcaid";
            MARCAID.HeaderText = "CODIGO";
            MARCAID.ItemStyle.Width = 50;
            dgb_marca.Columns.Add(MARCAID);

            BoundField MARCANAME;
            MARCANAME = new BoundField();
            MARCANAME.DataField = "marcaname";
            MARCANAME.HeaderText = "MARCA";
            MARCANAME.ItemStyle.Width = 250;
            dgb_marca.Columns.Add(MARCANAME);

            dt = BL.GetAll(Session["ssEmpresaID"].ToString(), BE).Tables[0];
            if (dt.Rows.Count > 0)
            {
                dgb_marca.DataSource = dt;
                dgb_marca.DataBind();
                dgb_marca.Visible = true;
            }
        }
        catch (Exception ex)
        {
            throw ex;// ClientMessage(ex.Message);
        }
    }
 void CargarCmbMarca()
 {
     tb_pt_marcaBL BL = new tb_pt_marcaBL();
     tb_pt_marca BE = new tb_pt_marca();
     DataTable dt = new DataTable();
     dt = BL.GetAll(EmpresaID, BE).Tables[0];
     if (dt.Rows.Count > 0)
     {
         cmb_marca01.DataSource = dt;
         cmb_marca01.ValueMember = "marcaid";
         cmb_marca01.DisplayMember = "marcaname";
         cmb_marca01.SelectedIndex = -1;
     }
 }
        private void ValidaMarca()
        {
            if (marcaid.Text.Trim().Length > 0)
            {
                tb_pt_marcaBL BL = new tb_pt_marcaBL();
                tb_pt_marca BE = new tb_pt_marca();
                DataTable dt = new DataTable();

                BE.marcaid = marcaid.Text.Trim().PadLeft(2, '0');

                dt = BL.GetAll(EmpresaID, BE).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    marcaid.Text = dt.Rows[0]["marcaid"].ToString().Trim();
                    marcaname.Text = dt.Rows[0]["marcaname"].ToString().Trim();
                }
                else
                {
                    marcaid.Text = "";
                    marcaname.Text = "";
                }
            }
            else
            {
                marcaid.Text = "";
                marcaname.Text = "";
            }
        }
        private void btn_editar_Click(object sender, EventArgs e)
        {
            if (XNIVEL == "0" || XNIVEL == "1")
            {
                ssModo = "EDIT";
                form_bloqueado(true);
                articname.Focus();

                btn_cancelar.Enabled = true;
                btn_grabar.Enabled = true;
                btn_foto.Enabled = true;
                btnVer.Enabled = true;

                var BE = new tb_pt_marca();
                var BL = new tb_pt_marcaBL();
                var dt = new DataTable();
                BE.marcaid = marcaid.Text.Trim();
                dt = BL.GetAll(EmpresaID, BE).Tables[0];
                foreach (DataRow row in dt.Rows)
                {
                    _xmarcadescort = row["marcadescort"].ToString();
                }

                var BE2 = new tb_pt_linea();
                var BL2 = new tb_pt_lineaBL();
                var dt2 = new DataTable();
                BE2.lineaid = lineaid.Text.Trim();
                dt2 = BL2.GetAll(EmpresaID, BE2).Tables[0];
                foreach (DataRow row in dt2.Rows)
                {
                    _xlineadescort = row["lineadescort"].ToString();
                }

                var BE3 = new tb_pt_modelo();
                var BL3 = new tb_pt_modeloBL();
                var dt3 = new DataTable();
                BE3.modeloid = modeloid.Text.Trim();
                dt3 = BL3.GetAll(EmpresaID, BE3).Tables[0];
                foreach (DataRow row in dt3.Rows)
                {
                    _xmodelodescort = row["modelodescort"].ToString();
                }

                if (XNIVEL == "1")
                {
                    bloqueo_paneles(false);
                    pnl_01.Enabled = true;
                    pnl_03.Enabled = true;
                }
                else
                {
                    bloqueo_paneles(true);
                    pnl_02.Enabled = false;
                    pnl_05.Enabled = false;
                    pnl_06.Enabled = false;
                    pnl_03.Enabled = true;
                }
            }
        }
 private void Valida_Marca(String xcod)
 {
     var BE = new tb_pt_marca();
     var BL = new tb_pt_marcaBL();
     var dt = new DataTable();
     BE.marcaid = xcod.Trim();
     dt = BL.GetAll(EmpresaID, BE).Tables[0];
     if (dt.Rows.Count > 0)
     {
         foreach (DataRow row in dt.Rows)
         {
             if (row["marcadescort"].ToString().Trim() != string.Empty)
             {
                 _xmarcadescort = row["marcadescort"].ToString();
             }
             else
             {
                 _xmarcadescort = row["marcaname"].ToString();
             }
             marcaid.Text = row["marcaid"].ToString();
             marcaname.Text = row["marcaname"].ToString();
             _xmarcaidold = row["marcaidold"].ToString();
         }
     }
     else
     {
         _xmarcadescort = string.Empty;
         marcaid.Text = string.Empty;
         marcaname.Text = string.Empty;
         _xmarcaidold = string.Empty;
     }
 }
        private void Valida_Marca(String xcod)
        {
            var BE = new tb_pt_marca();
            var BL = new tb_pt_marcaBL();
            var dt = new DataTable();
            BE.marcaid = xcod.Trim();
            dt = BL.GetAll(EmpresaID, BE).Tables[0];
            if (dt.Rows.Count > 0)
            {
                marcaid.Text = dt.Rows[0]["marcaid"].ToString();
                marcaname.Text = dt.Rows[0]["marcaname"].ToString();

                if (dt.Rows[0]["marcadescort"].ToString().Trim() == string.Empty)
                {
                    _xmarcadescort = dt.Rows[0]["marcaname"].ToString();
                }
                else
                {
                    _xmarcadescort = dt.Rows[0]["marcadescort"].ToString();
                }
            }
            else
            {
                _xmarcadescort = string.Empty;
                marcaid.Text = string.Empty;
                marcaname.Text = string.Empty;
            }
        }
        private void data_Tablamarca()
        {
            try
            {
                if (Tablamarca.Rows.Count > 0)
                {
                    Tablamarca.Rows.Clear();
                }
                var BL = new tb_pt_marcaBL();
                var BE = new tb_pt_marca();

                BE.marcaname = txt_criterio.Text.Trim().ToUpper();

                Tablamarca = BL.GetAll(EmpresaID, BE).Tables[0];

                if (Tablamarca.Rows.Count > 0)
                {
                    btn_excel.Enabled = true;
                    gridmarca.DataSource = Tablamarca;
                    gridmarca.Rows[0].Selected = false;
                    gridmarca.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }