using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using LLNet.Utils;
using LLNet.GUI;

namespace LLNet.Tienda.MainForms.Finders
{
    /// <summary>
    /// Summary description for frmFindCustomerFEAssociation.
    /// </summary>
    public class frmFindCustomerFEAssociation : GUI.FormBases.frmBase
    {
        private SimpleButton simpleButton1;
        private SimpleButton simpleButton2;
        private PanelControl panelControl3;
        private PanelControl panelControl2;
        private DevExpress.XtraGrid.GridControl gridControl1;
        private LLNet.Model.PDV.DsPDV dsPDV1;
        private DevExpress.XtraGrid.Views.Grid.GridView gridView1;
        private TextEdit txtSearch;
        private PanelControl panelControl1;
        private DevExpress.XtraGrid.Columns.GridColumn colSOCIO_ALTERNO;
        private DevExpress.XtraGrid.Columns.GridColumn colNOMBRE;
        private DevExpress.XtraGrid.Columns.GridColumn colNOMBRE_COMERCIAL;
        private DevExpress.XtraGrid.Columns.GridColumn colNIT;
        private DevExpress.XtraGrid.Columns.GridColumn colTELEFONOS;
        private DevExpress.XtraGrid.Columns.GridColumn colEMAIL;
        private DevExpress.XtraGrid.Columns.GridColumn colSOCIO;
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;

