/// <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 int Select(DataTable table, string fieldname, ref string deger) { int result = 0; SimpleTreeLookup lookup = new SimpleTreeLookup(); lookup.StartPosition = FormStartPosition.CenterScreen; bstumtanimlar.DataSource = table; lookup.GridTumTeshis.DataSource = bstumtanimlar; lookup.ShowDialog(); if (lookup.DialogResult == DialogResult.OK) { result = 0; //if (lookup.GridTumTeshis.CurrentRow != null && Convert.ToInt32(lookup.GridTumTeshis.CurrentRow.Cells["Id"].Value) > 0) //{ // result = Convert.ToInt32(lookup.GridTumTeshis.CurrentRow.Cells["Id"].Value); // deger = lookup.GridTumTeshis.CurrentRow.Cells[fieldname].Value.ToString(); //} if (bstumtanimlar.Current != null && Convert.ToInt32((bstumtanimlar.Current as DataRowView)["Id"]) > 0) { result = Convert.ToInt32((bstumtanimlar.Current as DataRowView)["Id"]); deger = (bstumtanimlar.Current as DataRowView)[fieldname].ToString(); } } lookup.Dispose(); return(result); }
/// <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 int Select(DataTable table, string fieldname, ref string deger) { int result = 0; SimpleTreeLookup lookup = new SimpleTreeLookup(); lookup.StartPosition = FormStartPosition.CenterScreen; bstumtanimlar.DataSource = table; lookup.GridTumTeshis.DataSource = bstumtanimlar; lookup.ShowDialog(); if (lookup.DialogResult == DialogResult.OK) { result = 0; //if (lookup.GridTumTeshis.CurrentRow != null && Convert.ToInt32(lookup.GridTumTeshis.CurrentRow.Cells["Id"].Value) > 0) //{ // result = Convert.ToInt32(lookup.GridTumTeshis.CurrentRow.Cells["Id"].Value); // deger = lookup.GridTumTeshis.CurrentRow.Cells[fieldname].Value.ToString(); //} if (bstumtanimlar.Current != null && Convert.ToInt32((bstumtanimlar.Current as DataRowView)["Id"]) > 0) { result = Convert.ToInt32((bstumtanimlar.Current as DataRowView)["Id"]); deger = (bstumtanimlar.Current as DataRowView)[fieldname].ToString(); } } lookup.Dispose(); return result; }
public static int Select(DataTable table) { int result = 0; SimpleTreeLookup lookup = new SimpleTreeLookup(); lookup.StartPosition = FormStartPosition.CenterScreen; bstumtanimlar.DataSource = table; lookup.GridTumTeshis.DataSource = bstumtanimlar; lookup.ShowDialog(); if (lookup.DialogResult == DialogResult.OK) { result = 0; if (bstumtanimlar.Current!=null && Convert.ToInt32((bstumtanimlar.Current as DataRowView)["Id"])>0) { result = Convert.ToInt32((bstumtanimlar.Current as DataRowView)["Id"]); } } lookup.Dispose(); return result; }
public static int Select(DataTable table) { int result = 0; SimpleTreeLookup lookup = new SimpleTreeLookup(); lookup.StartPosition = FormStartPosition.CenterScreen; bstumtanimlar.DataSource = table; lookup.GridTumTeshis.DataSource = bstumtanimlar; lookup.ShowDialog(); if (lookup.DialogResult == DialogResult.OK) { result = 0; if (bstumtanimlar.Current != null && Convert.ToInt32((bstumtanimlar.Current as DataRowView)["Id"]) > 0) { result = Convert.ToInt32((bstumtanimlar.Current as DataRowView)["Id"]); } } lookup.Dispose(); return(result); }
public static void AddEditbuttonCommands() { long id = 0; string deger = string.Empty; Utility.EditButtonCommands.Add("EditButtonCihazModeli", new EditbuttonCommand( delegate(object nesne) { id = SimpleTreeLookup.Select(Transaction.Instance.ExecuteSql("Select Id,Adi,Kodu,Tip from LookupTable where Aktif=1 and (isnull(Adi,'')) like @prm0", ((EditButton)nesne).Text.Trim() + "%"), "Adi", ref deger); if (id > 0) { ((EditButton)nesne).Id = id; ((EditButton)nesne).Text = deger; } else { ((EditButton)nesne).Id = 0; ((EditButton)nesne).Text = ""; } })); Utility.EditButtonCommands.Add("EditButtonLokasyon", new EditbuttonCommand( delegate(object nesne) { id = SimpleTreeLookup.Select(Transaction.Instance.ExecuteSql("Select Id,Adi,Kodu from Lokasyon where Aktif=1 and (isnull(Adi,'')) like @prm0", ((EditButton)nesne).Text.Trim() + "%"), "Adi", ref deger); if (id > 0) { ((EditButton)nesne).Id = id; ((EditButton)nesne).Text = deger; } else { ((EditButton)nesne).Id = 0; ((EditButton)nesne).Text = ""; } })); Utility.EditButtonCommands.Add("EditButtonCihaz", new EditbuttonCommand( delegate(object nesne) { id = SimpleTreeLookup.Select(Transaction.Instance.ExecuteSql("Select Id,Adi,Kodu from Cihaz where Aktif=1 and (isnull(Adi,'')) like @prm0", ((EditButton)nesne).Text.Trim() + "%"), "Adi", ref deger); if (id > 0) { ((EditButton)nesne).Id = id; ((EditButton)nesne).Text = deger; } else { ((EditButton)nesne).Id = 0; ((EditButton)nesne).Text = ""; } })); Utility.EditButtonCommands.Add("EditButtonUlkeSec", new EditbuttonCommand( delegate(object nesne) { id = SimpleLookup.Select(Transaction.Instance.ExecuteSql("select Id,Adi as [Adı],Kodu from Ulke where aktif=1 and (isnull(Adi,'')) like @prm0", ((EditButton)nesne).Text.Trim() + "%"), "Adı", ref deger); if (id > 0) { ((EditButton)nesne).Id = id; ((EditButton)nesne).Text = deger; } else { ((EditButton)nesne).Id = 0; ((EditButton)nesne).Text = ""; } })); Utility.EditButtonCommands.Add("EditButtonAdres", new EditbuttonCommand( delegate(object nesne) { id = SimpleTreeLookup.Select(Transaction.Instance.ExecuteSql("Select Id,TagAdresi from Adres where Aktif=1 and (isnull(TagAdresi,'')) like @prm0", ((EditButton)nesne).Text.Trim() + "%"), "TagAdresi", ref deger); if (id > 0) { ((EditButton)nesne).Id = id; ((EditButton)nesne).Text = deger; } else { ((EditButton)nesne).Id = 0; ((EditButton)nesne).Text = ""; } })); // Utility.EditButtonCommands.Add("EditButtonAsiSec", //new EditbuttonCommand( //delegate(object nesne) //{ // id = SimpleLookup.Select(Transaction.Instance.ExecuteSql("select Id,Adi as [Adı],Kodu from AsiTanim where aktif=1 and (isnull(Adi,'')) like @prm0", ((EditButton)nesne).Text.Trim() + "%"), "Adı", ref deger); // if (id > 0) // { // ((EditButton)nesne).Id = id; // ((EditButton)nesne).Text = deger; // } // else // { // ((EditButton)nesne).Id = 0; // ((EditButton)nesne).Text = ""; // } //})); // Utility.EditButtonCommands.Add("EditButtonHasta", //new EditbuttonCommand( //delegate(object nesne) //{ // id = SimpleLookup.Select(Transaction.Instance.ExecuteSql("Select Id,Adi+' '+Soyadi as [AdiSoyadi] from Hasta where (isnull(Adi+' '+Soyadi,'')) like @prm0", ((EditButton)nesne).Text.Trim() + "%"), "AdiSoyadi", ref deger); // if (id > 0) // { // ((EditButton)nesne).Id = id; // ((EditButton)nesne).Text = deger; // } // else // { // ((EditButton)nesne).Id = 0; // ((EditButton)nesne).Text = ""; // } //})); // Utility.EditButtonCommands.Add("EditButtonDoktorSec", // new EditbuttonCommand( // delegate(object nesne) // { // id = SimpleLookup.Select(Transaction.Instance.ExecuteSql("select Id,Adi+' '+Soyadi as [AdiSoyadi] from Doktor where (isnull(Adi+' '+Soyadi,'')) like @prm0", ((EditButton)nesne).Text.Trim() + "%"), "AdiSoyadi", ref deger); // if (id > 0) // { // ((EditButton)nesne).Id = id; // ((EditButton)nesne).Text = deger; // } // else // { // ((EditButton)nesne).Id = 0; // ((EditButton)nesne).Text = ""; // } // })); Utility.EditButtonCommands.Add("EditButtonIlSec", new EditbuttonCommand( delegate(object nesne) { id = SimpleLookup.Select(Transaction.Instance.ExecuteSql("select Id,Adi as [Adi] from il where Adi like @prm0", ((EditButton)nesne).Text.Trim() + "%"), "Adi", ref deger); if (id > 0) { ((EditButton)nesne).Id = id; ((EditButton)nesne).Text = deger; } else { ((EditButton)nesne).Id = 0; ((EditButton)nesne).Text = ""; } })); // Utility.EditButtonCommands.Add("EditButtonHasta2", //new EditbuttonCommand( //delegate(object nesne) //{ // SimpleLookup.CommandName = "EditButtonHasta2"; // id = SimpleLookup.Select(Transaction.Instance.ExecuteSql("Select Id,Adi+' '+Soyadi as [AdiSoyadi],CONVERT(NVarChar,TckNo) as TckNo,Adi,Soyadi from Hasta where (isnull(Adi+' '+Soyadi,'')) like @prm0", ((EditButton)nesne).Text.Trim() + "%"), "AdiSoyadi", ref deger); // if (id > 0) // { // ((EditButton)nesne).Id = id; // ((EditButton)nesne).Text = deger; // } // else // { // ((EditButton)nesne).Id = 0; // ((EditButton)nesne).Text = ""; // } //})); }