Esempio n. 1
0
        public async Task <IActionResult> Get140Event()
        {
            Event120_200    request         = new Event120_200();
            RequestData     requestData     = new RequestData();
            PropertyRequest propertyRequest = new PropertyRequest();
            File            file            = new File();

            request.requestData = new List <RequestData>();



            requestData.comment     = "upload a new document";
            requestData.description = "";
            requestData.eventDate   = System.DateTime.Now;

            propertyRequest.uniqueID  = new Guid();
            propertyRequest.eventCode = 140;

            file.document         = "http://www.applied-valuation.com/file.tif";
            file.encodingType     = "Url";
            file.extension        = "tif";
            file.name             = "file";
            file.type             = "Image";
            propertyRequest.files = new List <File>();
            propertyRequest.files.Add(file);


            requestData.propertyRequest = new List <PropertyRequest>();
            requestData.propertyRequest.Add(propertyRequest);
            request.requestData.Add(requestData);

            return(Ok(new { request = request }));
        }
Esempio n. 2
0
        public async Task <ActionResult <RSV <Property> > > InsertProperty([FromForm] PropertyRequest propertyRequest)
        {
            RSV <Property> infoResultado = new();

            try
            {
                int IdOwner = int.Parse(HttpContext.User.Identity.Name);

                if (this._environment != null)
                {
                    infoResultado.Datos = await this.Domain.InsertProperty(propertyRequest, IdOwner, this._environment.ContentRootPath);
                }
                else
                {
                    infoResultado.Datos = await this.Domain.InsertProperty(propertyRequest, IdOwner, @"D:\DesarrolloSoftware\DotNet\PruebaMillionAndUp\PruebaMillionAndUp\"); // Modicar la ruta cuando se ejecuta en pruebas unitarias, para la carpeta que desee
                }
                infoResultado.Exitoso    = true;
                infoResultado.StatusCode = 201;
            }
            catch (Exception ex)
            {
                infoResultado.Exitoso    = false;
                infoResultado.Error      = new Error(ex);
                infoResultado.StatusCode = 500;
            }

            return(infoResultado);
        }
        public void UpdatePropertyTest()
        {
            var property = new PropertyRequest()
            {
                GroupLogoUrl     = "https://photosa.propertyimages.ie/groups/9/0/4/6409/logo.jpg",
                BedsString       = "2 beds",
                Price            = 395000,
                SizeStringMeters = 52.95,
                DisplayAddress   = "Apt.	16	The	Northumberlands,	Off	Lower	Mount	Street Dublin  2",
                PropertyType     = "Apartment",
                BerRating        = "D2",
                MainPhoto        =
                    "https://photosa.propertyimages.ie/media/2/3/2/4292232/38e98b8e-645f-4adf-8e57-f927e5769840_l.jpg",
                //Photos = new List<string>()
                //{
                //    "https://photosa.propertyimages.ie/media/2/3/2/4292232/38e98b8e-645f-4adf-8e57-f927e5769840_l.jpg",
                //    "https://photosa.propertyimages.ie/media/2/3/2/4292232/38e98b8e-645f-4adf-8e57-f927e5769840_l.jpg",
                //    "https://photosa.propertyimages.ie/media/2/3/2/4292232/38e98b8e-645f-4adf-8e57-f927e5769840_l.jpg"
                //}
            };

            var result = _controller.UpdateProperty(property);

            Assert.NotNull(result);
        }
Esempio n. 4
0
        public IActionResult Property(PropertyRequest request)
        {
            ValidateEntity <PropertyRequest>(request);

            Business.User.SetProperty(Context.Current.User, request.Name, request.Value);

            if (string.IsNullOrWhiteSpace(request.Value))
            {
                if (Context.Current.User.Properties.ContainsKey(request.Name))
                {
                    Context.Current.User.Properties.Remove(request.Name);
                }
            }
            else
            {
                if (Context.Current.User.Properties.ContainsKey(request.Name))
                {
                    Context.Current.User.Properties[request.Name] = request.Value;
                }
                else
                {
                    Context.Current.User.Properties.Add(request.Name, request.Value);
                }
            }

            HttpContext.Session.Set(Context.Current.User);

            return(GetOutput());
        }
Esempio n. 5
0
        public ActionResult DeleteConfirmed(long id)
        {
            PropertyRequest propertyRequest = db.PropertyRequests.Find(id);

            db.PropertyRequests.Remove(propertyRequest);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 6
0
        // GET: PropertyRequests/Delete/5
        public ActionResult Delete(long?id)
        {
            PropertyRequest propertyRequest = db.PropertyRequests.Find(id);

            propertyRequest.IsDeleted = true;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public string CreateContent <T>(T item) where T : GenericContent
        {
            string createTypeName = PropertyRequest.GetEPiServerDefinition(typeof(T));
            string parentName     = item.ParentContentReference ?? EPiServerCredentials.Credentials.ImportRoot.ToString();
            var    cref           = EPiClientInstance.CreateContent(createTypeName, parentName, item);

            return(cref);
        }
Esempio n. 8
0
        public IActionResult CreateProperty([FromBody] PropertyRequest property)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            PropertyModel.CreateProperty(property);

            return(CreatedAtAction("GetProperty", new { id = property.Id }, property));
        }
Esempio n. 9
0
        /// <summary>
        /// Enqueues a new property to be read
        /// </summary>
        /// <typeparam name="TProp">The type of the property</typeparam>
        /// <param name="deviceInstance">The device instance of the object</param>
        /// <param name="reference">The reference to the property</param>
        /// <param name="onValue">The value handler for when the property is read</param>
        /// <param name="onError">The error handler for when an error occurs</param>
        public void Enqueue <TProp>(uint deviceInstance, ObjectPropertyReference reference, Action <TProp> onValue, Action <Error> onError = null)
        {
            PropertyRequest <TProp> request = new PropertyRequest <TProp>(
                deviceInstance,
                reference,
                onValue,
                onError);

            _requests.Add(request);
        }
Esempio n. 10
0
        public IActionResult UpdateProperty([FromBody] PropertyRequest property)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            PropertyModel.UpdateProperty(property);

            return(NoContent());
        }
Esempio n. 11
0
            /// <summary>
            /// Enqueues a property for reading
            /// </summary>
            /// <typeparam name="TProp">The type of property to read</typeparam>
            /// <param name="expression">The expression of the property to read</param>
            /// <param name="onValue">The action to invoke when a value is read</param>
            /// <param name="onError">The action to invoke when an error results</param>
            public void Enqueue <TProp>(Expression <Func <TObj, TProp> > expression, Action <TProp> onValue, Action <Error> onError = null)
            {
                var reference = ObjectHelpers.GetObjectPropertyReference(ObjectIdentifier, expression);
                var request   = new PropertyRequest <TProp>(
                    DeviceInstance,
                    reference,
                    onValue,
                    onError);

                Queue._requests.Add(request);
            }
Esempio n. 12
0
        public ActionResult PropertyRequestDetails(long Id)
        {
            PropertyRequest details = unitOfWork.Repository <PropertyRequest>().GetById(Id);

            if (details == null)
            {
                Response.Write("<script>alert(' Property Request details not found')</script>");
            }

            return(View(details));
        }
Esempio n. 13
0
        public static string GetQueryforMPRN(PropertyRequest request)
        {
            string        result  = string.Empty;
            List <string> addList = new List <string>();

            if (!string.IsNullOrEmpty(request.BuildingName))
            {
                addList.Add(request.BuildingName);
            }
            if (!string.IsNullOrEmpty(request.SubBuildingName))
            {
                addList.Add(request.SubBuildingName);
            }
            if (!string.IsNullOrEmpty(request.MCBuildingName))
            {
                addList.Add(request.MCBuildingName);
            }
            if (!string.IsNullOrEmpty(request.MCSubBuildingName))
            {
                addList.Add(request.MCSubBuildingName);
            }
            if (!string.IsNullOrEmpty(request.BuildingNumber))
            {
                addList.Add(request.BuildingNumber);
            }
            if (!string.IsNullOrEmpty(request.PrincipalStreet))
            {
                addList.Add(request.PrincipalStreet);
            }
            if (!string.IsNullOrEmpty(request.DependentStreet))
            {
                addList.Add(request.DependentStreet);
            }
            if (!string.IsNullOrEmpty(request.DependentLocality))
            {
                addList.Add(request.DependentLocality);
            }
            if (!string.IsNullOrEmpty(request.LocalityName))
            {
                addList.Add(request.LocalityName);
            }
            if (!string.IsNullOrEmpty(request.PostTown))
            {
                addList.Add(request.PostTown);
            }
            if (!string.IsNullOrEmpty(request.Postcode))
            {
                addList.Add(request.Postcode);
            }
            result = string.Join(", ", addList);
            return(result);
        }
Esempio n. 14
0
        public HttpResponseMessage SetProperty(string id, [FromBody] PropertyRequest properyMessage)
        {
            Logging.DebugMessage("AuthenticatedUser: {0}", this.User.Identity.Name);
            if (!this.User.Identity.IsAuthenticated)
            {
                throw new UnauthorizedAccessException("Access denied");
            }
            this.id = id;
            try
            {
                var settings = properyMessage;
                var env      = environmentTasks.GetEnvironment(string.Format("{0}-{1}", id, settings.Environment));
                switch (settings.Type)
                {
                case VariableTypes.Environmental:
                    SetEnvironmentVariable(env, settings.PropertyName, settings.Value, settings.IsSecure);
                    break;

                case VariableTypes.ServiceHost:
                case VariableTypes.ServiceHostEnvironmental:
                    var host = configSetTasks.GetServiceHost(string.Format("{0}-{1}", id, settings.ParentContainer));
                    SetHostParameter(configSetTasks, settings, host);
                    if (settings.Type == VariableTypes.ServiceHostEnvironmental)
                    {
                        var envKey = GetEnvironmentSubstitutionKey(settings);
                        SetEnvironmentSubstitutionVariable(env, envKey, settings.Value, settings.IsSecure);
                    }
                    break;

                case VariableTypes.Service:
                case VariableTypes.ServiceEnvironmental:
                    SetEnpointParameter(settings);
                    if (settings.Type == VariableTypes.ServiceHostEnvironmental)
                    {
                        var envKey = GetEnvironmentSubstitutionKey(settings);
                        SetEnvironmentSubstitutionVariable(env, envKey, settings.Value, settings.IsSecure);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                ex.Log();
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, string.Format("Error: {0}", ex.Message)));
            }
            return(Request.CreateResponse(HttpStatusCode.OK, "OK"));
        }
Esempio n. 15
0
        public async Task <IActionResult> PutProperty([FromRoute] int id, [FromBody] PropertyRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != request.Id)
            {
                return(BadRequest());
            }

            var oldProperty = await _dataContext.Properties.FindAsync(request.Id);

            if (oldProperty == null)
            {
                return(BadRequest("الملكية غير موجودة."));
            }

            var propertyType = await _dataContext.PropertyTypes.FindAsync(request.PropertyTypeId);

            if (propertyType == null)
            {
                return(BadRequest("نوع العقار غير صحيح."));
            }

            oldProperty.Address       = request.Address;
            oldProperty.HasParkingLot = request.HasParkingLot;
            oldProperty.IsAvailable   = request.IsAvailable;
            oldProperty.Neighborhood  = request.Neighborhood;
            oldProperty.Price         = request.Price;
            oldProperty.PropertyType  = propertyType;
            oldProperty.Remarks       = request.Remarks;
            oldProperty.Rooms         = request.Rooms;
            oldProperty.Bathrooms     = request.Bathrooms;
            oldProperty.Balconies     = request.Balconies;
            oldProperty.SquareMeters  = request.SquareMeters;
            oldProperty.Stratum       = request.Stratum;
            oldProperty.Latitude      = request.Latitude;
            oldProperty.Longitude     = request.Longitude;
            oldProperty.Typeprop      = request.Typeprop;
            _dataContext.Properties.Update(oldProperty);
            await _dataContext.SaveChangesAsync();

            return(Ok(true));
        }
        public override async Task <PropertyReply> GetProperty(PropertyRequest request, ServerCallContext context)
        {
            var httpContext = context.GetHttpContext();

            _logger.LogInformation($"Connection id: {httpContext.Connection.Id}");

            _logger.LogInformation($"Handling request for property Id '{request.PropertyId}'");

            var property = await _mediator.Send(new ClientPropertyQuery(request.PropertyId));

            if (property is null)
            {
                context.Status = new Status(StatusCode.NotFound, $"Property Id '{request.PropertyId}' was not found");
            }

            return(property ?? new PropertyReply());
        }
