Пример #1
0
        private void btnSeleccionar_Click(object sender, EventArgs e)
        {
            if (IdDocumento == -3)
            {
                string var = string.Empty;

                foreach (var item in dgvDatos.Selected.Rows)
                {
                    var = Convert.ToString(item.Cells["DocEntry"].Value);
                    DocKey.Add(var);
                }

                this.DialogResult = System.Windows.Forms.DialogResult.Yes;
            }
            else if (IdDocumento == -2 | IdDocumento == -6 | IdDocumento == -8)
            {
                foreach (var item in dgvDatos.Selected.Rows)
                {
                    DocKeys ojb = new DocKeys();

                    ojb.DocEntry = Convert.ToString(item.Cells["DocEntry"].Value);
                    ojb.DocType  = Convert.ToString(item.Cells["ObjType"].Value);
                    seleccionados.Add(ojb);
                }

                this.DialogResult = System.Windows.Forms.DialogResult.Yes;
            }
        }
Пример #2
0
        private void dgvDatos_DoubleClickCell(object sender, Infragistics.Win.UltraWinGrid.DoubleClickCellEventArgs e)
        {
            try
            {
                if (IdDocumento == 1 || IdDocumento == 10008 || IdDocumento == 10009)
                {
                    if (IdDocumento == 1)
                    {
                        Tipo = Convert.ToString(dgvDatos.Rows[e.Cell.Row.Index].Cells["Tipo"].Value);
                    }

                    DocEntry = Convert.ToInt32(dgvDatos.Rows[e.Cell.Row.Index].Cells["Número de documento"].Value);

                    this.DialogResult = System.Windows.Forms.DialogResult.Yes;
                }
                if (IdDocumento == 8 || IdDocumento == 9)
                {
                    DocEntry = Convert.ToInt32(dgvDatos.Rows[e.Cell.Row.Index].Cells["Número de documento"].Value);
                    Tipo     = Convert.ToString(dgvDatos.Rows[e.Cell.Row.Index].Cells["Doc"].Value);

                    this.DialogResult = System.Windows.Forms.DialogResult.Yes;
                }
                else if (IdDocumento == -1 | IdDocumento == -5 | IdDocumento == -7)
                {
                    string var = string.Empty;
                    var = Convert.ToString(dgvDatos.Rows[e.Cell.Row.Index].Cells["CardCode"].Value);

                    DocKey.Add(var);

                    Row = (from item in source.AsEnumerable()
                           where item.Field <string>("CardCode").Equals(var)
                           select item).FirstOrDefault();

                    this.DialogResult = System.Windows.Forms.DialogResult.Yes;
                }
                else if (IdDocumento == -2 | IdDocumento == -3 | IdDocumento == -6 | IdDocumento == -8)
                {
                    string var = string.Empty;

                    // dgvDatos.Selected.

                    //foreach (var item in dgvDatos.Selected.Rows)
                    //{
                    var = Convert.ToString(dgvDatos.ActiveRow.Cells["DocEntry"].Value);
                    DocKey.Add(var);
                    //}

                    this.DialogResult = System.Windows.Forms.DialogResult.Yes;
                }
                else if (IdDocumento == -4)
                {
                    ItemCode = Convert.ToString(dgvDatos.ActiveRow.Cells[0].Value);

                    this.DialogResult = System.Windows.Forms.DialogResult.Yes;
                }
            }
            catch (Exception)
            {
            }
        }