public ActionResult AddUser() { try { TblUser objEditData = new TblUser { UserRoles = rr.GetAllRoles() //Tenants = tr.GetAllTenants() }; objEditData.IsMyProfile = false; return(View("AddNewUser", objEditData)); } catch (Exception ex) { newException.AddException(ex); return(View("AddNewUser")); } }
public void LoadRoleData() { RolesRepository rrir = new RolesRepository(); Session["RoleData"] = rrir.GetAllRoles(); GridView1.DataSource = Session["RoleData"]; GridView1.DataBind(); lblrecordcount.Text = string.Format("{0} : {1}", rrir.Rolescount().ToString().ToFarsiNumber(), Resources.DashboardText.RecordCount); lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["RoleData"] as DataTable).Rows.Count.ToString().ToFarsiNumber(), Resources.DashboardText.SelectRecordCount); }
public ActionResult AddTenantUser(int id) { try { TblUser objUserData = new TblUser { UserRoles = rr.GetAllRoles(), Tenants = tr.GetAllTenants() }; objUserData.TenantId = id; return(View(objUserData)); } catch (Exception ex) { newException.AddException(ex); return(View()); } }
public IndexRolesForm() { InitializeComponent(); try { dataGridView1.Rows.Clear(); dataGridView1.Refresh(); Roles = RolesRepository.GetAllRoles(); foreach (var item in Roles) { int index = dataGridView1.Rows.Add(item.Id, item.Nombre, item.Activo); dataGridView1.Rows[index].Cells[3].Value = "Editar"; } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
public ActionResult MyProfile() { TblUser objEditData = new TblUser(); LMSBL.DBModels.TblUser model = new LMSBL.DBModels.TblUser(); model = (LMSBL.DBModels.TblUser)Session["UserSession"]; try { List <TblUser> userDetails = new List <TblUser>(); userDetails = ur.GetUserById(model.UserId); objEditData = userDetails[0]; objEditData.UserRoles = rr.GetAllRoles(); //objEditData.Tenants = tr.GetAllTenants(); objEditData.IsMyProfile = true; } catch (Exception ex) { newException.AddException(ex); } return(View("Profile", objEditData)); }
public DataTable GetRole(string username, string password) { WebServiceAccountsRepository webir = new WebServiceAccountsRepository(); WebServiceAccount currentuser = webir.FindByUserName(username); if (currentuser != null) { if (currentuser.Password == password) { RolesRepository depir = new RolesRepository(); return(depir.GetAllRoles()); } else { return(null); } } else { return(null); } }
public void loadform() { try { DepartmentsRepository depir = new DepartmentsRepository(); DataTable dep = depir.GetAllDepartment(); foreach (DataRow dr in dep.Rows) { ddldep.Items.Add(new ListItem(dr["DepartmentTitle"].ToString(), dr["DepartmentID"].ToString())); } RolesRepository roleir = new RolesRepository(); DataTable role = roleir.GetAllRoles(); foreach (DataRow dr in role.Rows) { ddlrole.Items.Add(new ListItem(dr["RoleTitle"].ToString(), dr["RoleID"].ToString())); } } catch { Redirector.Goto(Redirector.PageName.errorpage); } }
/** * GET request that get all roles */ public List <role> Get() { return(repository.GetAllRoles()); }
public void loadform(string empid) { try { DepartmentsRepository depir = new DepartmentsRepository(); DataTable dep = depir.GetAllDepartment(); foreach (DataRow dr in dep.Rows) { ddldep.Items.Add(new ListItem(dr["DepartmentTitle"].ToString(), dr["DepartmentID"].ToString())); } RolesRepository roleir = new RolesRepository(); DataTable role = roleir.GetAllRoles(); foreach (DataRow dr in role.Rows) { ddlrole.Items.Add(new ListItem(dr["RoleTitle"].ToString(), dr["RoleID"].ToString())); } VEmployeesRepository vstir = new VEmployeesRepository(); VEmployee emp = vstir.FindByid(empid.ToInt()); if (emp != null) { lblempid.Text = emp.EmployeeID.ToString(); txtname.Text = emp.FirstName; txtlastname.Text = emp.LastName; RadioButtonList1.SelectedValue = emp.Gender.ToString(); txtnationalcode.Text = emp.NationalCode; lbldep.Text = emp.DepartmentTitle; lblrole.Text = emp.RoleTitle; lblusername.Text = emp.Username.ToString(); if (txtpass.Text != null) { txtpass.Text = emp.Password.ToString(); } // ImageButton1.ImageUrl = emp.ImageFileName; Session["newdep"] = emp.DepartmentID.ToString(); Session["pass"] = emp.Password.ToString(); Session["newrole"] = emp.RoleID.ToString(); chkActiveAccount.Checked = (emp.Status.Value == 0 ? true : false); Session["imageurl"] = emp.ImageFileName.ToString(); if (Session["imageurl"].ToString() != null) { ImageButton2.ImageUrl = "~/file/" + emp.ImageFileName; } } else { Redirector.Goto(Redirector.PageName.errorpage); } } catch { Redirector.Goto(Redirector.PageName.errorpage); } }
public IActionResult GetAll() { return(Ok(_rolesRepository.GetAllRoles())); }