public void NUnit_DataPermission_Domain_Add()
        {
            Sys_DataPermissionServices service = new Sys_DataPermissionServices();
            bool result = true;
            int countSC = 0;
            for (int i = 1; i <= 10; i++)
            {

                var model = new Sys_DataPermission
                {
                    Id = i,
                    Code = i.ToString(),
                    GroupID = 1,
                    UserID = 1
                };
             var   result1 = service.Add<Sys_DataPermission>(model);
                NUnit.Framework.Assert.IsTrue(result);
                if (result == true)
                {
                    countSC += 1;
                    Console.WriteLine("Process Success >>> Create >>> " + model.Id
                        + " | " + model.Code
                        );
                }
            }
            Console.WriteLine("Total success record: " + countSC);
        }
        public void NUnit_DataPermission_Domain_Add()
        {
            Sys_DataPermissionServices service = new Sys_DataPermissionServices();
            bool result  = true;
            int  countSC = 0;

            for (int i = 1; i <= 10; i++)
            {
                var model = new Sys_DataPermission
                {
                    Id      = i,
                    Code    = i.ToString(),
                    GroupID = 1,
                    UserID  = 1
                };
                var result1 = service.Add <Sys_DataPermission>(model);
                NUnit.Framework.Assert.IsTrue(result);
                if (result == true)
                {
                    countSC += 1;
                    Console.WriteLine("Process Success >>> Create >>> " + model.Id
                                      + " | " + model.Code
                                      );
                }
            }
            Console.WriteLine("Total success record: " + countSC);
        }
        public void NUnit_DataPermission_Domain_Get()
        {
            Sys_DataPermissionServices service = new Sys_DataPermissionServices();
            var repo = service.GetAllUseEntity <Sys_DataPermission>(ref status);

            Console.Write("Total Record: " + repo.Count());
        }
 public void NUnit_DataPermission_Domain_GetById()
 {
     Sys_DataPermissionServices service = new Sys_DataPermissionServices();
     var model = new Sys_DataPermission { Id = 3 };
     var result = service.GetById<Sys_DataPermission>(model.Id, ref status) as Sys_DataPermission;
     NUnit.Framework.Assert.IsNotNull(result);
     Console.Write("SearchResult: " + result.Id
         + " | " + result.Code
         + " | " + result.UserID
         + " | " + result.GroupID
         );
 }
        public void NUnit_DataPermission_Domain_GetById()
        {
            Sys_DataPermissionServices service = new Sys_DataPermissionServices();
            var model = new Sys_DataPermission {
                Id = 3
            };
            var result = service.GetById <Sys_DataPermission>(model.Id, ref status) as Sys_DataPermission;

            NUnit.Framework.Assert.IsNotNull(result);
            Console.Write("SearchResult: " + result.Id
                          + " | " + result.Code
                          + " | " + result.UserID
                          + " | " + result.GroupID
                          );
        }
        public void NUnit_DataPermission_Domain_Delete()
        {
            Sys_DataPermissionServices service = new Sys_DataPermissionServices();
            int rs    = 0;
            var model = new Sys_DataPermission {
                Id = 3
            };
            var result = service.Delete <Sys_DataPermission>(model.Id);

            //   NUnit.Framework.Assert.IsTrue(result);
            if (result == ActionStatus.DeleteSucceed.ToString())
            {
                rs += 1;
                Console.WriteLine("Process Success >>> Delete >>> " + model.Id);
            }
        }
Esempio n. 7
0
        // GET api/<controller>/5
        public Sys_DataPermissionModel Get(Guid id)
        {
            var service        = new Sys_DataPermissionServices();
            var result         = service.GetById <Sys_DataPermissionEntity>(id, ref status);
            var DataPermission = new Sys_DataPermissionModel
            {
                ID      = result.ID,
                Code    = result.Code,
                UserID  = result.UserID,
                GroupID = result.GroupID,
                //Branches = result.Branches,
                DataGroups = result.DataGroups,
                WorkPlace  = result.WorkPlace
            };

            return(DataPermission);
        }
