private void Rolgrid_SelectionChanged(object sender, EventArgs e) { if (Rolgrid.CurrentRow != null && Rolgrid.CurrentRow.Cells["Rol"].Value != null && Rolgrid.CurrentRow.Cells["Rol"].Value != System.DBNull.Value) { AktifRol = (mymodel.myenum.GorevTuru)Enum.Parse(typeof(mymodel.myenum.GorevTuru), Rolgrid.CurrentRow.Cells["Rol"].Value.ToString()); IsHaklarigrid.DataSource = PrepareIsHaklari(AktifRol, 0); } else { IsHaklarigrid.DataSource = PrepareIsHaklari(AktifRol, 0); } }
private DataTable GetRolEkranHakki(mymodel.myenum.GorevTuru aktifrol) { DataTable dtrolekran = new DataTable(); if (aktifrol != 0) { Condition[] con = new Condition[1]; con[0].Field = "Rol"; con[0].Value = aktifrol; con[0].Operator = System.Operator.Equal; dtrolekran = Persistence.ReadListTable(typeof(RolHakki), new string[] { "*" }, con, null, 100); } else { dtrolekran = Persistence.ReadListTable(typeof(RolHakki), new string[] { "*" }, null, null, 100); } return(dtrolekran); }
private DataTable PrepareIsHaklari(mymodel.myenum.GorevTuru rolu, int isYeriObjId) { DataTable isHaklariTable = new DataTable(); isHaklariTable.Columns.AddRange( new DataColumn[] { new DataColumn("Id", typeof(int)), new DataColumn("Hak", typeof(string)), new DataColumn("Var", typeof(bool)), //new DataColumn("Engelle",typeof(bool)), new DataColumn("Aktif", typeof(bool)) }); System.Array haklar = Enum.GetValues(typeof(mymodel.myenum.Hak)); foreach (mymodel.myenum.Hak hak in haklar) { if (hak != mymodel.myenum.Hak.Undefined) { // Undefined hakkını eklemeye gerek yok DataRow row = isHaklariTable.NewRow(); string name = Enum.GetName(typeof(mymodel.myenum.Hak), hak); int p = name.IndexOf("_"); row["Id"] = (int)hak; row["Hak"] = (p >= 0 ? name.Substring(p + 1) : name); row["Var"] = false; //row["Engelle"] = false; row["Aktif"] = true; isHaklariTable.Rows.Add(row); } } isHaklariTable.AcceptChanges(); RolHakki[] isHaklari = null; if (rolu > 0) { Condition[] con = new Condition[1]; con[0].Field = "Rol"; con[0].Operator = System.Operator.Equal; con[0].Value = rolu.ToString(); isHaklari = Persistence.ReadList <RolHakki>(new string[] { "*" }, con, null, 100); } else { isHaklari = Persistence.ReadList <RolHakki>(new string[] { "*" }, null, null, 100); } foreach (RolHakki hak in isHaklari) { DataRow[] rows = isHaklariTable.Select("Id=" + ((int)hak.Hak).ToString()); if (rows.Length > 0) { rows[0]["Aktif"] = hak.Aktif; //rows[0]["RolHakki.Id"] = hak.Id; rows[0]["Var"] = hak.Var; //rows[0]["Engelle"] = hak.Engelle; } } isHaklariTable.AcceptChanges(); return(isHaklariTable); }
private void Rolgrid_SelectionChanged(object sender, EventArgs e) { if (Rolgrid.CurrentRow != null && Rolgrid.CurrentRow.Cells["Rol"].Value!=null && Rolgrid.CurrentRow.Cells["Rol"].Value != System.DBNull.Value) { AktifRol = (mymodel.myenum.GorevTuru)Enum.Parse(typeof(mymodel.myenum.GorevTuru), Rolgrid.CurrentRow.Cells["Rol"].Value.ToString()); IsHaklarigrid.DataSource = PrepareIsHaklari(AktifRol, 0); } else IsHaklarigrid.DataSource = PrepareIsHaklari(AktifRol, 0); }