public void NUnit_Contract_Domain_Add()
 {
     Cat_OrgStructureTypeServices service = new Cat_OrgStructureTypeServices();
     bool result = true;
     int countSC = 0;
     for (int i = 1; i <= 10; i++)
     {
         var model = new Cat_OrgStructureType
         {
             OvertimeTypeName = "Add Tên Loại OT " + i,
             Code = "Add Mã " + i,
             OrgStructureID = 1,
             Comment = "Add Comment " + i
         };
         result = service.AddCatOrgStructureType(model);
         NUnit.Framework.Assert.IsTrue(result);
         if (result == true)
         {
             countSC += 1;
             Console.WriteLine("Process Success >>> Create >>> " + model.Id
                 + " | " + model.OvertimeTypeName
                 + " | " + model.Code
                 + " | " + model.OrgStructureID
                 + " | " + model.Comment
                 );
         }
     }
     Console.WriteLine("Total success record: " + countSC);
 }
示例#2
0
        public static Cat_OrgStructure GetNearestParent(Guid?orgId
                                                        , OrgUnit unit
                                                        , List <Cat_OrgStructure> lstAllStructure, List <Cat_OrgStructureType> lstAllOrgType)
        {
            Cat_OrgStructure     structure = lstAllStructure.Where(m => m.ID == orgId).FirstOrDefault();
            Cat_OrgStructureType orgType   = lstAllOrgType.Where(m => m.OrgStructureTypeCode == unit.ToString()).FirstOrDefault();

            if (structure == null)
            {
                return(null);
            }
            if (structure.OrgStructureTypeID == null)
            {
                return(null);
            }
            if (orgType == null)
            {
                return(null);
            }
            if (structure.OrgStructureTypeID.Value == orgType.ID || structure.ParentID == null)
            {
                return(structure);
            }
            return(GetNearestParent(structure.ParentID, unit, lstAllStructure, lstAllOrgType));
        }
        public void NUnit_Contract_Domain_Add()
        {
            Cat_OrgStructureTypeServices service = new Cat_OrgStructureTypeServices();
            bool result  = true;
            int  countSC = 0;

            for (int i = 1; i <= 10; i++)
            {
                var model = new Cat_OrgStructureType
                {
                    OvertimeTypeName = "Add Tên Loại OT " + i,
                    Code             = "Add Mã " + i,
                    OrgStructureID   = 1,
                    Comment          = "Add Comment " + i
                };
                result = service.AddCatOrgStructureType(model);
                NUnit.Framework.Assert.IsTrue(result);
                if (result == true)
                {
                    countSC += 1;
                    Console.WriteLine("Process Success >>> Create >>> " + model.Id
                                      + " | " + model.OvertimeTypeName
                                      + " | " + model.Code
                                      + " | " + model.OrgStructureID
                                      + " | " + model.Comment
                                      );
                }
            }
            Console.WriteLine("Total success record: " + countSC);
        }
 public void NUnit_Contract_Domain_GetById()
 {
     Cat_OrgStructureTypeServices service = new Cat_OrgStructureTypeServices();
     var model = new Cat_OrgStructureType { Id = 3 };
     var result = service.GetByIdCatOrgStructureType(model.Id) as Cat_OrgStructureType;
     NUnit.Framework.Assert.IsNotNull(result);
     Console.Write("SearchResult: " + result.Id
         + " | " + result.OvertimeTypeName
         + " | " + result.Code
         + " | " + result.OrgStructureID
         + " | " + result.Comment
         );
 }
        public void NUnit_Contract_Domain_GetById()
        {
            Cat_OrgStructureTypeServices service = new Cat_OrgStructureTypeServices();
            var model = new Cat_OrgStructureType {
                Id = 3
            };
            var result = service.GetByIdCatOrgStructureType(model.Id) as Cat_OrgStructureType;

            NUnit.Framework.Assert.IsNotNull(result);
            Console.Write("SearchResult: " + result.Id
                          + " | " + result.OvertimeTypeName
                          + " | " + result.Code
                          + " | " + result.OrgStructureID
                          + " | " + result.Comment
                          );
        }
        public void NUnit_Contract_Domain_Remove()
        {
            Cat_OrgStructureTypeServices service = new Cat_OrgStructureTypeServices();
            int rs    = 0;
            var model = new Cat_OrgStructureType {
                Id = 3
            };
            bool result = service.DeleteCatOrgStructureType(model.Id);

            NUnit.Framework.Assert.IsTrue(result);
            if (result == true)
            {
                rs += 1;
                Console.WriteLine("Process Success >>> Remove >>> " + model.Id);
            }
        }
        public void NUnit_Contract_Domain_Edit()
        {
            Cat_OrgStructureTypeServices service = new Cat_OrgStructureTypeServices();
            var model = new Cat_OrgStructureType
            {
                Id = 3,
                OvertimeTypeName = "Update Tên Loại OT ",
                Code             = "Update Mã ",
                OrgStructureID   = 1,
                Comment          = "Update Comment "
            };
            bool result = service.UpdateCatOrgStructureType(model);

            NUnit.Framework.Assert.IsTrue(result);
            if (result == true)
            {
                Console.WriteLine("Process Success >>> Update >>> " + model.Id
                                  + " | " + model.OvertimeTypeName
                                  + " | " + model.Code
                                  + " | " + model.OrgStructureID
                                  + " | " + model.Comment
                                  );
            }
        }
 public void NUnit_Contract_Domain_Edit()
 {
     Cat_OrgStructureTypeServices service = new Cat_OrgStructureTypeServices();
     var model = new Cat_OrgStructureType
     {
         Id = 3,
         OvertimeTypeName = "Update Tên Loại OT ",
         Code = "Update Mã ",
         OrgStructureID = 1,
         Comment = "Update Comment "
     };
     bool result = service.UpdateCatOrgStructureType(model);
     NUnit.Framework.Assert.IsTrue(result);
     if (result == true)
     {
         Console.WriteLine("Process Success >>> Update >>> " + model.Id
                 + " | " + model.OvertimeTypeName
                 + " | " + model.Code
                 + " | " + model.OrgStructureID
                 + " | " + model.Comment
                 );
     }
 }
 public void NUnit_Contract_Domain_Remove()
 {
     Cat_OrgStructureTypeServices service = new Cat_OrgStructureTypeServices();
     int rs = 0;
     var model = new Cat_OrgStructureType { Id = 3 };
     bool result = service.DeleteCatOrgStructureType(model.Id);
     NUnit.Framework.Assert.IsTrue(result);
     if (result == true)
     {
         rs += 1;
         Console.WriteLine("Process Success >>> Remove >>> " + model.Id);
     }
 }