Esempio n. 17
0
        public async Task <IActionResult> PostProperty([FromBody] PropertyRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var owner = await _dataContext.Owners.FindAsync(request.OwnerId);

            if (owner == null)
            {
                return(BadRequest("غير صالح المالك."));
            }

            var propertyType = await _dataContext.PropertyTypes.FindAsync(request.PropertyTypeId);

            if (propertyType == null)
            {
                return(BadRequest("غير صحيح نوع الممتلكات."));
            }

            var property = new Property
            {
                Address       = request.Address,
                HasParkingLot = request.HasParkingLot,
                IsAvailable   = request.IsAvailable,
                Neighborhood  = request.Neighborhood,
                Owner         = owner,
                Price         = request.Price,
                PropertyType  = propertyType,
                Remarks       = request.Remarks,
                Rooms         = request.Rooms,
                Bathrooms     = request.Bathrooms,
                Balconies     = request.Balconies,
                SquareMeters  = request.SquareMeters,
                Stratum       = request.Stratum,
                Latitude      = request.Latitude,
                Longitude     = request.Longitude,
                Typeprop      = request.Typeprop
            };

            _dataContext.Properties.Add(property);
            await _dataContext.SaveChangesAsync();

            return(Ok(true));
        }
Esempio n. 18
0
 public ActionResult Create([Bind(Include = "LocationIDs,AddressDetails,MinPrice,MaxPrice,CanInstallment,NoOfYears,PropertyFloorTypeID,MinArea,MaxArea,OwnerShipTypeID,PropertyTypeID,PropertyPurposeID,Title,Comments,CityID,GovID,IsActive")] PropertyRequest propertyRequest)
 {
     if (ModelState.IsValid)
     {
         propertyRequest.IsActive  = true;
         propertyRequest.EntryDate = DateTime.Now;
         propertyRequest.ByUserID  = CurrentUser.UserID;
         if (propertyRequest.LocationIDs.HasValue && propertyRequest.LocationIDs.Value == 0)
         {
             propertyRequest.LocationIDs = null;
         }
         db.PropertyRequests.Add(propertyRequest);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     InitPage("Create");
     return(View("PropertyRequest", propertyRequest));
 }
Esempio n. 19
0
        // GET: PropertyRequests/Edit/5
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PropertyRequest propertyRequest = db.PropertyRequests.Find(id);

            if (propertyRequest == null)
            {
                return(HttpNotFound());
            }
            InitPage("Edit");
            ViewBag.GovID       = propertyRequest.GovID;
            ViewBag.CityID      = propertyRequest.CityID;
            ViewBag.LocationIDs = propertyRequest.LocationIDs;
            return(View("PropertyRequest", propertyRequest));
        }
