Пример #1
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 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);
     }
 }
Пример #4
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();
            }
        }