Esempio n. 1
0
        public ActionResult SaveRole(int?id, string verId)
        {
            var role = new ProductRole()
            {
                RoleVerId = verId
            };

            if (id.HasValue)
            {
                role = ProductRoleVerService.GetRole(id.Value);
            }
            return(View(role));
        }
Esempio n. 2
0
 public OpResult SaveRole(ProductRole obj)
 {
     if (obj.Id == 0)
     {
         obj.RoleId    = ProductRoleRepository.GetMaxInt(o => o.RoleId, whereLambda: o => o.RoleVerId == obj.RoleVerId);
         obj.CreateDT  = DateTime.Now;
         obj.CreateUID = CurrentUser.UID;
         ProductRoleRepository.Add(obj, false);
     }
     else
     {
         var role = ProductRoleRepository.Get(obj.Id);
         role.Title = obj.Title;
     }
     ProductRoleRepository.SaveChanges();
     return(OpResult.Success());
 }
Esempio n. 3
0
        public OpResult SaveRole(string roleVerId, string moduleId, int?productId, string title)
        {
            if (ProductRoleVerRepository.IsExists(o => o.ProductId == productId && o.Status == 0 && o.RoleVerId != roleVerId))
            {
                return(OpResult.Fail("已存在未发布的版本"));
            }
            var verId = roleVerId.IsNullOrEmpty() ? CommonService.GUID : roleVerId;

            if (ProductRoleRepository.IsExists(o => o.RoleVerId == verId && o.Title == title))
            {
                return(OpResult.Fail("该角色已存在!"));
            }
            var role = new ProductRole()
            {
                Title     = title,
                RoleVerId = verId,
                RoleId    = ProductRoleRepository.GetMaxInt(o => o.RoleId, whereLambda: o => o.RoleVerId == verId),
                CreateDT  = DateTime.Now,
                CreateUID = CurrentUser.UID
            };
            var ver = ProductRoleVerRepository.Find(o => o.RoleVerId == verId);

            if (ver == null)
            {
                ver = new ProductRoleVer()
                {
                    ModuleId  = moduleId,
                    ProductId = productId.GetValueOrDefault(),
                    RoleVerId = verId,
                };
                ver.UpdateDT  = ver.CreateDT = role.CreateDT;
                ver.UpdateUID = ver.CreateUID = role.CreateUID;
                ProductRoleVerRepository.Add(ver, false);
            }
            else
            {
                ver.ModuleId = moduleId;
            }
            ProductRoleRepository.Add(role, false);
            ProductRoleRepository.SaveChanges();
            return(OpResult.Success(data: new{ verId = verId, roleId = role.RoleId }));
        }
Esempio n. 4
0
        public void OpenTanFromTaskSheetAsACurator()
        {
            var tanNumber   = "34584855V";
            var application = TestApp.GetInstance();

            AppWindows.Init(application);

            var loginWindow = AppWindows.Login;

            loginWindow.SetPassword("R@M$4554");
            ProductRole role = new ProductRole {
                RoleId = 1, RoleName = "Curator"
            };

            loginWindow.SetRole(role);
            loginWindow.DoLogin();

            var mainWindow = AppWindows.Main;

            try
            {
                mainWindow.OpenTaskSheet();
            }
            catch (Exception)
            {
            }
            var taskWindow = AppWindows.TaskWindow;

            taskWindow.DoubleClickOnRow("UserTasksGrid", tanNumber);
            try
            {
                mainWindow.CreateReactionAfter();
            }
            catch (Exception)
            {
            }
            Thread.Sleep(8000);
            //AppWindows.PdfReader.CompletPdf();

            application.Close();
            application.Dispose();
        }
Esempio n. 5
0
 public ActionResult SaveRole(ProductRole obj)
 {
     return(new OpActionResult(ProductRoleVerService.SaveRole(obj)));
 }
Esempio n. 6
0
        public void SetRole(ProductRole role)
        {
            var selectbax = GetSelectBox("cmbRoles");

            selectbax.SetValue(role);
        }