Esempio n. 20
0
        public async Task <IActionResult> PutProperty(
            [FromRoute] int id,
            [FromBody] PropertyRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != request.Id)
            {
                return(BadRequest());
            }

            var oldProperty = await _dataContext.Properties.FindAsync(request.Id);

            if (oldProperty == null)
            {
                return(BadRequest("Property doesn't exists."));
            }

            var propertyType = await _dataContext.PropertyTypes.FindAsync(request.PropertyTypeId);

            if (propertyType == null)
            {
                return(BadRequest("Not valid property type."));
            }

            oldProperty.Address       = request.Address;
            oldProperty.HasParkingLot = request.HasParkingLot;
            oldProperty.IsAvailable   = request.IsAvailable;
            oldProperty.Neighborhood  = request.Neighborhood;
            oldProperty.Price         = request.Price;
            oldProperty.PropertyType  = propertyType;
            oldProperty.Remarks       = request.Remarks;
            oldProperty.Rooms         = request.Rooms;
            oldProperty.SquareMeters  = request.SquareMeters;
            oldProperty.Stratum       = request.Stratum;

            _dataContext.Properties.Update(oldProperty);
            await _dataContext.SaveChangesAsync();

            return(Ok(true));
        }
Esempio n. 21
0
        public async Task <Property> InsertProperty(PropertyRequest propertyRequest, int IdOwner, string path)
        {
            Property property = JsonConvert.DeserializeObject <Property>(propertyRequest.Property);

            property.IdOwner = IdOwner;

            if (propertyRequest.Images != null && propertyRequest.Images.ToList().Count > 0)
            {
                List <PropertyImage> images = new List <PropertyImage>();

                if (propertyRequest.SaveImagesInDB)
                {
                    foreach (var image in propertyRequest.Images)
                    {
                        using MemoryStream stream = new();
                        image.CopyTo(stream);
                        byte[] bytes = stream.ToArray();
                        images.Add(new() {
                            File    = Convert.ToBase64String(bytes),
                            Enabled = true
                        });
                    }
                }
                else
                {
                    string uploads = Path.Combine(path, this._configuration["folderimages"]);
                    foreach (var image in propertyRequest.Images)
                    {
                        string filePath = Path.Combine(uploads, image.FileName);
                        using Stream fileStrem = new FileStream(filePath, FileMode.Create);
                        await image.CopyToAsync(fileStrem);

                        images.Add(new()
                        {
                            File    = filePath,
                            Enabled = true
                        });
                    }
                }
                property.PropertyImages = images;
            }

            return(await this.Repositoty.InsertProperty(property));
        }