Esempio n. 8
0
        // GET api/<controller>
        /// <summary>
        /// Lấy tất cả dữ liệu
        /// </summary>
        /// <returns></returns>
        public IEnumerable <Sys_DataPermissionModel> Get()
        {
            var service = new Sys_DataPermissionServices();
            var list    = service.GetDataNotParam <Sys_DataPermissionEntity>(ConstantSql.hrm_system_sp_get_DataPermission, UserLogin, ref status);

            return(list.Select(item => new Sys_DataPermissionModel
            {
                ID = item.ID,
                Code = item.Code,
                UserName = item.UserName,
                GroupName = item.GroupName,
                UserID = item.UserID,
                GroupID = item.GroupID,
                //Branches = item.Branches,
                DataGroups = item.DataGroups
            }));
        }
Esempio n. 9
0
        public Sys_DataPermissionModel Post([FromBody] Sys_DataPermissionModel model)
        {
            var service = new Sys_DataPermissionServices();

            var dataPermissionExist = service.CheckDuplicateDataPermission(model.UserID, model.GroupID);

            if (dataPermissionExist.ID != Guid.Empty)
            {
                model.ID = dataPermissionExist.ID;
            }

            byte[] branches = null;
            if (model.Branches != null)
            {
                branches = model.Branches.ToBinary();
            }

            var entity = new Sys_DataPermissionEntity
            {
                ID           = model.ID,
                Code         = model.Code,
                Branches     = branches,
                GroupID      = model.GroupID,
                UserID       = model.UserID,
                DataGroup    = model.DataGroup,
                DataGroups   = model.DataGroups,
                OrgStructure = model.OrgStructure,
                WorkPlace    = model.WorkPlace
            };

            if (model.ID != Guid.Empty)
            {
                model.ID = model.ID;
                service.Edit <Sys_DataPermissionEntity>(entity);
            }
            else
            {
                service.Add <Sys_DataPermissionEntity>(entity);
                model.ID = entity.ID;
            }

            return(model);
        }
 public void NUnit_DataPermission_Domain_Edit()
 {
     Sys_DataPermissionServices service = new Sys_DataPermissionServices();
     var model = new Sys_DataPermission
     {
         Id = 3,
         Code = "3",
         UserID = 1,
         GroupID = 1
     };
     var result = service.Edit<Sys_DataPermission>(model);
    // NUnit.Framework.Assert.IsTrue(result);
     if (result == ActionStatus.EditSucceed.ToString())
     {
         Console.WriteLine("Process Success >>> Update >>> " + model.Id
                 + " | " + model.Code
                 + " | " + model.UserID
                 + " | " + model.GroupID
                 );
     }
 }
        public void NUnit_DataPermission_Domain_Edit()
        {
            Sys_DataPermissionServices service = new Sys_DataPermissionServices();
            var model = new Sys_DataPermission
            {
                Id      = 3,
                Code    = "3",
                UserID  = 1,
                GroupID = 1
            };
            var result = service.Edit <Sys_DataPermission>(model);

            // NUnit.Framework.Assert.IsTrue(result);
            if (result == ActionStatus.EditSucceed.ToString())
            {
                Console.WriteLine("Process Success >>> Update >>> " + model.Id
                                  + " | " + model.Code
                                  + " | " + model.UserID
                                  + " | " + model.GroupID
                                  );
            }
        }
Esempio n. 12
0
 // DELETE api/<controller>/5
 public void Delete(Guid id)
 {
     var service = new Sys_DataPermissionServices();
     var result  = service.Delete <Sys_DataPermissionEntity>(id);
 }
 public void NUnit_DataPermission_Domain_Get()
 {
     Sys_DataPermissionServices service = new Sys_DataPermissionServices();
     var repo = service.GetAllUseEntity<Sys_DataPermission>(ref status);
     Console.Write("Total Record: " + repo.Count());
 }
 public void NUnit_DataPermission_Domain_Delete()
 {
     Sys_DataPermissionServices service = new Sys_DataPermissionServices();
     int rs = 0;
     var model = new Sys_DataPermission { Id = 3 };
     var result = service.Delete<Sys_DataPermission>(model.Id);
  //   NUnit.Framework.Assert.IsTrue(result);
     if (result == ActionStatus.DeleteSucceed.ToString())
     {
         rs += 1;
         Console.WriteLine("Process Success >>> Delete >>> " + model.Id);
     }
 }