Exemplo n.º 1
0
        public void ActionProject_Roles(int projectId, ProjectEntity entity, string action)
        {
            Project_RoleEntity project_role = new Project_RoleEntity();

            if (entity.SelectedIDListManager != null)
            {
                foreach (var item in entity.SelectedIDListManager)
                {
                    project_role.UserId    = item;
                    project_role.ProjectId = projectId;
                    project_role.Add       = true;
                    project_role.Edit      = true;
                    project_role.Delete    = true;
                    project_role.View      = true;
                    project_role.Print     = true;
                    if (action == "add")
                    {
                        _iplProject_Role.Insert(project_role);
                    }
                    if (action == "edit")
                    {
                        var check = _iplProject_Role.ListAllByUserProject(item, projectId);
                        if (check != null && check.Count > 0)
                        {
                            _iplProject_Role.Update(project_role);
                        }
                        else
                        {
                            //chưa xong phần check xoá nếu có Id
                            _iplProject_Role.Insert(project_role);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        //[AuthorizeUser(ModuleName = "Roles", AccessLevel = Constants.Add)]
        public ActionResult InsertUser(Project_RoleEntity entity, int id)
        {
            LoadData();
            if (ModelState.IsValid)
            {
                int project_RolesId           = 0;
                Project_RoleEntity exitEntity = new Project_RoleEntity();

                exitEntity           = entity;
                exitEntity.Position  = entity.SelectPosition;
                exitEntity.UserId    = entity.SelectFullName;
                exitEntity.ProjectId = id;
                project_RolesId      = _iplProject_Roles.Insert(exitEntity);
                if (project_RolesId < 1)
                {
                    ModelState.AddModelError("SelectFullName", "Xảy ra lỗi, vui lòng liên hệ với coder");
                    return(View(entity));
                }
            }
            return(RedirectToAction("Index", new { id = id }));
        }