Esempio n. 22
0
        public async Task <IActionResult> PostProperty([FromBody] PropertyRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Owner owner = await _dataContext.Owners.FindAsync(request.OwnerId);

            if (owner == null)
            {
                return(BadRequest("Not valid owner."));
            }

            PropertyType propertyType = await _dataContext.PropertyTypes.FindAsync(request.PropertyTypeId);

            if (propertyType == null)
            {
                return(BadRequest("Not valid property type."));
            }

            Property property = new Property
            {
                Address       = request.Address,
                HasParkingLot = request.HasParkingLot,
                IsAvailable   = request.IsAvailable,
                Neighborhood  = request.Neighborhood,
                Owner         = owner,
                Price         = request.Price,
                PropertyType  = propertyType,
                Remarks       = request.Remarks,
                Rooms         = request.Rooms,
                SquareMeters  = request.SquareMeters,
                Stratum       = request.Stratum
            };

            _dataContext.Properties.Add(property);
            await _dataContext.SaveChangesAsync();

            //return Ok(property);
            return(Ok(true));
        }
Esempio n. 23
0
        private void SetEnpointParameter(PropertyRequest settings)
        {
            var endpoint = configSetTasks.GetEndpoint(string.Format("{0}-{1}-{2}", id, settings.ParentContainer, settings.SubContainer));
            var item     = endpoint.Parameters.SingleOrDefault(p => p.Name == settings.PropertyName);

            if (item == null)
            {
                configSetTasks.CreateEndpointParameter(
                    settings.ParentContainer,
                    settings.PropertyName,
                    settings.Type == VariableTypes.ServiceHostEnvironmental ? settings.ParentFormatString : settings.Value,
                    settings.Type == VariableTypes.ServiceHostEnvironmental, settings.Description);
            }
            else
            {
                item.ConfigurableForEachEnvironment = settings.Type == VariableTypes.ServiceHostEnvironmental;
                item.ItemValue =
                    settings.Type == VariableTypes.ServiceHostEnvironmental ? settings.ParentFormatString : settings.Value;
                configSetTasks.UpdateEndpointParameter(item);
            }
        }
