public DepartmentAddEditSingleWrapper GetDepartmentAddEditSingleWrapper(DepartmentGetSingleArgs args)
        {
            DepartmentAddEditSingleWrapper returnItem = new DepartmentAddEditSingleWrapper();

            returnItem = this.DepartmentData.GetSingleDepartment(args);
            return(returnItem);
        }
Esempio n. 2
0
 private static void ShowDepartmentAddEditSingleWrapper(DepartmentAddEditSingleWrapper wrap)
 {
     if (null != wrap)
     {
         if (null != wrap.PrimaryDepartment)
         {
             ShowDepartment(wrap.PrimaryDepartment);
         }
     }
 }
Esempio n. 3
0
        public DepartmentAddEditSingleWrapper GetDepartmentAddEditSingleWrapper(DepartmentGetSingleArgs args)
        {
            DepartmentAddEditSingleWrapper returnItem = null;

            IDepartmentManager proxy1 = this.GetTheProxy();

            using (proxy1 as IDisposable)
            {
                returnItem = proxy1.GetDepartmentAddEditSingleWrapper(args);
                return(returnItem);
            }
        }
        public DepartmentAddEditSingleWrapper GetSingleDepartment(DepartmentGetSingleArgs args)
        {
            DepartmentAddEditSingleWrapper returnItem = new DepartmentAddEditSingleWrapper();
            Department d1 = new Department()
            {
                DepartmentUUID = args.DepartmentSurrogateKey, DepartmentName = "MockDeptGetSingle", CreateDate = DateTime.Now, TheVersionProperty = new byte[8] {
                    0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
                }
            };

            returnItem.PrimaryDepartment = d1;
            return(returnItem);
        }
 public DepartmentAddEditSingleWrapper GetDepartmentAddEditSingleWrapper([FromBody] DepartmentGetSingleArgs args)
 {
     try
     {
         DepartmentAddEditSingleWrapper returnItem = null;
         IDepartmentManager             con        = this.ForwardRequestToDepartmentManager;
         returnItem = con.GetDepartmentAddEditSingleWrapper(args);
         return(returnItem);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public DepartmentAddEditSingleWrapper GetDepartmentAddEditSingleWrapper(DepartmentGetSingleArgs args)
 {
     try
     {
         DepartmentAddEditSingleWrapper returnItem = null;
         IDepartmentManager             con        = this.ForwardRequestToDepartmentManager;
         returnItem = con.GetDepartmentAddEditSingleWrapper(args);
         return(returnItem);
     }
     catch (Exception ex)
     {
         ExceptionDetail detail = new ExceptionDetail(ex);
         throw new FaultException <ExceptionDetail>(detail, ex.Message);
     }
 }
Esempio n. 7
0
        public DepartmentAddEditSingleWrapper GetSingleDepartment(DepartmentGetSingleArgs args)
        {
            DepartmentAddEditSingleWrapper returnItem = new DepartmentAddEditSingleWrapper();

            /* Start Temp Code */
            //////Department d1 = new Department() { DepartmentUUID = args.DepartmentSurrogateKey, DepartmentName = "DeptGetSingle", CreateDate = DateTime.Now, TheVersionProperty = new byte[8] { 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 } };
            //////returnItem.PrimaryDepartment = d1;
            /* End Temp Code */

            ////Below Code is Good Code...Comment out the "Temp Code" (above) and uncomment below to hit the database.
            IDataReader idr = this.AdoDepartmentData.GetDepartmentSingleDataReader(args);

            returnItem.PrimaryDepartment = new DepartmentDefaultSerializer().SerializeSingle(idr);

            return(returnItem);
        }
        public DepartmentAddEditSingleWrapper GetDepartmentAddEditSingleWrapper(DepartmentGetSingleArgs args)
        {
            DepartmentAddEditSingleWrapper returnItem = null;

            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri(this.BaseAddress);
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(JsonApplication));

            string serviceUrl = GenerateFullAddress(UrlSuffixGetDepartmentAddEditSingleWrapper);

            // HttpResponseMessage response = client.PostAsJsonAsync(serviceUrl, args).Result;
            HttpResponseMessage response = client.PostAsJsonAsync(serviceUrl, args).Result;

            this.DebugWriteLine(string.Empty);
            this.DebugWriteLine(response.ToString());
            this.DebugWriteLine(response.Content.ReadAsStringAsync().Result);
            this.DebugWriteLine(string.Empty);

            if (response.IsSuccessStatusCode)
            {
                Task <DepartmentAddEditSingleWrapper> wrap = response.Content.ReadAsAsync <DepartmentAddEditSingleWrapper>();
                if (null != wrap)
                {
                    returnItem = wrap.Result;
                }
                else
                {
                    throw new ArgumentNullException("Task<DepartmentAddEditSingleWrapper>.Result was null.  This was not expected.");
                }
            }
            else
            {
                throw new HttpRequestException(response.ReasonPhrase + " " + response.RequestMessage);
            }

            return(returnItem);
        }
Esempio n. 9
0
        public static void Main(string[] args)
        {
            try
            {
                System.Threading.Thread.Sleep(1000);

                UnityContainer container = new UnityContainer();
                container.LoadConfiguration();

                IDepartmentManager man = container.Resolve <IDepartmentManager>();

                DepartmentAllWrapper deptAllWrapper = man.GetDepartmentAllWrapper();
                ShowDepartmentAllWrapper(deptAllWrapper);

                if (null != deptAllWrapper)
                {
                    if (null != deptAllWrapper.Departments)
                    {
                        Department foundDept1 = deptAllWrapper.Departments.FirstOrDefault();
                        if (null != foundDept1)
                        {
                            DepartmentGetSingleArgs args1 = new DepartmentGetSingleArgs();
                            args1.DepartmentSurrogateKey = foundDept1.DepartmentUUID;
                            DepartmentAddEditSingleWrapper singleWrapper = man.GetDepartmentAddEditSingleWrapper(args1);
                            ShowDepartmentAddEditSingleWrapper(singleWrapper);
                        }
                    }
                }

                DepartmentAddEditArgs newArgs = new DepartmentAddEditArgs();
                newArgs.DepartmentSurrogateKey = Guid.NewGuid();
                newArgs.DepartmentName         = "New_WebApi_Department:" + Guid.NewGuid().ToString("N");
                newArgs.CreateDate             = DateTime.Now;
                Department newDept = man.AddDepartment(newArgs);
                ShowDepartment(newDept);

                if (null != newArgs)
                {
                    DepartmentAddEditArgs updateArgs = new DepartmentAddEditArgs()
                    {
                        DepartmentSurrogateKey = newArgs.DepartmentSurrogateKey, DepartmentName = "Update+" + newArgs.DepartmentName, CreateDate = DateTime.Now
                    };
                    Department dept2 = man.UpdateDepartment(updateArgs);
                    ShowDepartment(dept2);
                    Console.WriteLine(string.Empty);
                }
            }
            catch (Exception ex)
            {
                Exception exc = ex;
                while (null != exc)
                {
                    Console.WriteLine(exc.Message);
                    exc = exc.InnerException;
                }
            }
            finally
            {
                Console.WriteLine("Press ENTER to Exit");
                Console.ReadLine();
            }
        }