        public frmFindCustomerFEAssociation()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            GUI.CApp.TraducirForm(this);

        }

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.simpleButton1 = new DevExpress.XtraEditors.SimpleButton();
            this.simpleButton2 = new DevExpress.XtraEditors.SimpleButton();
            this.panelControl3 = new DevExpress.XtraEditors.PanelControl();
            this.panelControl2 = new DevExpress.XtraEditors.PanelControl();
            this.gridControl1 = new DevExpress.XtraGrid.GridControl();
            this.dsPDV1 = new LLNet.Model.PDV.DsPDV();
            this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
            this.colSOCIO_ALTERNO = new DevExpress.XtraGrid.Columns.GridColumn();
            this.colNOMBRE = new DevExpress.XtraGrid.Columns.GridColumn();
            this.colNOMBRE_COMERCIAL = new DevExpress.XtraGrid.Columns.GridColumn();
            this.colNIT = new DevExpress.XtraGrid.Columns.GridColumn();
            this.colTELEFONOS = new DevExpress.XtraGrid.Columns.GridColumn();
            this.colEMAIL = new DevExpress.XtraGrid.Columns.GridColumn();
            this.colSOCIO = new DevExpress.XtraGrid.Columns.GridColumn();
            this.txtSearch = new DevExpress.XtraEditors.TextEdit();
            this.panelControl1 = new DevExpress.XtraEditors.PanelControl();
            ((System.ComponentModel.ISupportInitialize)(this.panelControl3)).BeginInit();
            this.panelControl3.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.panelControl2)).BeginInit();
            this.panelControl2.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.gridControl1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.dsPDV1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtSearch.Properties)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.panelControl1)).BeginInit();
            this.panelControl1.SuspendLayout();
            this.SuspendLayout();
            // 
            // simpleButton1
            // 
            this.simpleButton1.Appearance.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.simpleButton1.Appearance.Options.UseFont = true;
            this.simpleButton1.Appearance.Options.UseTextOptions = true;
            this.simpleButton1.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
            this.simpleButton1.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
            this.simpleButton1.Dock = System.Windows.Forms.DockStyle.Right;
            this.simpleButton1.Image = global::LLNet.Tienda.Properties.Resources.ni0043_36_verde;
            this.simpleButton1.Location = new System.Drawing.Point(332, 2);
            this.simpleButton1.Name = "simpleButton1";
            this.simpleButton1.Size = new System.Drawing.Size(160, 65);
            this.simpleButton1.TabIndex = 0;
            this.simpleButton1.Text = "[F12]                                                             Aceptar";
            this.simpleButton1.Click += new System.EventHandler(this.simpleButton1_Click);
            // 
            // simpleButton2
            // 
            this.simpleButton2.Appearance.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.simpleButton2.Appearance.Options.UseFont = true;
            this.simpleButton2.Appearance.Options.UseTextOptions = true;
            this.simpleButton2.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
            this.simpleButton2.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
            this.simpleButton2.Dock = System.Windows.Forms.DockStyle.Right;
            this.simpleButton2.Image = global::LLNet.Tienda.Properties.Resources.ni0019_32;
            this.simpleButton2.Location = new System.Drawing.Point(492, 2);
            this.simpleButton2.Name = "simpleButton2";
            this.simpleButton2.Size = new System.Drawing.Size(160, 65);
            this.simpleButton2.TabIndex = 1;
            this.simpleButton2.Text = "[Esc]                                                                   Cancelar";
            this.simpleButton2.Click += new System.EventHandler(this.simpleButton2_Click);
            // 
            // panelControl3
            // 
            this.panelControl3.Controls.Add(this.simpleButton1);
            this.panelControl3.Controls.Add(this.simpleButton2);
            this.panelControl3.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.panelControl3.Location = new System.Drawing.Point(0, 326);
            this.panelControl3.Name = "panelControl3";
            this.panelControl3.Size = new System.Drawing.Size(654, 69);
            this.panelControl3.TabIndex = 5;
            // 
            // panelControl2
            // 
            this.panelControl2.Controls.Add(this.gridControl1);
            this.panelControl2.Dock = System.Windows.Forms.DockStyle.Fill;
            this.panelControl2.Location = new System.Drawing.Point(0, 40);
            this.panelControl2.Name = "panelControl2";
            this.panelControl2.Size = new System.Drawing.Size(654, 286);
            this.panelControl2.TabIndex = 4;
            // 
            // gridControl1
            // 
            this.gridControl1.DataMember = "TDA_V_CLIENTES";
            this.gridControl1.DataSource = this.dsPDV1;
            this.gridControl1.EmbeddedNavigator.Name = "";
            this.gridControl1.Location = new System.Drawing.Point(6, 0);
            this.gridControl1.MainView = this.gridView1;
            this.gridControl1.Name = "gridControl1";
            this.gridControl1.Size = new System.Drawing.Size(646, 278);
            this.gridControl1.TabIndex = 0;
            this.gridControl1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
            this.gridView1});
            this.gridControl1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.gridControl1_KeyDown);
            // 
            // dsPDV1
            // 
            this.dsPDV1.DataSetName = "DsPDV";
            this.dsPDV1.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
            // 
            // gridView1
            // 
            this.gridView1.Appearance.ColumnFilterButton.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.ColumnFilterButton.Options.UseFont = true;
            this.gridView1.Appearance.ColumnFilterButtonActive.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.ColumnFilterButtonActive.Options.UseFont = true;
            this.gridView1.Appearance.DetailTip.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.DetailTip.Options.UseFont = true;
            this.gridView1.Appearance.Empty.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.Empty.Options.UseFont = true;
            this.gridView1.Appearance.EvenRow.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.EvenRow.Options.UseFont = true;
            this.gridView1.Appearance.FilterCloseButton.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.FilterCloseButton.Options.UseFont = true;
            this.gridView1.Appearance.FilterPanel.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.FilterPanel.Options.UseFont = true;
            this.gridView1.Appearance.FixedLine.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.FixedLine.Options.UseFont = true;
            this.gridView1.Appearance.FocusedCell.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.FocusedCell.Options.UseFont = true;
            this.gridView1.Appearance.FocusedRow.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.FocusedRow.Options.UseFont = true;
            this.gridView1.Appearance.FooterPanel.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.FooterPanel.Options.UseFont = true;
            this.gridView1.Appearance.GroupButton.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.GroupButton.Options.UseFont = true;
            this.gridView1.Appearance.GroupFooter.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.GroupFooter.Options.UseFont = true;
            this.gridView1.Appearance.GroupPanel.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.GroupPanel.Options.UseFont = true;
            this.gridView1.Appearance.GroupRow.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.GroupRow.Options.UseFont = true;
            this.gridView1.Appearance.HeaderPanel.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.HeaderPanel.Options.UseFont = true;
            this.gridView1.Appearance.HideSelectionRow.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.HideSelectionRow.Options.UseFont = true;
            this.gridView1.Appearance.HorzLine.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.HorzLine.Options.UseFont = true;
            this.gridView1.Appearance.OddRow.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.OddRow.Options.UseFont = true;
            this.gridView1.Appearance.Preview.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.Preview.Options.UseFont = true;
            this.gridView1.Appearance.Row.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.Row.Options.UseFont = true;
            this.gridView1.Appearance.RowSeparator.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.RowSeparator.Options.UseFont = true;
            this.gridView1.Appearance.SelectedRow.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.SelectedRow.Options.UseFont = true;
            this.gridView1.Appearance.TopNewRow.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.TopNewRow.Options.UseFont = true;
            this.gridView1.Appearance.VertLine.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.gridView1.Appearance.VertLine.Options.UseFont = true;
            this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
            this.colSOCIO_ALTERNO,
            this.colNOMBRE,
            this.colNOMBRE_COMERCIAL,
            this.colNIT,
            this.colTELEFONOS,
            this.colEMAIL,
            this.colSOCIO});
            this.gridView1.GridControl = this.gridControl1;
            this.gridView1.GroupPanelText = "Arrastre un encabezado de columna aquí para agrupar por esa columna";
            this.gridView1.Name = "gridView1";
            this.gridView1.OptionsBehavior.Editable = false;
            this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;
            this.gridView1.OptionsView.ColumnAutoWidth = false;
            this.gridView1.OptionsView.ShowGroupPanel = false;
            this.gridView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.gridView1_KeyDown);
            this.gridView1.DoubleClick += new System.EventHandler(this.gridView1_DoubleClick);
            // 
            // colSOCIO_ALTERNO
            // 
            this.colSOCIO_ALTERNO.Caption = "Código";
            this.colSOCIO_ALTERNO.FieldName = "SOCIO_ALTERNO";
            this.colSOCIO_ALTERNO.Name = "colSOCIO_ALTERNO";
            this.colSOCIO_ALTERNO.Visible = true;
            this.colSOCIO_ALTERNO.VisibleIndex = 0;
            // 
            // colNOMBRE
            // 
            this.colNOMBRE.Caption = "Cliente";
            this.colNOMBRE.FieldName = "NOMBRE";
            this.colNOMBRE.Name = "colNOMBRE";
            this.colNOMBRE.Visible = true;
            this.colNOMBRE.VisibleIndex = 1;
            // 
            // colNOMBRE_COMERCIAL
            // 
            this.colNOMBRE_COMERCIAL.Caption = "Nombre Comercial";
            this.colNOMBRE_COMERCIAL.FieldName = "NOMBRE_COMERCIAL";
            this.colNOMBRE_COMERCIAL.Name = "colNOMBRE_COMERCIAL";
            this.colNOMBRE_COMERCIAL.Visible = true;
            this.colNOMBRE_COMERCIAL.VisibleIndex = 2;
            // 
            // colNIT
            // 
            this.colNIT.Caption = "NIT";
            this.colNIT.FieldName = "NIT";
            this.colNIT.Name = "colNIT";
            this.colNIT.Visible = true;
            this.colNIT.VisibleIndex = 3;
            // 
            // colTELEFONOS
            // 
            this.colTELEFONOS.Caption = "Teléfono";
            this.colTELEFONOS.FieldName = "TELEFONOS";
            this.colTELEFONOS.Name = "colTELEFONOS";
            this.colTELEFONOS.Visible = true;
            this.colTELEFONOS.VisibleIndex = 4;
            // 
            // colEMAIL
            // 
            this.colEMAIL.Caption = "Correo Electrónico";
            this.colEMAIL.FieldName = "EMAIL";
            this.colEMAIL.Name = "colEMAIL";
            this.colEMAIL.Visible = true;
            this.colEMAIL.VisibleIndex = 5;
            // 
            // colSOCIO
            // 
            this.colSOCIO.Caption = "SOCIO";
            this.colSOCIO.FieldName = "SOCIO";
            this.colSOCIO.Name = "colSOCIO";
            this.colSOCIO.OptionsColumn.ShowInCustomizationForm = false;
            // 
            // txtSearch
            // 
            this.txtSearch.Dock = System.Windows.Forms.DockStyle.Fill;
            this.txtSearch.Location = new System.Drawing.Point(2, 2);
            this.txtSearch.Name = "txtSearch";
            this.txtSearch.Properties.Appearance.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txtSearch.Properties.Appearance.Options.UseFont = true;
            this.txtSearch.Properties.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.txtSearch.Size = new System.Drawing.Size(650, 28);
            this.txtSearch.TabIndex = 1;
            this.txtSearch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtSearch_KeyDown);
            // 
            // panelControl1
            // 
            this.panelControl1.Controls.Add(this.txtSearch);
            this.panelControl1.Dock = System.Windows.Forms.DockStyle.Top;
            this.panelControl1.Location = new System.Drawing.Point(0, 0);
            this.panelControl1.Name = "panelControl1";
            this.panelControl1.Size = new System.Drawing.Size(654, 40);
            this.panelControl1.TabIndex = 3;
            // 
            // frmFindCustomerFEAssociation
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.ClientSize = new System.Drawing.Size(654, 395);
            this.Controls.Add(this.panelControl2);
            this.Controls.Add(this.panelControl3);
            this.Controls.Add(this.panelControl1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
            this.KeyPreview = true;
            this.Name = "frmFindCustomerFEAssociation";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Búsqueda de Clientes";
            this.Load += new System.EventHandler(this.frmFindCustomerFEAssociation_Load);
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.frmFindCustomerFEAssociation_KeyDown);
            ((System.ComponentModel.ISupportInitialize)(this.panelControl3)).EndInit();
            this.panelControl3.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.panelControl2)).EndInit();
            this.panelControl2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.gridControl1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.dsPDV1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.txtSearch.Properties)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.panelControl1)).EndInit();
            this.panelControl1.ResumeLayout(false);
            this.ResumeLayout(false);

        }
        #endregion

        public string SocioAlterno
        {
            get
            {
                if (gridView1.RowCount > 0)
                {
                    return gridView1.GetFocusedRowCellValue(colSOCIO_ALTERNO).ToString();
                }
                else
                {
                    return null;
                }
            }
        }

        public string Nombre
        {
            get
            {
                if (gridView1.RowCount > 0)
                {
                    return gridView1.GetFocusedRowCellValue(colNOMBRE).ToString();
                }
                else
                {
                    return null;
                }
            }
        }

        public string Socio
        {
            get
            {
                if (gridView1.RowCount > 0)
                {
                    return gridView1.GetFocusedRowCellValue(colSOCIO).ToString();
                }
                else
                {
                    return null;
                }
            }
        }

        public string EMail
        {
            get
            {
                if (gridView1.RowCount > 0)
                {
                    return gridView1.GetFocusedRowCellValue(colEMAIL).ToString();
                }
                else
                {
                    return null;
                }
            }
        }

        public string NIT
        {
            get
            {
                if (gridView1.RowCount > 0)
                {
                    return gridView1.GetFocusedRowCellValue(colNIT).ToString();
                }
                else
                {
                    return null;
                }
            }
        }

        private void txtSearch_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                Cursor oldCursor = Cursor.Current;
                Cursor.Current = Cursors.WaitCursor;
                Utils.QueryParams qp = new LLNet.Utils.QueryParams();
                if (GUI.CApp.GetParam("HBMM").ToString() == "X")
                {
                    qp.AddReplaceParam("BUSQUEDA", "%" + Utils.Helpers.Nvl(txtSearch.EditValue, string.Empty).ToString().ToUpper() + "%");
                }
                else
                {
                    qp.AddReplaceParam("BUSQUEDA", "%" + Utils.Helpers.Nvl(txtSearch.EditValue, string.Empty).ToString() + "%");
                }

                dsPDV1.TDA_V_CLIENTES.Clear();
                Utils.Helpers.Merge(GUI.CApp.bll.getTypedDataSet(dsPDV1.GetType(), dsPDV1.TDA_V_CLIENTES.TableName, qp, "BusquedaClientesFEAsociaciones"), dsPDV1);
                gridView1.BestFitColumns();
                gridControl1.Focus();
                Cursor.Current = oldCursor;
            }
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            string cell_value = "";
            int returned_value;


            foreach (int handle in gridView1.GetSelectedRows())
            {

                cell_value = (Convert.ToString(gridView1.GetRowCellValue(handle, colNIT)));

            }

            /*/ Emanuel Carvajal Marin /*/
            QueryParams qnit = new QueryParams();
            qnit.AddReplaceParam("NIT", cell_value);
            CApp.bll.ExecuteSql("Restriccion_edit_cf", qnit, "PDV");

            returned_value = Convert.ToInt16(CApp.bll.GetSingleValue("Restriccion_edit_cf", qnit, "PDV"));
            /*/ FIN METHOD /*/

            if (returned_value != 0)
            {
                Forms.FrmDatosProducto.validar_cf = 1;

            }
            else
            {
                Forms.FrmDatosProducto.validar_cf = 0;
            }

            DialogResult = DialogResult.OK;

        }

        private void simpleButton2_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;

        }

        private void gridView1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                simpleButton1_Click(null, null);
            }
        }

        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            simpleButton1_Click(null, null);
        }

        private void frmFindCustomerFEAssociation_Load(object sender, EventArgs e)
        {
            gridView1.BestFitColumns();
        }

        private void frmFindCustomerFEAssociation_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
                case Keys.F12:
                    simpleButton1_Click(null, null);

                    break;
                case Keys.Escape:
                    DialogResult = DialogResult.Cancel;
                    break;
                case Keys.F2:
                    txtSearch.Focus();
                    txtSearch.SelectAll();
                    break;
            }

        }

        private void gridControl1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Tab)
                txtSearch.Focus();
        }
    }
}