Esempio n. 24
0
        public async Task <IActionResult> Get120_200Event()
        {
            Event120_200    request         = new Event120_200();
            RequestData     requestData     = new RequestData();
            PropertyRequest propertyRequest = new PropertyRequest();

            request.requestData = new List <RequestData>();

            requestData.comment     = "";
            requestData.eventDate   = System.DateTime.Now;
            requestData.description = "";

            propertyRequest.uniqueID  = new Guid();
            propertyRequest.eventCode = 120;

            requestData.propertyRequest = new List <PropertyRequest>();
            requestData.propertyRequest.Add(propertyRequest);
            requestData.propertyRequest[0].note = "order note";
            request.requestData.Add(requestData);

            return(Ok(new { request = request }));
        }
Esempio n. 25
0
        private void SetHostParameter(IConfigSetTask reader, PropertyRequest settings, IServiceHostSettings host)
        {
            var item = host.Parameters.SingleOrDefault(p => p.Name == settings.PropertyName);

            if (item == null)
            {
                reader.CreateServiceHostParameter(
                    host,
                    settings.PropertyName,
                    settings.IsSecure,
                    settings.Type == VariableTypes.ServiceHostEnvironmental ? settings.ParentFormatString : settings.Value,
                    settings.Type == VariableTypes.ServiceHostEnvironmental);
            }
            else
            {
                item.IsSecureString  = settings.IsSecure;
                item.IsEnvironmental = settings.Type == VariableTypes.ServiceHostEnvironmental;
                item.SetValue(
                    settings.Type == VariableTypes.ServiceHostEnvironmental ? settings.ParentFormatString : settings.Value);
                reader.UpdateHostParameter(item);
            }
        }
Esempio n. 26
0
        public async Task <IActionResult> Get100Event()
        {
            Event100        request         = new Event100();
            RequestData     requestData     = new RequestData();
            PropertyRequest propertyRequest = new PropertyRequest();
            Contact         contact         = new Contact();
            Product         product         = new Product();
            Address         address         = new Address();
            LoanInfo        loanInfo        = new LoanInfo();
            Element         element         = new Element();
            File            file            = new File();

            request.accountID = 1000;
            request.internalAccountIdentifier = "12345";
            request.loginAccountIdentifier    = "username";
            request.loginAccountPassword      = "******";
            requestData.comment         = "comment for new order";
            requestData.description     = "new interface order from 123 bank";
            requestData.eventDate       = System.DateTime.Now;
            requestData.propertyRequest = new List <PropertyRequest>();

            propertyRequest.contacts  = new List <Contact>();
            propertyRequest.eventCode = 100;
            contact                       = new Contact();
            contact.firstName             = "jason";
            contact.lastName              = "test";
            contact.telephoneNumber1      = "412-555-1212";
            contact.telephoneNumber2      = "412-555-2121";
            contact.type                  = "Borrower";
            contact.address               = new Address();
            contact.address.streetAddress = "123 First Ave.";
            contact.address.city          = "Pittsburgh";
            contact.address.state         = "PA";
            contact.address.county        = "Allegheny";
            contact.address.postalCode    = "15241";
            propertyRequest.contacts.Add(contact);

            propertyRequest.products = new List <Product>();
            product.code             = "1122";
            product.name             = "FNMA 20000 Desk Review";
            propertyRequest.products.Add(product);

            propertyRequest.subjectAddress = new Address();
            address.streetAddress          = "123 Main St.";
            address.city                   = "Pittsburgh";
            address.state                  = "PA";
            address.county                 = "Allegheny";
            address.postalCode             = "15241";
            propertyRequest.subjectAddress = address;

            propertyRequest.loanInfo      = new LoanInfo();
            loanInfo.agencyCaseIdentifier = "ES-1234";
            loanInfo.appraisedValue       = 120000;
            loanInfo.lenderCaseIdentifier = "Loan#123";
            loanInfo.listPrice            = 125000;
            loanInfo.LoanAmount           = 80000;
            loanInfo.purchasePrice        = 110000;
            loanInfo.salePrice            = 100000;
            loanInfo.type            = "FHA";
            propertyRequest.loanInfo = loanInfo;

            propertyRequest.files = new List <File>();
            file.document         = "ASDFGHUYTRERTYJ";
            file.encodingType     = "Base64";
            file.extension        = "pdf";
            file.name             = "FieldReview.pdf";
            file.type             = "PDF";
            propertyRequest.files.Add(file);

            propertyRequest.elements = new List <Element>();
            element.name             = "Custom Field";
            element.value            = "Can be anything you need";
            element.name             = "CostCenter";
            element.value            = "example of a custom named field";
            requestData.propertyRequest.Add(propertyRequest);

            request.requestData.Add(requestData);
            // string s = await _orderService.GetOrder(1);
            return(Ok(new { request = request }));
        }
