Exemplo n.º 1
0
        public static int Select(DataTable table)
        {
            int result = 0;

            SimpleLookup lookup = new SimpleLookup();
            lookup.StartPosition = FormStartPosition.CenterScreen;
            lookup.grid.DataSource = table;
            lookup.ShowDialog();

            if (lookup.DialogResult == DialogResult.OK)
            {
                result = 0;
                if (lookup.grid.CurrentRow != null && Convert.ToInt32(lookup.grid.CurrentRow.Cells["Id"].Value) > 0)
                {
                    result = Convert.ToInt32(lookup.grid.CurrentRow.Cells["Id"].Value);
                }
            }
            lookup.Dispose();

            return result;
        }
Exemplo n.º 2
0
        public static int Select(DataTable table)
        {
            int result = 0;

            SimpleLookup lookup = new SimpleLookup();

            lookup.StartPosition   = FormStartPosition.CenterScreen;
            lookup.grid.DataSource = table;
            lookup.ShowDialog();

            if (lookup.DialogResult == DialogResult.OK)
            {
                result = 0;
                if (lookup.grid.CurrentRow != null && Convert.ToInt32(lookup.grid.CurrentRow.Cells["Id"].Value) > 0)
                {
                    result = Convert.ToInt32(lookup.grid.CurrentRow.Cells["Id"].Value);
                }
            }
            lookup.Dispose();

            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Editbuttonlar için sadece id ve isim lazım boşuna entityi okumaya gerek yok "deger" parametresi bize adi gibi istenen değeri döndersin
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public static long Select(DataTable table, string fieldname, ref string deger)
        {
            long result = 0;

            SimpleLookup lookup = new SimpleLookup();

            lookup.StartPosition = FormStartPosition.CenterScreen;
            dt = table;
            lookup.grid.DataSource = dt;
            if (lookup.grid.Columns.Contains("Id"))
            {
                lookup.grid.Columns["Id"].Visible = false;
            }

            if (CommandName == "EditButtonHasta2")
            {
                if (lookup.grid.Columns.Contains("AdiSoyadi"))
                {
                    lookup.grid.Columns["AdiSoyadi"].Visible = false;
                }
            }
            lookup.ShowDialog();



            if (lookup.DialogResult == DialogResult.OK)
            {
                result = 0;
                if (lookup.grid.CurrentRow != null && Convert.ToInt64(lookup.grid.CurrentRow.Cells["Id"].Value) > 0)
                {
                    result = Convert.ToInt64(lookup.grid.CurrentRow.Cells["Id"].Value);
                    deger  = lookup.grid.CurrentRow.Cells[fieldname].Value.ToString();
                }
            }
            CommandName = string.Empty;
            lookup.Dispose();

            return(result);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Editbuttonlar için sadece id ve isim lazım boşuna entityi okumaya gerek yok "deger" parametresi bize adi gibi istenen değeri döndersin
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        public static long Select(DataTable table, string fieldname, ref string deger)
        {
            long result = 0;

            SimpleLookup lookup = new SimpleLookup();
            lookup.StartPosition = FormStartPosition.CenterScreen;
            dt = table;
            lookup.grid.DataSource = dt;
            if (lookup.grid.Columns.Contains("Id"))
                lookup.grid.Columns["Id"].Visible = false;

            if (CommandName == "EditButtonHasta2")
            {
                if (lookup.grid.Columns.Contains("AdiSoyadi"))
                    lookup.grid.Columns["AdiSoyadi"].Visible = false;
            }
            lookup.ShowDialog();

            if (lookup.DialogResult == DialogResult.OK)
            {
                result = 0;
                if (lookup.grid.CurrentRow != null && Convert.ToInt64(lookup.grid.CurrentRow.Cells["Id"].Value) > 0)
                {
                    result = Convert.ToInt64(lookup.grid.CurrentRow.Cells["Id"].Value);
                    deger = lookup.grid.CurrentRow.Cells[fieldname].Value.ToString();
                }
            }
            CommandName = string.Empty;
            lookup.Dispose();

            return result;
        }