예제 #1
0
        public void CreateDeptBusiUnit()
        {
            var deptId = Guid.NewGuid();
            var busiId = Guid.NewGuid();
            var unitId = Guid.NewGuid();

            var unit = new LocationUnit()
            {
                UnitId = unitId, UnitName = "TEST Unit 2", BusinessLocationId = busiId
            };
            var business = new LocationBusiness()
            {
                BusinessLocationId = busiId, BusinessName = "Test Business 2", DepartmentId = deptId, Unit = new List <LocationUnit>()
                {
                    unit
                }
            };
            var department = new LocationDepartment()
            {
                DepartmentId = deptId, DepatmentName = "Test Department 2", Business = new List <LocationBusiness>()
                {
                    business
                }
            };

            dFactory.Create(department);
        }
 public void UpdateLocationUnit()
 {
     try
     {
         ILocationUnit locationUnit = new LocationUnit();
         locationUnit.UnitId             = Guid.Parse("E8287DE6-39E5-4170-A4EA-D41BA50987AC");
         locationUnit.UnitName           = "HCN2";
         locationUnit.BusinessLocationId = Guid.Parse("9966B4BA-BE61-49AA-8010-82F55590961C");
         ltr.Update((LocationUnit)locationUnit);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public void AddLocationUnit()
 {
     try
     {
         ILocationUnit locationUnit = new LocationUnit();
         locationUnit.UnitId             = Guid.NewGuid();
         locationUnit.UnitName           = "HCP2";
         locationUnit.BusinessLocationId = Guid.Parse("9966B4BA-BE61-49AA-8010-82F55590961C");
         ltr.Create((LocationUnit)locationUnit);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 // PUT: api/LocationUnit/5
 public HttpResponseMessage Put(LocationUnit locationUnit)
 {
     try
     {
         response.StatusCode           = HttpStatusCode.Created;
         response.Content              = new StringContent(locationUnitFactory.Update(locationUnit).ToString());
         response.Headers.CacheControl = new CacheControlHeaderValue()
         {
             MaxAge = TimeSpan.FromMinutes(20)
         };
     }
     catch (Exception ex)
     {
         response.StatusCode           = HttpStatusCode.BadRequest;
         response.Content              = new StringContent(ex.Message);
         response.Headers.CacheControl = new CacheControlHeaderValue()
         {
             MaxAge = TimeSpan.FromMinutes(20)
         };
     }
     return(response);
 }
예제 #5
0
 protected bool ShouldSerializeLocationUnit()
 {
     return(!LocationUnit.Equals(GetDefaultPropertyValue("LocationUnit", LocationUnit)));
 }
예제 #6
0
 public DepartmentTest()
 {
     dFactory = new LocationDepartmentFactory();
     bFactory = new LocationBusinessFactory();
     uFactory = new LocationUnit();
 }