Esempio n. 27
0
        public void UpdateProperty(PropertyRequest property)
        {
            var prop = _mapper.Map <PropertyEntitiy>(property);

            PropertyRepository.UpdateProperty(prop);
        }
Esempio n. 28
0
        public void ReadInput()
        {
            ConsoleKey command = Console.ReadKey(true).Key;

            switch (command)
            {
            case ConsoleKey.UpArrow:
                Navigated?.Invoke(this, new NavigateEventArgs()
                {
                    Type = NavigateType.Up
                });
                break;

            case ConsoleKey.DownArrow:
                Navigated?.Invoke(this, new NavigateEventArgs()
                {
                    Type = NavigateType.Down
                });
                break;

            case ConsoleKey.Enter:
                Navigated?.Invoke(this, new NavigateEventArgs()
                {
                    Type = NavigateType.Enter
                });
                break;

            case ConsoleKey.Backspace:
                Navigated?.Invoke(this, new NavigateEventArgs()
                {
                    Type = NavigateType.Back
                });
                break;

            case ConsoleKey.F3:
                Navigated?.Invoke(this, new NavigateEventArgs()
                {
                    Type = NavigateType.Root
                });
                break;

            case ConsoleKey.F4:
                Navigated?.Invoke(this, new NavigateEventArgs()
                {
                    Type = NavigateType.Drives
                });
                break;

            case ConsoleKey.Tab:
                TabSwitching?.Invoke();
                break;

            case ConsoleKey.F1:
                FileServiceOperation?.Invoke(this, new OperationEventArgs()
                {
                    Type = OperationType.Copy
                });
                break;

            case ConsoleKey.F2:
                FileServiceOperation?.Invoke(this, new OperationEventArgs()
                {
                    Type = OperationType.Move
                });
                break;

            case ConsoleKey.F5:
                PropertyRequest?.Invoke();
                break;

            case ConsoleKey.F6:
                FileServiceOperation?.Invoke(this, new OperationEventArgs()
                {
                    Type = OperationType.Rename
                });
                break;

            case ConsoleKey.F7:
                FileServiceOperation?.Invoke(this, new OperationEventArgs()
                {
                    Type = OperationType.Search
                });
                break;

            case ConsoleKey.F8:
                FileServiceOperation?.Invoke(this, new OperationEventArgs()
                {
                    Type = OperationType.NewFolder
                });
                break;

            case ConsoleKey.Escape:
                CompletionOfWork?.Invoke();
                break;
            }
        }
