protected void SaveChanges_Click(object sender, EventArgs e)
 {
     try
     {
         int Group_Id      = int.Parse(ddlGroups.SelectedValue.ToString());
         var Permision_Ids = PermissionGroupGridView.GetSelectedFieldValues("Permission_Id");
         db.Database.ExecuteSqlCommand("Delete Permission_Group where Group_Id = " + Group_Id);
         for (int i = 0; i < Permision_Ids.Count; i++)
         {
             Permission_Group per_group = db.Permission_Group.Create();
             per_group.Group_Id      = Group_Id;
             per_group.Permission_Id = int.Parse(Permision_Ids[i].ToString());
             db.Permission_Group.Add(per_group);
         }
         db.SaveChanges();
     }catch { }
 }
Exemplo n.º 2
0
 protected void SaveChanges_Click(object sender, EventArgs e)
 {
     try
     {
         int Group_Id      = int.Parse(ddlGroups.SelectedValue.ToString());
         var Permision_Ids = PermissionGroupGridView.GetSelectedFieldValues("Permission_Id");
         db.Database.ExecuteSqlCommand("Delete Permission_Group where Group_Id = " + Group_Id);
         for (int i = 0; i < Permision_Ids.Count; i++)
         {
             Permission_Group per_group = db.Permission_Group.Create();
             per_group.Group_Id      = Group_Id;
             per_group.Permission_Id = int.Parse(Permision_Ids[i].ToString());
             db.Permission_Group.Add(per_group);
         }
         db.SaveChanges();
         /* Add it to log file */
         LogData = "data:" + JsonConvert.SerializeObject(Group_Id, logFileModule.settings);
         logFileModule.logfile(10, "تعديل صلاحيات المجموعة", "update group permissions", LogData);
     }
     catch { }
 }