Ejemplo n.º 1
0
        public static Owner Create(OwnerResponse response)
        {
            if (response == null)
                return null;

            Owner owner = new Owner();
            owner.OwnerID = response.OwnerID;
            owner.Type = response.Type;
            owner.Name = response.Name;
            owner.UnitNr = response.UnitNr;
            owner.ComplexName = response.ComplexName;
            owner.StreetNumber = response.StreetNumber;
            owner.StreetName = response.StreeName;
            owner.Suburb = response.Suburb;
            owner.City = response.City;
            owner.PostalCode = response.PostalCode;
            owner.TelWork = response.TelWork;
            owner.TelMobile = response.TelMobile;
            owner.Fax = response.Fax;
            owner.Email = response.Email;
            owner.Website = response.Website;
            owner.Title = response.Title;
            owner.FirstName = response.FirstName;
            owner.SecondName = response.SecondName;
            owner.ThirdName = response.ThirdName;
            owner.LastName = response.LastName;
            owner.IDNumber = response.IDNumber;

            return owner;

        }
Ejemplo n.º 2
0
        public ActionResult AddUserOwner(Owner model)
        {

            CreateUserRequest request = new CreateUserRequest();
            request.UserID = model.UserID;
            request.Username = model.Username;
            request.Type = model.Type;

            CreateOwnerRequest ownerRequest = new CreateOwnerRequest();
            ownerRequest.OwnerID = model.OwnerID;
            ownerRequest.Type = model.OwnerType;
            ownerRequest.Name = model.Name;
            ownerRequest.UnitNr = model.UnitNr;
            ownerRequest.ComplexName = model.ComplexName;
            ownerRequest.StreetNumber = model.StreetNumber;
            ownerRequest.StreeName = model.StreetName;
            ownerRequest.Suburb = model.Suburb;
            ownerRequest.City = model.City;
            ownerRequest.PostalCode = model.PostalCode;
            ownerRequest.TelWork = model.TelWork;
            ownerRequest.TelMobile = model.TelMobile;
            ownerRequest.Fax = model.Fax;
            ownerRequest.Email = model.Email;
            ownerRequest.Website = model.Website;
            ownerRequest.Title = model.Title;
            ownerRequest.FirstName = model.FirstName;
            ownerRequest.SecondName = model.SecondName;
            ownerRequest.ThirdName = model.ThirdName;
            ownerRequest.LastName = model.LastName;
            ownerRequest.IDNumber = model.IDNumber;


            var result = ApiWrapper.Post<OwnerResponse>("api/owner/add", ownerRequest);

            request.UserKey = result.OwnerID;
            var resultUser = ApiWrapper.Post<bool>("api/user/add", request);


            if (string.IsNullOrEmpty(Request.QueryString["returnurl"]))
                return Redirect("/user/list/o");
            else
                return Redirect(Request.QueryString["returnurl"]);
        }
Ejemplo n.º 3
0
        public ActionResult ViewOwners()
        {
            List<UserResponse> users = new List<UserResponse>();
            users = ApiWrapper.Get<List<UserResponse>>("api/user/list/owner");
            List<OwnerResponse> owners = new List<OwnerResponse>();
            owners = ApiWrapper.Get<List<OwnerResponse>>("api/owner/");

            List<Owner> finalOwners = new List<Owner>();

            foreach (OwnerResponse owner in owners)
            {
                var user = users.Where(x => x.UserKey == owner.OwnerID).FirstOrDefault();

                if (user == null)
                    continue;

                Owner finalOwner = new Owner();
                finalOwner.OwnerID = owner.OwnerID;
                finalOwner.OwnerType = owner.Type;
                finalOwner.Name = owner.Name;
                finalOwner.UnitNr = owner.UnitNr;
                finalOwner.ComplexName = owner.ComplexName;
                finalOwner.StreetNumber = owner.StreetNumber;
                finalOwner.StreetName = owner.StreeName;
                finalOwner.Suburb = owner.Suburb;
                finalOwner.City = owner.City;
                finalOwner.PostalCode = owner.PostalCode;
                finalOwner.TelWork = owner.TelWork;
                finalOwner.TelMobile = owner.TelMobile;
                finalOwner.Fax = owner.Fax;
                finalOwner.Email = owner.Email;
                finalOwner.Website = owner.Website;
                finalOwner.Title = owner.Title;
                finalOwner.FirstName = owner.FirstName;
                finalOwner.SecondName = owner.SecondName;
                finalOwner.ThirdName = owner.ThirdName;
                finalOwner.LastName = owner.LastName;
                finalOwner.IDNumber = owner.IDNumber;
                finalOwner.UserID = user.UserID;
                finalOwner.Username = user.Username;
                finalOwner.Type = user.Type;

                finalOwners.Add(finalOwner);
            }

            return View("Owner/List", finalOwners);
        }