Esempio n. 29
0
        protected IEnumerable <Models.Property> GetProperties(PropertyRequest request)
        {
            request.EntityTypeResult = request.EntityTypeResult ?? MetaData.Models.EntityCache.GetEntity(request.Type) ?? MetaData.TypeAnalyzer.AnalyzeType(request.Type);
            var properties           = new List <Models.Property>();
            var propertyInfosPartial = request.PartialEntity?.GetType().GetProperties().Where(p => p.CanRead).ToList();

            foreach (var property in request.EntityTypeResult.GetProperties())
            {
                if (property.IsReadOnly)
                {
                    continue;
                }

                if (property.IsNoClass)
                {
                    if (property.AutoGeneratedOption != DatabaseGeneratedOption.None)
                    {
                        continue;
                    }

                    if (request.PatchProperties != default)
                    {
                        var patchPropertyInfo = request.PatchProperties.FirstOrDefault(p => p.Key == request.NamePrefix + property.Name);
                        if (!patchPropertyInfo.Key.IsNullOrEmpty())
                        {
                            properties.Add(new Models.Property
                            {
                                Prefix       = request.NamePrefix,
                                PropertyInfo = null,
                                Entity       = patchPropertyInfo,
                                ColumnName   = property.ColumnName
                            });
                        }
                    }
                    else if (request.PartialEntity == default)
                    {
                        properties.Add(new Models.Property
                        {
                            Prefix       = request.NamePrefix,
                            PropertyInfo = property.PropertyInfo,
                            Entity       = request.Entity,
                            ColumnName   = property.ColumnName
                        });
                    }
                    else
                    {
                        var partialPropertyInfo = propertyInfosPartial.FirstOrDefault(p => p.Name == property.Name);
                        if (partialPropertyInfo != default)
                        {
                            properties.Add(new Models.Property
                            {
                                Prefix       = request.NamePrefix,
                                PropertyInfo = partialPropertyInfo,
                                Entity       = request.PartialEntity,
                                ColumnName   = property.ColumnName
                            });
                        }
                    }

                    continue;
                }

                if (property.IsOwnsOne)
                {
                    var ownsOneEntity = property.PropertyInfo.GetValue(request.Entity);

                    if (request.PatchProperties != default)
                    {
                        var exists = request.PatchProperties.Any(pp => pp.Key.StartsWith($"{request.NamePrefix}{property.Name}_"));
                        if (exists)
                        {
                            properties.AddRange(GetProperties(new PropertyRequest
                            {
                                Type             = property.Type,
                                Entity           = ownsOneEntity,
                                NamePrefix       = $"{request.NamePrefix}{property.Name}_",
                                PatchProperties  = request.PatchProperties,
                                EntityTypeResult = property.OwnsOne
                            }));
                        }

                        continue;
                    }

                    if (request.PartialEntity == default)
                    {
                        if (ownsOneEntity == default)
                        {
                            continue;
                        }

                        properties.AddRange(GetProperties(new PropertyRequest
                        {
                            Type             = property.Type,
                            Entity           = ownsOneEntity,
                            NamePrefix       = $"{request.NamePrefix}{property.Name}_",
                            EntityTypeResult = property.OwnsOne
                        }));

                        continue;
                    }

                    var partialPropertyInfo = propertyInfosPartial.FirstOrDefault(p => p.Name == property.Name);
                    if (partialPropertyInfo == default)
                    {
                        continue;
                    }

                    var ownsOneEntityPartial = partialPropertyInfo.GetValue(request.PartialEntity);
                    if (ownsOneEntityPartial == default)
                    {
                        continue;
                    }

                    properties.AddRange(GetProperties(new PropertyRequest
                    {
                        Type             = property.Type,
                        Entity           = ownsOneEntity,
                        NamePrefix       = $"{request.NamePrefix}{property.Name}_",
                        PartialEntity    = ownsOneEntityPartial,
                        EntityTypeResult = property.OwnsOne
                    }));

                    continue;
                }

                if (TypeHandlerMap.Map.ContainsKey(property.Type))
                {
                    if (request.PatchProperties != default)
                    {
                        var patchPropertyInfo = request.PatchProperties.FirstOrDefault(p => p.Key == request.NamePrefix + property.Name);
                        if (!patchPropertyInfo.Key.IsNullOrEmpty())
                        {
                            properties.Add(new Models.Property
                            {
                                Prefix       = request.NamePrefix,
                                PropertyInfo = null,
                                Entity       = patchPropertyInfo,
                                ColumnName   = property.ColumnName
                            });
                        }

                        continue;
                    }

                    if (request.PartialEntity == default)
                    {
                        properties.Add(new Models.Property
                        {
                            Prefix       = request.NamePrefix,
                            PropertyInfo = property.PropertyInfo,
                            Entity       = request.Entity,
                            TypeHandler  = TypeHandlerMap.Map[property.Type],
                            ColumnName   = property.ColumnName
                        });

                        continue;
                    }

                    var partialPropertyInfo = propertyInfosPartial.FirstOrDefault(p => p.Name == property.Name);
                    if (partialPropertyInfo != default)
                    {
                        properties.Add(new Models.Property
                        {
                            Prefix       = request.NamePrefix,
                            PropertyInfo = partialPropertyInfo,
                            Entity       = request.PartialEntity,
                            ColumnName   = property.ColumnName
                        });
                    }
                }
            }

            return(properties);
        }
