protected void Button1_Click(object sender, EventArgs e) { if (cboRoles.SelectedValue == "") { lblErr.Text = "Nao ha mais perfis disponiveis para este usuario"; lblErr.Visible = true; } else { if (userId != 0) { // Create object UsersInRole userInRoles = new UsersInRole(); userInRoles.UserId = userId; userInRoles.RoleId = Convert.ToInt16(cboRoles.SelectedValue); userInRoles.CompanyId = Company.CompanyId; // Fires Insert UsersInRolesManager uManager = new UsersInRolesManager(this); uManager.Insert(userInRoles); //Refresh the Combo and Grid cboRoles.DataBind(); grdRolesByUser.DataBind(); // Refresh the menu if (User.Identity.UserId == userId) Page.ClientScript.RegisterStartupScript(this.GetType(), "ResetMenu", "top.ResetMenu();", true); } } }
protected void Button1_Click(object sender, EventArgs e) { if (cboRoles.SelectedValue == "") { lblErr.Text = "Nao ha mais perfis disponiveis para este usuario"; lblErr.Visible = true; } else { if (userId != 0) { // Create object UsersInRole userInRoles = new UsersInRole(); userInRoles.UserId = userId; userInRoles.RoleId = Convert.ToInt16(cboRoles.SelectedValue); userInRoles.CompanyId = Company.CompanyId; // Fires Insert UsersInRolesManager uManager = new UsersInRolesManager(this); uManager.Insert(userInRoles); //Refresh the Combo and Grid cboRoles.DataBind(); grdRolesByUser.DataBind(); // Refresh the menu if (User.Identity.UserId == userId) { Page.ClientScript.RegisterStartupScript(this.GetType(), "ResetMenu", "top.ResetMenu();", true); } } } }
public UsersInRolesCollection Get(string usr, int companyID, string getBy) { switch (getBy) { case "username": return(UsersInRolesManager.GetRolesbyUserName(usr, companyID)); default: return(UsersInRolesManager.GetbyUser(usr, companyID)); } }
/// <summary> /// Method to add a USER in a determined ROLE /// </summary> /// <param name="userId"></param> /// <param name="companyId"></param> /// <param name="roleId"></param> private void AddUserInRoles(int userId, int companyId, int roleId) { var newUserInRoles = new UsersInRole(); var userInRolesManager = new UsersInRolesManager(this); newUserInRoles.UserId = userId; newUserInRoles.RoleId = roleId; newUserInRoles.CompanyId = companyId; userInRolesManager.Insert(newUserInRoles); }
public void Delete(string userName, int CompanyID, string deleteby) { UsersInRolesManager.DeleteItemByUsername(userName, CompanyID); }
// DELETE api/<controller>/5 /// <summary> /// Deletes the specified identifier. /// </summary> /// <param name="id">The identifier.</param> public void Delete(String id) { UsersInRolesManager.DeleteItem(id); }
// GET api/<controller> /// <summary> /// Gets this instance. /// </summary> /// <returns></returns> public UsersInRolesCollection PutSearch(string method, [FromBody] SearchFilter value) { return(UsersInRolesManager.Search(value)); }
// PUT api/<controller>/5 /// <summary> /// Puts the specified identifier. /// </summary> /// <param name="id">The identifier.</param> /// <param name="value">The value.</param> /// <returns></returns> /// <exception cref="HttpResponseException"></exception> public UsersInRoles Put(string id, [FromBody] UsersInRoles value) { return(UsersInRolesManager.UpdateItem(value)); }
// POST api/<controller> /// <summary> /// Posts the specified value. /// </summary> /// <param name="value">The value.</param> /// <returns></returns> public UsersInRoles Post([FromBody] UsersInRoles value) { return(UsersInRolesManager.AddItem(value)); }
// GET api/<controller>/5 /// <summary> /// Gets the specified COM group identifier. /// </summary> /// <param name="UsersInRolesId">The COM group identifier.</param> /// <returns></returns> public UsersInRoles Get(String Username, int CompanyID) { return(UsersInRolesManager.GetItemByID(Username, CompanyID)); }
public UsersInRolesCollection GetbyUser(string usr, int CompanyID) { return(UsersInRolesManager.GetbyUser(usr, CompanyID)); }
// GET api/<controller> /// <summary> /// Gets this instance. /// </summary> /// <returns></returns> public UsersInRolesCollection Get(int CompanyID) { return(UsersInRolesManager.GetAllItem(CompanyID)); }