protected void Page_Load(object sender, EventArgs e) { //SELECT user.BsnNumber,user.EmailAdress, user.FirstName,user.LastName from user where user.Confirmed=0 if (!IsPostBack) { Messager.Text = ""; Messager.Visible = false; loggedinUser = Session["User"] as Entities.User; if (loggedinUser != null) { try { UserGrid.DataSource = dBUserConnection.getPendingUsers(loggedinUser); UserGrid.DataBind(); ListBoxUsers.DataSource = dBUserConnection.GetAllUsers(loggedinUser); ListBoxUsers.DataTextField = "FirstName"; ListBoxUsers.DataValueField = "BsnNumber"; ListBoxUsers.DataBind(); DAL.DBRoleConnection dBRoleConnection = new DAL.DBRoleConnection(); ListBoxRoles.DataSource = dBRoleConnection.GetRoles(); ListBoxRoles.DataTextField = "Description"; ListBoxRoles.DataValueField = "RoleID"; ListBoxRoles.DataBind(); ListBoxUserTherapist.DataSource = ListBoxUsers.DataSource; ListBoxUserTherapist.DataTextField = "FirstName"; ListBoxUserTherapist.DataValueField = "BsnNumber"; ListBoxUserTherapist.DataBind(); ListBoxTherapist.DataSource = dBUserConnection.GetAllUsersWithRole(loggedinUser); ListBoxTherapist.DataTextField = "FirstName"; ListBoxTherapist.DataValueField = "ID"; ListBoxTherapist.DataBind(); ListboxFunctionRoles.DataSource = dBRoleConnection.GetRoles(); ListboxFunctionRoles.DataTextField = "Description"; ListboxFunctionRoles.DataValueField = "RoleID"; ListboxFunctionRoles.DataBind(); RoleGrid.DataSource = dBRoleConnection.GetRights(); RoleGrid.DataBind(); } catch (Exception ex) { showMessage(ex.Message); } } } }
protected void Page_Load(object sender, EventArgs e) { if ((User)Session["User"] != null) { DAL.DBRoleConnection dBRoleConnection = new DAL.DBRoleConnection(); Entities.Role role = dBRoleConnection.GetUserRights((User)Session["User"]); if (role.ShowNewTherapy == true) { if (!IsPostBack) { DAL.DBTherapyConnection dBTherapy = new DAL.DBTherapyConnection(); List <Therapy> therapy = dBTherapy.GetTherapiesFromTherapist((User)Session["User"]); List <AgendaItem> agendaItems = ConvertTherapyToAcceptedAgendaItems(therapy); ActivityAgendaTherapist.DataSource = agendaItems; ActivityAgendaTherapist.TimeFormat = DayPilot.Web.Ui.Enums.TimeFormat.Clock24Hours; ActivityAgendaTherapist.StartDate = DateTime.Now; ActivityAgendaTherapist.Days = 7; ActivityAgendaTherapist.DataTextField = "Description"; ActivityAgendaTherapist.DataStartField = "StartTime"; ActivityAgendaTherapist.DataEndField = "EndTime"; ActivityAgendaTherapist.DataIdField = "ID"; ActivityAgendaTherapist.ShowToolTip = true; ActivityAgendaTherapist.DataBind(); List <Therapy> newListTherapies = new List <Therapy>(); foreach (var item in therapy) { if (!item.Accepted) { newListTherapies.Add(item); } } } } else { ActivityAgendaTherapist.Visible = false; ActivityAgendaTherapist.Enabled = false; } } else { ActivityAgendaTherapist.Visible = false; ActivityAgendaTherapist.Enabled = false; } }
protected void ChangeRoleBtn_Click(object sender, EventArgs e) { try { Role role = new Role(); foreach (GridViewRow row in RoleGrid.Rows) { CheckBox ck = ((CheckBox)row.FindControl("ItemCheckBoxRole")); if (ck.Checked && ck.Visible) { var a = row.Cells[1].Text; if (a == "ShowOwnDeseases") { role.ShowOwnDeseases = true; } if (a == "ShowOwnTherapies") { role.ShowOwnTherapies = true; } if (a == "ShowAllDeseases") { role.ShowAllDeseases = true; } if (a == "ShowAllTherapies") { role.ShowAllTherapies = true; } if (a == "ShowNewTherapy") { role.ShowNewTherapy = true; } if (a == "ShowNewDesease") { role.ShowNewDesease = true; } if (a == "ShowNewMedication") { role.ShowNewMedication = true; } if (a == "ShowOwnMedication") { role.ShowOwnMedication = true; } if (a == "ShowNewRapport") { role.ShowNewRapport = true; } if (a == "ShowOwnRapports") { role.ShowOwnRapports = true; } if (a == "ShowAllRapports") { role.ShowAllRapports = true; } if (a == "ChangeClientNAW") { role.Management = true; } if (a == "ShowAllMedications") { role.ShowAllMedications = true; } role.Description = ListboxFunctionRoles.SelectedItem.Text; role.RoleID = Convert.ToInt32(ListboxFunctionRoles.SelectedValue); } else { //Code if it is not checked ......may not be required } } DAL.DBRoleConnection dBRoleConnection = new DAL.DBRoleConnection(); string result = dBRoleConnection.ChangeRole(Session["User"] as Entities.User, role); showMessage(result); } catch (Exception ex) { showMessage(ex.Message); } }