Esempio n. 30
0
        public void Send100Event(string url,
                                 int interfaceId,
                                 string interfaceUniqueId,
                                 string orderUniqueId,
                                 string userName,
                                 string password)
        {
            int        retval = 0;
            Task <int> res;

            try
            {
                string log = "Send 100 - " + orderUniqueId + ", " + interfaceUniqueId + ", " + userName + ", " + password + ", ";
                res = _logService.SaveLogEntry(interfaceId, log, interfaceUniqueId);

                HttpResponse    httpResponse    = new HttpResponse();
                Event100        request         = new Event100();
                RequestData     requestData     = new RequestData();
                PropertyRequest propertyRequest = new PropertyRequest();
                Contact         contact         = new Contact();
                Product         product         = new Product();
                Address         address         = new Address();
                LoanInfo        loanInfo        = new LoanInfo();
                Element         element         = new Element();
                File            file            = new File();

                request.accountID = 1000;
                request.internalAccountIdentifier = "12345";
                request.loginAccountIdentifier    = "username";
                request.loginAccountPassword      = "******";
                requestData.comment         = "comment for new order";
                requestData.description     = "new interface order from 123 bank";
                requestData.eventDate       = System.DateTime.Now;
                requestData.propertyRequest = new List <PropertyRequest>();

                propertyRequest.contacts  = new List <Contact>();
                propertyRequest.eventCode = 100;
                contact                       = new Contact();
                contact.firstName             = "jason";
                contact.lastName              = "test";
                contact.telephoneNumber1      = "412-555-1212";
                contact.telephoneNumber2      = "412-555-2121";
                contact.type                  = "Borrower";
                contact.address               = new Address();
                contact.address.streetAddress = "123 First Ave.";
                contact.address.city          = "Pittsburgh";
                contact.address.state         = "PA";
                contact.address.county        = "Allegheny";
                contact.address.postalCode    = "15241";
                propertyRequest.contacts.Add(contact);

                propertyRequest.products = new List <Product>();
                product.code             = "1122";
                product.name             = "FNMA 20000 Desk Review";
                propertyRequest.products.Add(product);

                propertyRequest.subjectAddress = new Address();
                address.streetAddress          = "123 Main St.";
                address.city                   = "Pittsburgh";
                address.state                  = "PA";
                address.county                 = "Allegheny";
                address.postalCode             = "15241";
                propertyRequest.subjectAddress = address;

                propertyRequest.loanInfo      = new LoanInfo();
                loanInfo.agencyCaseIdentifier = "ES-1234";
                loanInfo.appraisedValue       = 120000;
                loanInfo.lenderCaseIdentifier = "Loan#123";
                loanInfo.listPrice            = 125000;
                loanInfo.LoanAmount           = 80000;
                loanInfo.purchasePrice        = 110000;
                loanInfo.salePrice            = 100000;
                loanInfo.type            = "FHA";
                propertyRequest.loanInfo = loanInfo;

                propertyRequest.files = new List <File>();
                file.document         = "ASDFGHUYTRERTYJ";
                file.encodingType     = "Base64";
                file.extension        = "pdf";
                file.name             = "FieldReview.pdf";
                file.type             = "PDF";
                propertyRequest.files.Add(file);

                propertyRequest.elements = new List <Element>();
                element.name             = "Custom Field";
                element.value            = "Can be anything you need";
                element.name             = "CostCenter";
                element.value            = "example of a custom named field";
                requestData.propertyRequest.Add(propertyRequest);

                request.requestData.Add(requestData);
                var payload = new { request };
                JsonSerializerSettings jss = new JsonSerializerSettings();
                jss.NullValueHandling = NullValueHandling.Ignore;
                httpResponse          = _httpService.PostMessage(url,
                                                                 JsonConvert.SerializeObject(payload, jss),
                                                                 "",
                                                                 "");
                if (httpResponse.success == true)
                {
                    //check status code
                    JToken avsRequest = JToken.Parse(httpResponse.responseData);
                    int.TryParse(avsRequest["response"]["responseData"][0]["statusCode"].ToString(), out retval);
                    if (retval == 0)
                    {
                        retval = 1;
                        res    = _commonRepository.UpdateInterfaceDataProcessed(interfaceId);
                    }
                    else
                    {
                        res = _commonRepository.SaveInterfaceData(interfaceId,
                                                                  JsonConvert.SerializeObject(payload, jss),
                                                                  "App",
                                                                  "Resend");
                    }
                }
            }
            catch (Exception ex)
            {
                string log = "Send 100 error - " + ex.Message + "\n" + orderUniqueId + ", " + interfaceUniqueId + ", " + userName + ", " + password + ", ";
                res    = _logService.SaveLogEntry(interfaceId, log, interfaceUniqueId);
                retval = -1;
            }
        }