コード例 #1
0
        public List <AddressInformation> GetAllUpazil(string districtName)
        {
            List <AddressInformation> aUpaziltList = new List <AddressInformation>();

            Query = "SELECT DISTINCT[UpazilaName]  FROM AddressInformation Where DistrictName=@districtName";

            Connection.Open();

            Command.Parameters.Clear();
            Command.Parameters.Add("districtName", SqlDbType.VarChar);
            Command.Parameters["districtName"].Value = districtName;

            Command.CommandText = Query;
            Reader = Command.ExecuteReader();
            while (Reader.Read())
            {
                string             upazilaName = Reader["UpazilaName"].ToString();
                AddressInformation address     = new AddressInformation();
                address.UpazilaName = upazilaName;
                aUpaziltList.Add(address);
            }
            Reader.Close();
            Connection.Close();
            return(aUpaziltList);
        }
コード例 #2
0
 public TreatmentFacility(string facilityName, AddressInformation facilityAddress, ContactInformation facilityContactInformation, ContactHours facilityHours)
 {
     FacilityName               = facilityName;
     FacilityAddress            = facilityAddress;
     FacilityContactInformation = facilityContactInformation;
     FacilityHours              = facilityHours;
 }
コード例 #3
0
        public void When_getting_all_info_Then_caches_in_right_order()
        {
            if (!this.canTest)
            {
                return;
            }
            var multipleResults = new AddressInformation[]
            {
                new AddressInformation(new AddressInformationComponent[] { new AddressInformationComponent("LONG", "SHORT", new string[] { "type1", "type2" }) },
                                       new Coordinates(15, 15),
                                       "address",
                                       "type"),
                new AddressInformation(new AddressInformationComponent[] { new AddressInformationComponent("ALONG", "ASHORT", new string[] { "type1", "type2" }) },
                                       new Coordinates(30, 30),
                                       "aaddress",
                                       "type")
            };

            geoMock.Setup(x => x.GetAllAddressInformation("Boston, Massachusetts")).Returns(multipleResults);
            this.postgresGeo = new PostgreSQLCachingGeolocationService(geoMock.Object, this.settings);

            var actual = this.postgresGeo.GetAllAddressInformation("Boston, Massachusetts");

            var second = this.postgresGeo.GetAllAddressInformation("Boston, Massachusetts");

            Assert.That(second, Is.EqualTo(actual));
            geoMock.Verify(x => x.GetAllAddressInformation(It.IsAny <string>()), Times.Once());
        }
コード例 #4
0
        public void AddressCacheMockTest()
        {
            // create a real document service request
            DocumentServiceRequest entity = DocumentServiceRequest.Create(OperationType.Read, ResourceType.Document, AuthorizationTokenType.PrimaryMasterKey);

            // setup mocks for address information
            AddressInformation[] addressInformation = new AddressInformation[3];
            for (int i = 0; i < 3; i++)
            {
                addressInformation[i] = new AddressInformation
                {
                    PhysicalUri = "http://replica-" + i.ToString("G", CultureInfo.CurrentCulture)
                };
            }

            // Address Selector is an internal sealed class that can't be mocked, but its dependency
            // AddressCache can be mocked.
            Mock <IAddressResolver> mockAddressCache = new Mock <IAddressResolver>();

            mockAddressCache.Setup(
                cache => cache.ResolveAsync(
                    It.IsAny <DocumentServiceRequest>(),
                    false /*forceRefresh*/,
                    new CancellationToken()))
            .ReturnsAsync(new PartitionAddressInformation(addressInformation, null, null));

            // validate that the mock works
            PartitionAddressInformation addressInfo = mockAddressCache.Object.ResolveAsync(entity, false, new CancellationToken()).Result;

            Assert.IsTrue(addressInfo.AllAddresses[0] == addressInformation[0]);
        }
コード例 #5
0
        private Mock <IAddressResolver> GetMockAddressCache()
        {
            // construct dummy rntbd URIs
            AddressInformation[] addressInformation = new AddressInformation[3];
            for (int i = 0; i <= 2; i++)
            {
                addressInformation[i] = new AddressInformation(
                    physicalUri: "rntbd://dummytenant.documents.azure.com:14003/apps/APPGUID/services/SERVICEGUID/partitions/PARTITIONGUID/replicas/"
                    + i.ToString("G", CultureInfo.CurrentCulture) + (i == 0 ? "p" : "s") + "/",
                    isPrimary: i == 0,
                    protocol: Documents.Client.Protocol.Tcp,
                    isPublic: true);
            }

            Mock <IAddressResolver> mockAddressCache = new Mock <IAddressResolver>();

            mockAddressCache.Setup(
                cache => cache.ResolveAsync(
                    It.IsAny <DocumentServiceRequest>(),
                    It.IsAny <bool>(),
                    new CancellationToken()))
            .ReturnsAsync(new PartitionAddressInformation(addressInformation));

            return(mockAddressCache);
        }
コード例 #6
0
ファイル: CheckoutController.cs プロジェクト: msalai/webshop
        public ActionResult Index(AddressInformation addressd)
        {
            //SmtpClient client = new SmtpClient();
            //client.Port = 587;
            //client.Host = "smtp.gmail.com";
            //client.EnableSsl = true;
            //client.Timeout = 10000;
            //client.DeliveryMethod = SmtpDeliveryMethod.Network;
            //client.UseDefaultCredentials = false;
            //client.Credentials = new NetworkCredential("*****@*****.**", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");

            //string bodytext = "Nova narudžba je zaprimljena! Kupac: " + addressd.FirstName + " " + addressd.LastName + Environment.NewLine;
            //var products = (List<Item>)Session["cart"];
            //decimal total = 0;
            //foreach (var x in products)
            //{
            //    total += (x.Count * x.Product.Price);
            //    bodytext += (x.Product.Name + " " + x.Product.Price + " " + x.Count + Environment.NewLine);
            //}

            //bodytext += Environment.NewLine + "Total sum: " + total;
            //MailMessage mm = new MailMessage("*****@*****.**", "*****@*****.**", "Narudzba", bodytext);
            //mm.BodyEncoding = UTF8Encoding.UTF8;
            //mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;

            //client.Send(mm);
            return(View("OrderCompleted"));
        }
コード例 #7
0
        /// <summary>
        /// Gets all the address information for all results for a specific address.
        /// </summary>
        /// <param name="address">The address.</param>
        /// <returns></returns>
        public AddressInformation[] GetAllAddressInformation(string address)
        {
            using (var connection = this.GetConnection())
            {
                bool deleteValues = false;
                using (var reader = connection.ExecuteReader("SELECT formatted_address, longitude, latitude, type, components, updated_on FROM address_cache WHERE LOWER(address) = {0} ORDER BY updated_on ASC", address.ToLowerInvariant()))
                {
                    var addresses = new List <AddressInformation>();
                    while (reader.Read())
                    {
                        var expires = reader.GetDateTime(5) + this.MaximumLifeTime;

                        var info = new AddressInformation(
                            GetComponents(reader.GetString(4)),
                            new Coordinates(
                                reader.GetDouble(1),
                                reader.GetDouble(2)
                                ),
                            reader.GetString(0),
                            reader.GetString(3)
                            );
                        addresses.Add(info);

                        if (Clock.UtcNow > expires)
                        {
                            deleteValues = true;
                        }
                    }

                    if (addresses.Any() && !deleteValues)
                    {
                        return(addresses.ToArray());
                    }

                    if (deleteValues)
                    {
                        foreach (var info in addresses)
                        {
                            connection.ExecuteNonQuery("DELETE FROM address_cache WHERE address = {0} AND formatted_address = {1}", address, info.FormattedAddress);
                        }
                    }
                }

                var results = this.decorated.GetAllAddressInformation(address);

                foreach (var result in results)
                {
                    connection.ExecuteNonQuery("INSERT INTO address_cache (address, formatted_address, longitude, latitude, type, components, updated_on) VALUES ({0}, {1}, {2}, {3}, {4}, {5}, {6})",
                                               address,
                                               result.FormattedAddress,
                                               result.Coordinates.Longitude,
                                               result.Coordinates.Latitude,
                                               result.Type,
                                               GetComponents(result.Components),
                                               Clock.UtcNow);
                }
                return(results);
            }
        }
コード例 #8
0
        internal Address(string street, string city, string stretNumber, string homeNumber, Guid id, double squareMeters)
        {
            Id = id;
            _addressInformation = new AddressInformation(street, city, stretNumber, homeNumber, id, squareMeters);
            _meters             = new List <Guid>();

            Publish(new AddressCreated(Id, squareMeters));
        }
コード例 #9
0
 // GET: Information
 public InformationController()
 {
     studentInformation           = new StudentInformation();
     roomInformation              = new RoomInformation();
     districtInformation          = new DistrictInformation();
     addressInformation           = new AddressInformation();
     departmentInformation        = new DepartmentInformation();
     studentDepartmentInformation = new StudentDepartmentInformation();
     mealInformation              = new MealInformation();
     accountInformation           = new AccountInformation();
 }
コード例 #10
0
        public void TransportClientMockTest()
        {
            // create a real document service request
            DocumentServiceRequest entity = DocumentServiceRequest.Create(OperationType.Read, ResourceType.Document, AuthorizationTokenType.PrimaryMasterKey);

            // setup mocks for address information
            AddressInformation[] addressInformation = new AddressInformation[3];

            // construct URIs that look like the actual uri
            // rntbd://yt1prdddc01-docdb-1.documents.azure.com:14003/apps/ce8ab332-f59e-4ce7-a68e-db7e7cfaa128/services/68cc0b50-04c6-4716-bc31-2dfefd29e3ee/partitions/5604283d-0907-4bf4-9357-4fa9e62de7b5/replicas/131170760736528207s/
            for (int i = 0; i < 3; i++)
            {
                addressInformation[i] = new AddressInformation
                {
                    PhysicalUri =
                        "rntbd://dummytenant.documents.azure.com:14003/apps/APPGUID/services/SERVICEGUID/partitions/PARTITIONGUID/replicas/"
                        + i.ToString("G", CultureInfo.CurrentCulture) + (i == 0 ? "p" : "s") + "/"
                };
            }

            // create objects for all the dependencies of the StoreReader
            Mock <TransportClient> mockTransportClient = new Mock <TransportClient>();

            // create mock store response object
            StoreResponse mockStoreResponse = new StoreResponse
            {
                // set lsn and activityid on the store response.
                Headers = new DictionaryNameValueCollection(
                    new NameValueCollection()
                {
                    { WFConstants.BackendHeaders.LSN, "50" },
                    { WFConstants.BackendHeaders.ActivityId, "ACTIVITYID1_1" }
                })
            };

            // setup mock transport client
            mockTransportClient.Setup(
                client => client.InvokeResourceOperationAsync(
                    new Uri(addressInformation[0].PhysicalUri), It.IsAny <DocumentServiceRequest>()))
            .ReturnsAsync(mockStoreResponse);

            TransportClient mockTransportClientObject = mockTransportClient.Object;
            // get response from mock object
            StoreResponse response = mockTransportClientObject.InvokeResourceOperationAsync(new Uri(addressInformation[0].PhysicalUri), entity).Result;

            // validate that the LSN matches
            Assert.IsTrue(response.LSN == 50);

            response.TryGetHeaderValue(WFConstants.BackendHeaders.ActivityId, out string activityId);

            // validate that the ActivityId Matches
            Assert.IsTrue(activityId == "ACTIVITYID1_1");
        }
コード例 #11
0
 /// <summary>
 /// Default Constructor
 /// Calls <see cref="GetAgeOfPatient"/> that returns the age for the patient
 /// Calls <see cref="GetGenderOfPatient"/> that returns an enum with the gender of a patient
 /// </summary>
 /// <param name="name"></param>
 /// <param name="contact"></param>
 /// <param name="address"></param>
 /// <param name="anamnesis"></param>
 /// <param name="diagnosis"></param>
 /// <param name="cpr"></param>
 /// <param name="translationInformation"></param>
 /// <param name="hoursToContact"></param>
 public Patient(string name, ContactInformation contact, AddressInformation address,
                string anamnesis, string diagnosis, int cpr, Translator translationInformation, ContactHours hoursToContact)
     : base(name, contact, address)
 {
     Anamnesis              = anamnesis;
     Diagnosis              = diagnosis;
     Cpr                    = cpr;
     Age                    = GetAgeOfPatient();
     PatientGender          = GetGenderOfPatient();
     TranslationInformation = translationInformation;
     HoursToContact         = hoursToContact;
 }
コード例 #12
0
        public void AddressCacheMockTest()
        {
            // create a real document service request
            DocumentServiceRequest entity = DocumentServiceRequest.Create(OperationType.Read, ResourceType.Document, AuthorizationTokenType.PrimaryMasterKey);

            // setup mocks for address information
            AddressInformation[] addressInformation = new AddressInformation[3];
            for (int i = 0; i < 3; i++)
            {
                addressInformation[i] = new AddressInformation(
                    physicalUri: "http://replica-" + i.ToString("G", CultureInfo.CurrentCulture),
                    isPrimary: false,
                    protocol: default,
コード例 #13
0
        public async Task <int> SaveAddressInformation(AddressInformation addressInformation)
        {
            if (addressInformation.Id != 0)
            {
                _context.AddressInformation.Update(addressInformation);

                await _context.SaveChangesAsync();

                return(1);
            }

            await _context.AddressInformation.AddAsync(addressInformation);

            await _context.SaveChangesAsync();

            return(1);
        }
コード例 #14
0
        private static AddressInformation[] GetMockAddressInformation()
        {
            // setup mocks for address information
            AddressInformation[] addressInformation = new AddressInformation[3];

            // construct URIs that look like the actual uri
            // rntbd://yt1prdddc01-docdb-1.documents.azure.com:14003/apps/ce8ab332-f59e-4ce7-a68e-db7e7cfaa128/services/68cc0b50-04c6-4716-bc31-2dfefd29e3ee/partitions/5604283d-0907-4bf4-9357-4fa9e62de7b5/replicas/131170760736528207s/
            for (int i = 0; i <= 2; i++)
            {
                addressInformation[i] = new AddressInformation(
                    physicalUri: "rntbd://dummytenant.documents.azure.com:14003/apps/APPGUID/services/SERVICEGUID/partitions/PARTITIONGUID/replicas/"
                    + i.ToString("G", CultureInfo.CurrentCulture) + (i == 0 ? "p" : "s") + "/",
                    isPrimary: i == 0,
                    protocol: Documents.Client.Protocol.Tcp,
                    isPublic: true);
            }
            return(addressInformation);
        }
コード例 #15
0
        public List <AddressInformation> GetAllMauza(string unionName)
        {
            List <AddressInformation> aMauzaList = new List <AddressInformation>();

            Query = "SELECT DISTINCT[MauzaName]  FROM AddressInformation Where UnionName='" + unionName + "'";
            Connection.Open();
            Command.CommandText = Query;
            Reader = Command.ExecuteReader();
            while (Reader.Read())
            {
                string             mauzaName = Reader["MauzaName"].ToString();
                AddressInformation address   = new AddressInformation();
                address.MauzaName = mauzaName;
                aMauzaList.Add(address);
            }
            Reader.Close();
            Connection.Close();
            return(aMauzaList);
        }
コード例 #16
0
        public ActionResult Checkout(AddressInformation information)
        {
            SmtpClient client = new SmtpClient();

            client.Port                  = 587;
            client.Host                  = "smtp.gmail.com";
            client.Timeout               = 10000;
            client.EnableSsl             = true;
            client.DeliveryMethod        = SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            client.Credentials           = new NetworkCredential("*****@*****.**", "T3cajtecaj");

            string mailMessage = "Nova narudžba je zaprimljena!" + Environment.NewLine +
                                 " Kupac:" + information.FirstName + " " + information.LastName + Environment.NewLine
                                 + "Adresa: " + Environment.NewLine + information.City + Environment.NewLine + information.Address
                                 + Environment.NewLine + information.ZipCode + Environment.NewLine + information.PhoneNumber + Environment.NewLine;
            var     products = (List <Item>)Session["cart"];
            decimal total    = 0;

            foreach (var product in products)
            {
                if (product.Product.Discount == true)
                {
                    total += (product.Count * product.Product.DiscountPrice);
                }
                else
                {
                    total += (product.Count * product.Product.Price);
                }

                mailMessage += (product.Product.Name + " - " + product.Count + " komada") + Environment.NewLine;
            }
            mailMessage += "Ukupni iznos narudžbe: " + total;

            MailMessage message = new MailMessage("*****@*****.**", "*****@*****.**", "Narudžba", mailMessage);

            message.BodyEncoding = UTF8Encoding.UTF8;
            message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;

            client.Send(message);
            return(View("OrderCompleted"));
        }
コード例 #17
0
        public List <AddressInformation> GetAllDistrict()
        {
            List <AddressInformation> aDistrictList = new List <AddressInformation>();

            Query = "SELECT DISTINCT[DistrictName]  FROM AddressInformation ";

            Connection.Open();
            Command.CommandText = Query;
            Reader = Command.ExecuteReader();
            while (Reader.Read())
            {
                string             districtName = Reader["DistrictName"].ToString();
                AddressInformation address      = new AddressInformation();
                address.DistrictName = districtName;
                aDistrictList.Add(address);
            }
            Reader.Close();
            Connection.Close();
            return(aDistrictList);
        }
コード例 #18
0
        private static UserDetails GetUserDetails(UserInformation userInfo)
        {
            AddressInformation address = userInfo.WorkAddress;

            return(new UserDetails(
                       userInfo.UserId,
                       userInfo.UserName,
                       userInfo.Email,
                       userInfo.FirstName,
                       userInfo.LastName,
                       DateTime.Parse(userInfo.CreatedDateTime),
                       userInfo.PermissionProfileId,
                       new Address(
                           address.Address1,
                           address.Address2,
                           address.City,
                           address.Country,
                           address.Fax,
                           address.Phone,
                           address.PostalCode,
                           address.StateOrProvince)));
        }
コード例 #19
0
        //[AllowAnonymous]
        public async Task <IActionResult> SaveGDManInformation([FromBody] GDManInformationViewModel model)
        {
            //return Ok("Success");
            try
            {
                var user = await _userManager.FindByNameAsync(model.userName);

                string        gdNumber      = RandomString(6);
                GDInformation gDInformation = new GDInformation
                {
                    ApplicationUserId   = user.Id,
                    gdFor               = model.gdFor,
                    gdDate              = DateTime.Now,
                    gdNumber            = gdNumber,
                    gDTypeId            = model.gDTypeId,
                    productTypeId       = model.productTypeId,
                    documentTypeId      = model.documentTypeId == 0 ? null : model.documentTypeId,
                    documentDescription = model.documentDescription,
                    statusId            = 1
                };

                int gdId = await lostAndFoundService.SaveGDInformation(gDInformation);


                ManInformation manInformation = new ManInformation
                {
                    gDInformationId        = gdId,
                    relationTypeId         = model.relationTypeId,
                    name                   = model.name,
                    aproxAge               = model.aproxAge,
                    agePeriodId            = model.agePeriodId,
                    genderId               = model.genderId,
                    isHealthDisabled       = model.isHealthDisabled,
                    fatherName             = model.fatherName,
                    motherName             = model.motherName,
                    spouseName             = model.spouseName,
                    nationalIdentityTypeId = model.manNationalIdentityTypeId,
                    identityNo             = model.identityNo,
                    numberTypeId           = model.numberTypeId,
                    number                 = model.number
                };

                int manid = await lostAndFoundService.SaveManInformation(manInformation);

                if (model.gdFor == "OTHERS")
                {
                    OtherPersonInformation otherPerson = new OtherPersonInformation
                    {
                        gDInformationId        = gdId,
                        nationalIdentityTypeId = model.nationalIdentityTypeId == 0 ? null : model.nationalIdentityTypeId,
                        identityNo             = model.identityNo,
                        mobileNo = model.mobileNo
                    };
                    int opi = await lostAndFoundService.SaveOtherPersonInformation(otherPerson);
                }

                IndentifyInfo indentifyInfo = new IndentifyInfo
                {
                    gDInformationId           = gdId,
                    colorsId                  = model.colorsId,
                    identifySign              = model.identifySign,
                    descriptionCircumcisionId = model.descriptionCircumcisionId,
                    religionId                = model.religionId,
                    bloodGroup                = model.bloodGroup,
                    occupationId              = model.occupationId,
                    maritalStatusId           = model.maritalStatusId
                };
                int identityid = await lostAndFoundService.SaveIndentifyInfo(indentifyInfo);

                AddressInformation addressInformation = new AddressInformation
                {
                    districtId     = model.manDistrictId,
                    thanaId        = model.thanaId,
                    houseVillage   = model.postOffice,
                    addressDetails = model.addressDetails,
                    type           = model.addressType,
                    oneLineAddress = model.oneLineAddress,
                };
                int addressId = await addressInformationService.SaveAddressInformation(addressInformation);

                PhysicalDescription physical = new PhysicalDescription
                {
                    manInformationId                   = manid,
                    eyeTypeId                          = model.eyeTypeId,
                    noseTypeId                         = model.noseTypeId,
                    hairTypeId                         = model.hairTypeId,
                    foreHeadTypeId                     = model.foreHeadTypeId,
                    beardTypeId                        = model.beardTypeId,
                    weight                             = model.weight,
                    bodyStructureId                    = model.bodyStructureId,
                    faceShapeTypeId                    = model.faceShapeTypeId,
                    bodyChinTypeId                     = model.bodyChinTypeId,
                    bodyColorId                        = model.bodyColorId,
                    moustacheTypeId                    = model.moustacheTypeId,
                    earTypeId                          = model.earTypeId,
                    neckTypeId                         = model.neckTypeId,
                    heightFeet                         = model.heightFeet,
                    heightInch                         = model.heightInch,
                    specialBirthMarkTypeId             = model.specialBirthMarkTypeId,
                    specialBirthMarkBodyPartId         = model.specialBirthMarkBodyPartId,
                    specialBirthMarkBodyPartPositionId = model.specialBirthMarkBodyPartPositionId,
                    visibleTatto                       = model.visibleTatto,
                    otherIdentityfyMark                = model.otherIdentityfyMark,
                    teethTypeId                        = model.teethTypeId,
                    specialBodyConditionId             = model.specialBodyConditionId,
                };
                int phyId = await lostAndFoundService.SavePhysicalDescription(physical);

                DressDescription dress = new DressDescription
                {
                    manInformationId   = manid,
                    inTheHeadId        = model.inTheHeadId,
                    inTheHeadColorId   = model.inTheHeadColorId,
                    inTheBodyId        = model.inTheBodyId,
                    inTheBodyColorId   = model.inTheBodyColorId,
                    inTheThroatId      = model.inTheThroatId,
                    inTheThroatColorId = model.inTheThroatColorId,
                    inTheWaistId       = model.inTheWaistId,
                    inTheWaistColorId  = model.inTheWaistColorId,
                    inTheLegsId        = model.inTheLegsId,
                    inTheLegsColorId   = model.inTheLegsColorId,
                    inTheEyeId         = model.inTheEyeId,
                    inTheEyeColorId    = model.inTheEyeColorId,
                    shoesSize          = model.shoesSize,
                    shoesSizeType      = model.shoesSizeType,
                };
                int dressId = await lostAndFoundService.SaveDressDescription(dress);

                SpaceAndTime spaceAndTime = new SpaceAndTime
                {
                    gDInformationId = gdId,
                    placeDetails    = model.placeDetails,
                    lafDate         = model.lafDate,
                    lafTime         = model.lafTime,
                    postOfficeId    = model.postOfficeId,
                    thanaId         = model.thanaId,
                    districtId      = model.districtId,
                    divisionId      = model.divisionId
                };
                int sdid = await lostAndFoundService.SaveSpaceAndTime(spaceAndTime);


                if (model.dNAProfileViewModels != null)
                {
                    List <DNAProfileDetails> lstDNAProfile = new List <DNAProfileDetails>();
                    foreach (var item in model.dNAProfileViewModels)
                    {
                        DNAProfileDetails dNAProfileDetails = new DNAProfileDetails
                        {
                            manInformationId = manid,
                            locous           = item.locous,
                            genotype1        = item.genotype1,
                            genotype2        = item.genotype2
                        };
                        lstDNAProfile.Add(dNAProfileDetails);
                    }

                    int dnaId = await lostAndFoundService.SaveDNAProfileDetails(lstDNAProfile);
                }

                return(Ok(gdNumber));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #20
0
        private static Order PayPalGenerateOrder(int orderNum)
        {
            // putting sample customer details
            var customer = new Customer(
                firstName: "John",
                lastName: "Doe",
                id: "405050606",
                ordersCount: 4,
                email: "*****@*****.**",
                verifiedEmail: true,
                createdAt: new DateTime(2013, 12, 8, 14, 12, 12, DateTimeKind.Local), // make sure to initialize DateTime with the correct timezone
                notes: "No additional info");

            // putting sample billing details
            var billing = new AddressInformation(
                firstName: "Ben",
                lastName: "Rolling",
                address1: "27 5th avenue",
                city: "Manhattan",
                country: "United States",
                countryCode: "US",
                phone: "5554321234",
                address2: "Appartment 5",
                zipCode: "54545",
                province: "New York",
                provinceCode: "NY",
                company: "IBM",
                fullName: "Ben Philip Rolling");

            var shipping = new AddressInformation(
                firstName: "Luke",
                lastName: "Rolling",
                address1: "4 Bermingham street",
                city: "Cherry Hill",
                country: "United States",
                countryCode: "US",
                phone: "55546665",
                provinceCode: "NJ",
                province: "New Jersey");

            var payments = new[] {
                new PaypalPaymentDetails(
                    paymentStatus: "Authorized",
                    authorizationId: "AFSDF332432SDF45DS5FD",
                    payerEmail: "*****@*****.**",
                    payerStatus: "Verified",
                    payerAddressStatus: "Unverified",
                    protectionEligibility: "Partly Eligibile",
                    pendingReason: "Review"
                    )
            };

            var lines = new[]
            {
                new ShippingLine(price: 22.22, title: "Mail"),
                new ShippingLine(price: 2, title: "Ship", code: "A22F")
            };

            var items = new[]
            {
                new LineItem(title: "Bag", price: 55.44, quantityPurchased: 1, productId: "48484", sku: "1272727", registryType: RegistryType.Baby),
                new LineItem(title: "Monster", price: 22.3, quantityPurchased: 3)
            };

            var discountCodes = new[] { new DiscountCode(moneyDiscountSum: 7, code: "1") };

            var order = new Order(
                merchantOrderId: orderNum.ToString(),
                email: "*****@*****.**",
                customer: customer,
                paymentDetails: payments,
                billingAddress: billing,
                shippingAddress: shipping,
                lineItems: items,
                shippingLines: lines,
                gateway: "authorize_net",
                customerBrowserIp: "165.12.1.1",
                currency: "USD",
                totalPrice: 100.60,
                createdAt: DateTime.Now, // make sure to initialize DateTime with the correct timezone
                updatedAt: DateTime.Now, // make sure to initialize DateTime with the correct timezone
                discountCodes: discountCodes);

            return(order);
        }
コード例 #21
0
        /// <summary>
        /// Init webAddressList items
        /// </summary>
        private void SetWebAddreslistItems()
        {
            // Set 3 items to db addressList
            // Set 4 items to WebAddresList
            // 1 db item will be equal to web item

            this.webAddressList.Add(new AddressInformation
            {
                City = "Riga",
                Country = "Latvia",
                PostalCode = "Code1"
            });
            this.webAddressItem = ClassPropertyInitializator.SetProperties<AddressInformation>(new AddressInformation());
            this.webAddressItem.City = "Rigafff";
            this.webAddressList.Add(this.webAddressItem);

            this.webAddressItem = ClassPropertyInitializator.SetProperties<AddressInformation>(new AddressInformation());
            this.webAddressItem.City = "Rigappp";
            this.webAddressList.Add(this.webAddressItem);
        }
コード例 #22
0
        private static OrderCheckout GenerateAdviseOrderCheckout(string orderNum)
        {
            var orderCheckout = new OrderCheckout(orderNum);

            var address = new AddressInformation(
                firstName: "Ben",
                lastName: "Rolling",
                address1: "27 5th avenue",
                city: "Manhattan",
                country: "United States",
                countryCode: "US",
                phone: "5554321234",
                address2: "Appartment 5",
                zipCode: "54545",
                province: "New York",
                provinceCode: "NY",
                company: "IBM",
                fullName: "Ben Philip Rolling");
            AuthenticationResult ar = new AuthenticationResult("05");


            var payments = new[] {
                new CreditCardPaymentDetails(
                    avsResultCode: "Y",
                    cvvResultCode: "n",
                    creditCardBin: "124580",
                    creditCardCompany: "Visa",
                    creditCardNumber: "XXXX-XXXX-XXXX-4242",
                    creditCardToken: "2233445566778899"
                    )
                {
                    AuthenticationResult = ar
                }
            };

            var lines = new[]
            {
                new ShippingLine(price: 22.22, title: "Mail")
            };

            // This is an example for client details section
            var clientDetails = new ClientDetails(
                accept_language: "en-CA",
                user_agent: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"
                );


            // Fill optional fields
            var customer = new Customer(
                firstName: "John",
                lastName: "Doe",
                id: "405050606",
                ordersCount: 4,
                email: "*****@*****.**",
                verifiedEmail: true,
                createdAt: new DateTime(2013, 12, 8, 14, 12, 12, DateTimeKind.Local), // make sure to initialize DateTime with the correct timezone
                notes: "No additional info");

            var items = new[]
            {
                new LineItem(title: "Bag", price: 55.44, quantityPurchased: 1, productId: "48484", sku: "1272727"),
                new LineItem(title: "Monster", price: 22.3, quantityPurchased: 3)
            };

            var discountCodes = new[] { new DiscountCode(moneyDiscountSum: 7, code: "1") };

            orderCheckout.Email             = "*****@*****.**";
            orderCheckout.Currency          = "USD";
            orderCheckout.UpdatedAt         = DateTime.Now; // make sure to initialize DateTime with the correct timezone
            orderCheckout.Gateway           = "authorize_net";
            orderCheckout.CustomerBrowserIp = "165.12.1.1";
            orderCheckout.TotalPrice        = 100.60;
            orderCheckout.CartToken         = "a68778783ad298f1c80c3bafcddeea02f";
            orderCheckout.ReferringSite     = "nba.com";
            orderCheckout.LineItems         = items;
            orderCheckout.DiscountCodes     = discountCodes;
            orderCheckout.ShippingLines     = lines;
            orderCheckout.PaymentDetails    = payments;
            orderCheckout.Customer          = customer;
            orderCheckout.BillingAddress    = address;
            orderCheckout.ShippingAddress   = address;
            orderCheckout.ClientDetails     = clientDetails;

            return(orderCheckout);
        }
コード例 #23
0
        /// <summary>
        /// Generates a new order object
        /// Mind that some of the fields of the order (and it's sub-objects) are optional
        /// </summary>
        /// <param name="orderNum">The order number to put in the order object</param>
        /// <returns></returns>
        private static Order GenerateOrder(int orderNum)
        {
            var customerAddress = new BasicAddress(
                address1: "27 5th avenue",
                city: "Manhattan",
                country: "United States",
                countryCode: "US",
                phone: "5554321234",
                address2: "Appartment 5",
                zipCode: "54545"
                );

            // putting sample customer details
            var customer = new Customer(
                firstName: "John",
                lastName: "Doe",
                id: "405050606",
                ordersCount: 4,
                email: "*****@*****.**",
                verifiedEmail: true,
                createdAt: new DateTime(2013, 12, 8, 14, 12, 12, DateTimeKind.Local), // make sure to initialize DateTime with the correct timezone
                notes: "No additional info",
                address: customerAddress,
                accountType: "Premium");

            // putting sample billing details
            var billing = new AddressInformation(
                firstName: "Ben",
                lastName: "Rolling",
                address1: "27 5th avenue",
                city: "Manhattan",
                country: "United States",
                countryCode: "US",
                phone: "5554321234",
                address2: "Appartment 5",
                zipCode: "54545",
                province: "New York",
                provinceCode: "NY",
                company: "IBM",
                fullName: "Ben Philip Rolling");

            var shipping = new AddressInformation(
                firstName: "Luke",
                lastName: "Rolling",
                address1: "4 Bermingham street",
                city: "Cherry Hill",
                country: "United States",
                countryCode: "US",
                phone: "55546665",
                provinceCode: "NJ",
                province: "New Jersey");

            var payments = new[] {
                new CreditCardPaymentDetails(
                    avsResultCode: "Y",
                    cvvResultCode: "n",
                    creditCardBin: "124580",
                    creditCardCompany: "Visa",
                    creditCardNumber: "XXXX-XXXX-XXXX-4242",
                    creditCardToken: "2233445566778899"
                    )
            };

            var noChargeAmount = new NoChargeDetails(
                refundId: "123444",
                amount: 20.5,
                currency: "GBP",
                reason: "giftcard"
                );

            var lines = new[]
            {
                new ShippingLine(price: 22.22, title: "Mail"),
                new ShippingLine(price: 2, title: "Ship", code: "A22F")
            };

            var recipientSocial = new SocialDetails(
                network: "Facebook",
                publicUsername: "******",
                accountUrl: "http://www.facebook.com/john.smith");

            var recipient = new Recipient(
                email: "*****@*****.**",
                phone: "96522444221",
                social: recipientSocial);


            var items = new[]
            {
                new LineItem(title: "Bag", price: 55.44, quantityPurchased: 1, productId: "48484", sku: "1272727",
                             deliveredTo: DeliveredToType.StorePickup,
                             delivered_at: new DateTime(2016, 12, 8, 14, 12, 12, DateTimeKind.Local), registryType: RegistryType.Wedding),
                new LineItem(title: "Monster", price: 22.3, quantityPurchased: 3,
                             seller: new Seller(customer: customer, correspondence: 1, priceNegotiated: true, startingPrice: 120)),
                // Events Tickets Product (aplicaible for event industry merchants)
                new EventTicketLineItem(
                    title: "Concert",
                    price: 123,
                    quantityPurchased: 1,
                    category: "Singers",
                    subCategory: "Rock",
                    eventName: "Bon Jovy",
                    eventSectionName: "Section",
                    eventCountry: "USA",
                    eventCountryCode: "US",
                    latitude: 0,
                    longitude: 0),
                // Giftcard Product (appliciable for giftcard industry merchants)
                new DigitalLineItem(
                    title: "Concert",
                    price: 123,
                    quantityPurchased: 1,
                    senderName: "John",
                    displayName: "JohnJohn",
                    photoUploaded: true,
                    photoUrl: "http://my_pic_url",
                    greetingPhotoUrl: "http://my_greeting_pic_url",
                    message: "Happy Birthday",
                    greetingMessage: "Happy Birthday from John",
                    cardType: "regular",
                    cardSubType: "birthday",
                    senderEmail: "*****@*****.**",
                    recipient: recipient),
                // Travel ticket product (appliciable for travel industry merchants)
                new TravelTicketLineItem(title: "Concert",
                                         price: 123,
                                         quantityPurchased: 1,
                                         departureCity: "ashdod",
                                         departureCountryCode: "IL",
                                         transportMethod: TransportMethodType.Plane),
                // Accommodation reservation product (appliciable for travel industry merchants)
                new AccommodationLineItem(
                    title: "Hotel Arcadia - Standard Room",
                    price: 476,
                    quantityPurchased: 1,
                    productId: "123",
                    city: "London",
                    countryCode: "GB",
                    rating: "5",
                    numberOfGuests: 2,
                    cancellationPolicy: "Not appliciable",
                    accommodationType: "Hotel"),
                // Ride Ticket Product
                new RideTicketLineItem(
                    title: "Ride to JFK airport",
                    price: 74,
                    quantityPurchased: 1,
                    pickupAddress: shipping,
                    dropoffAddress: billing,
                    pickupDate: new DateTime(2019, 8, 1, 12, 1, 1, DateTimeKind.Local),
                    pickupLatitude: 0,
                    pickupLongitude: 0,
                    dropoffLatitude: 1,
                    dropoffLongitude: 1,
                    routeIndex: 1,
                    legIndex: 1,
                    transportMethod: "Taxi",
                    priceBy: "fixed",
                    vehicleClass: "executive",
                    carrierName: "Best darn taxi company in the world!",
                    driverId: "15EGT701",
                    meetNGreet: "Whenever you meet me, please greet me.",
                    cancellationPolicy: "24 hours in advance",
                    authorizedPayments: 74
                    )
            };

            var discountCodes = new[] { new DiscountCode(moneyDiscountSum: 7, code: "1") };

            DecisionDetails decisionDetails = new DecisionDetails(ExternalStatusType.Approved, DateTime.Now); // make sure to initialize DateTime with the correct timezone

            // This is an example for an order with charge free sums (e.g. gift card payment)
            var chargeFreePayments = new ChargeFreePaymentDetails(
                gateway: "giftcard",
                amount: 45);

            // This is an example for client details section
            var clientDetails = new ClientDetails(
                accept_language: "en-CA",
                user_agent: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)");

            var custom = new Custom(
                app_dom_id: "D2C"
                );

            var order = new Order(
                merchantOrderId: orderNum.ToString(),
                email: "*****@*****.**",
                customer: customer,
                paymentDetails: payments,
                billingAddress: billing,
                shippingAddress: shipping,
                lineItems: items,
                shippingLines: lines,
                gateway: "authorize_net",
                customerBrowserIp: "165.12.1.1",
                currency: "USD",
                totalPrice: 100.60,
                createdAt: DateTime.Now, // make sure to initialize DateTime with the correct timezone
                updatedAt: DateTime.Now, // make sure to initialize DateTime with the correct timezone
                discountCodes: discountCodes,
                source: "web",
                noChargeDetails: noChargeAmount,
                decisionDetails: decisionDetails,
                vendorId: "2",
                vendorName: "domestic",
                additionalEmails: new[] { "*****@*****.**", "*****@*****.**" },
                chargeFreePaymentDetails: chargeFreePayments,
                clientDetails: clientDetails,
                custom: custom,
                groupFounderOrderID: "2222",
                submissionReason: "Manual Decision"
                );

            return(order);
        }
コード例 #24
0
ファイル: Order.cs プロジェクト: aflopes/sdk_net
        /// <summary>
        /// Creates a new order
        /// </summary>
        /// <param name="merchantOrderId">The unique id of the order at the merchant systems</param>
        /// <param name="email">The email used for contact in the order</param>
        /// <param name="customer">The customer information</param>
        /// <param name="paymentDetails">The payment details</param>
        /// <param name="billingAddress">Billing address</param>
        /// <param name="shippingAddress">Shipping address</param>
        /// <param name="lineItems">An array of all products in the order</param>
        /// <param name="shippingLines">An array of all shipping details for the order</param>
        /// <param name="gateway">The payment gateway that was used</param>
        /// <param name="customerBrowserIp">The customer browser ip that was used for the order</param>
        /// <param name="currency">A three letter code (ISO 4217) for the currency used for the payment</param>
        /// <param name="totalPrice">The sum of all the prices of all the items in the order, taxes and discounts included</param>
        /// <param name="createdAt">The date and time when the order was created</param>
        /// <param name="updatedAt">The date and time when the order was last modified</param>
        /// <param name="passengers">Passengers included in the order - used for Travel industry merchants</param>
        /// <param name="discountCodes">An array of objects, each one containing information about an item in the order (optional)</param>
        /// <param name="totalDiscounts">The total amount of the discounts on the Order (optional)</param>
        /// <param name="cartToken">Unique identifier for a particular cart or session that is attached to a particular order. The same ID should be passed in the Beacon JS (optional)</param>
        /// <param name="totalPriceUsd">The price in USD (optional)</param>
        /// <param name="closedAt">The date and time when the order was closed. If the order was closed (optional)</param>
        /// <param name="financialStatus">The financial status of the order (could be paid/voided/refunded/partly_paid/etc.)</param>
        /// <param name="fulfillmentStatus">The fulfillment status of the order</param>
        /// <param name="source">The source of the order</param>
        /// <param name="noChargeDetails">No charge sums - including all payments made for this order in giftcards, cash, checks or other non chargebackable payment methods</param>
        /// <param name="clientDetails">Technical information regarding the customer's browsing session</param>
        /// <param name="chargeFreePaymentDetails">Payment sums made using non-chargebackable methods and should be omitted from the Chargeback gurantee sum and Riskified fee</param>
        /// <param name="submissionReason">The reason for submitting this order for review</param>
        /// <param name="custom">Custom data object</param>
        public Order(string merchantOrderId,
                     string email,
                     Customer customer,
                     AddressInformation billingAddress,
                     AddressInformation shippingAddress,
                     LineItem[] lineItems,
                     ShippingLine[] shippingLines,
                     string gateway,
                     string customerBrowserIp,
                     string currency,
                     double totalPrice,
                     DateTime?createdAt,
                     DateTime updatedAt,
                     Passenger[] passengers         = null,
                     IPaymentDetails paymentDetails = null,
                     DiscountCode[] discountCodes   = null,
                     double?totalDiscounts          = null,
                     string cartToken                = null,
                     double?totalPriceUsd            = null,
                     DateTime?closedAt               = null,
                     string financialStatus          = null,
                     string fulfillmentStatus        = null,
                     string source                   = null,
                     NoChargeDetails noChargeDetails = null,
                     string[] additionalEmails       = null,
                     string vendorId                 = null,
                     string vendorName               = null,
                     DecisionDetails decisionDetails = null,
                     ClientDetails clientDetails     = null,
                     ChargeFreePaymentDetails chargeFreePaymentDetails = null,
                     string groupFounderOrderID = null,
                     string referringSite       = null,
                     string note      = null,
                     string name      = null,
                     string orderType = null,
                     SubmissionReason?submissionReason = null,
                     Custom custom = null)
            : base(merchantOrderId)
        {
            LineItems         = lineItems;
            ShippingLines     = shippingLines;
            BillingAddress    = billingAddress;
            ShippingAddress   = shippingAddress;
            Customer          = customer;
            Email             = email;
            CustomerBrowserIp = customerBrowserIp;
            Currency          = currency;
            TotalPrice        = totalPrice;
            Gateway           = gateway;
            CreatedAt         = createdAt;
            UpdatedAt         = updatedAt;

            // optional fields
            Passengers               = passengers;
            PaymentDetails           = paymentDetails;
            DiscountCodes            = discountCodes;
            TotalPriceUsd            = totalPriceUsd;
            TotalDiscounts           = totalDiscounts;
            CartToken                = cartToken;
            ClosedAt                 = closedAt;
            FinancialStatus          = financialStatus;
            FulfillmentStatus        = fulfillmentStatus;
            Source                   = source;
            NoChargeAmount           = noChargeDetails;
            AdditionalEmails         = additionalEmails;
            VendorId                 = vendorId;
            VendorName               = vendorName;
            Decision                 = decisionDetails;
            ClientDetails            = clientDetails;
            Custom                   = custom;
            ChargeFreePaymentDetails = chargeFreePaymentDetails;
            Name             = name;
            ReferringSite    = referringSite;
            Note             = note;
            OrderType        = orderType;
            SubmissionReason = submissionReason;

            // This field is added for gift card group purchase
            GroupFounderOrderID = groupFounderOrderID;
        }
コード例 #25
0
 /// <summary>
 /// Default Constructor
 /// </summary>
 /// <param name="name"></param>
 /// <param name="contact"></param>
 /// <param name="address"></param>
 public Practitioner(string name, ContactInformation contact, AddressInformation address)
     : base(name, contact, address)
 {
 }
コード例 #26
0
 // GET: Update
 public UpdateController()
 {
     addressInformation = new AddressInformation();
     studentInformation = new StudentInformation();
     mealInformation    = new MealInformation();
 }
コード例 #27
0
 public ReferringAuthority(string name, ContactInformation contact, AddressInformation address,
                           ContactHours hoursToContact)
     : base(name, contact, address)
 {
     HoursToContact = hoursToContact;
 }
コード例 #28
0
ファイル: Program.cs プロジェクト: hdpham77/Test
 public static string GetWashedAddress(AddressInformation info)
 {
     return(info.Street + " " + info.City + ", " + info.State + " " + info.ZipCode);
 }
コード例 #29
0
ファイル: Program.cs プロジェクト: hdpham77/Test
        private static void Main(string[] args)
        {
            Console.WriteLine("CERS2 Address Washing Utility, v0.01");
            Console.WriteLine("Initializing Data Registry...");
            DataRegistry.Initialize();
            int successCount              = 0;
            int failureCount              = 0;
            int lengthViolationsCount     = 0;
            int skippedDueToMissingStreet = 0;

            bool lengthViolation = false;

            using (ICERSRepositoryManager repo = ServiceLocator.GetRepositoryManager())
            {
                ICERSSystemServiceManager services = ServiceLocator.GetSystemServiceManager(repo);
                Console.WriteLine("Gathering Facilities...");

                //DateTime washDate = DateTime.Now.Date.AddDays( -3 );
                //DateTime washDate = Convert.ToDateTime( "12/31/2013" );
                DateTime washDate = Convert.ToDateTime("6/30/2014");

                //var facilities = repo.Facilities.Search(washDate: washDate).ToList();

                var facilities = (from fac in repo.DataModel.Facilities where !fac.Voided && !fac.IsAddressWashed && fac.WashDate > washDate select fac).ToList();

                //var facilities = ( from facil in repo.DataModel.Facilities where facil.Voided == false select facil ).ToList();

                Console.WriteLine("Found " + facilities.Count() + " Facilities...");
                foreach (var facility in facilities)
                {
                    lengthViolation = false;
                    Console.WriteLine("CERSID: " + facility.CERSID);
                    Console.WriteLine("Facility Name: " + facility.Name);
                    Console.Write("\tSource Address: ");
                    Console.WriteLine(GetSourceAddress(facility));
                    if (!string.IsNullOrWhiteSpace(facility.Street))
                    {
                        Console.Write("\tWashed Address:");
                        AddressInformation result = services.Geo.GetAddressInformation(facility.Street, facility.City, facility.ZipCode, facility.State);
                        if (result != null)
                        {
                            CheckLength("WashedStreet", result.Street, 100, ref lengthViolation);
                            CheckLength("WashedCity", result.City, 100, ref lengthViolation);
                            CheckLength("WashedState", result.State, 2, ref lengthViolation);
                            CheckLength("WashedZipCode", result.ZipCode, 10, ref lengthViolation);

                            if (!lengthViolation)
                            {
                                int washConfidence;
                                if (int.TryParse(result.MelissaAddressWashConfidence, out washConfidence) == false)
                                {
                                    washConfidence = 0;
                                }

                                if (result.MelissaAddressWashSucceeded && Convert.ToInt32(washConfidence) > 0)
                                {
                                    facility.IsAddressWashed           = true;
                                    facility.WashDate                  = DateTime.Now;
                                    facility.WashedStreet              = result.Street;
                                    facility.WashedStreetWithoutSuite  = result.StreetWithoutSuiteNumber;
                                    facility.WashedSuite               = result.Suite;
                                    facility.WashedCity                = result.City;
                                    facility.WashedState               = result.State;
                                    facility.WashedZipCode             = result.ZipCode;
                                    facility.WashedStreetName          = result.StreetName;
                                    facility.WashedStreetPostDirection = result.PostDirection;
                                    facility.WashedStreetPreDirection  = result.PreDirection;
                                    facility.WashedStreetRange         = result.Range;
                                    facility.WashedStreetSuffix        = result.Suffix;
                                    facility.WashConfidence            = washConfidence;
                                    facility.WashSourceID              = (int)WashSource.Melissa;
                                    if (facility.CountyID == null)
                                    {
                                        facility.CountyID = result.CountyID;
                                    }

                                    CERSFacilityGeoPoint geoPoint = facility.CERSFacilityGeoPoint;

                                    if (geoPoint == null)
                                    {
                                        geoPoint = new CERSFacilityGeoPoint();
                                    }

                                    //make sure the result coordinates are in range before saving them
                                    if ((result.Latitude >= 32 && result.Latitude < 43) && (result.Longitude >= -114 && result.Longitude < 125))
                                    {
                                        geoPoint.CERSID                       = facility.CERSID;
                                        geoPoint.LatitudeMeasure              = result.Latitude;
                                        geoPoint.LongitudeMeasure             = result.Longitude;
                                        geoPoint.HorizontalAccuracyMeasure    = result.HorizontalAccuracyMeasure;
                                        geoPoint.HorizontalCollectionMethodID = result.HorizontalCollectionMethodID;
                                        geoPoint.HorizontalReferenceDatumID   = result.HorizontalReferenceDatumID;
                                        geoPoint.GeographicReferencePointID   = result.GeographicReferencePointID;
                                        geoPoint.SetCommonFields();
                                        repo.CERSFacilityGeoPoints.Save(geoPoint);
                                    }
                                }
                                else if (result.MelissaAddressWashSucceeded)
                                {
                                    //Use the parsed street values to get a standardized address

                                    facility.IsAddressWashed           = false;
                                    facility.WashDate                  = DateTime.Now;
                                    facility.WashSourceID              = (int)WashSource.Melissa;
                                    facility.WashedStreet              = result.Street;
                                    facility.WashedStreetWithoutSuite  = result.StreetWithoutSuiteNumber;
                                    facility.WashedSuite               = result.Suite;
                                    facility.WashedCity                = result.City;
                                    facility.WashedState               = result.State;
                                    facility.WashedZipCode             = result.ZipCode;
                                    facility.WashedStreetName          = result.StreetName;
                                    facility.WashedStreetPostDirection = null;
                                    facility.WashedStreetPreDirection  = null;
                                    facility.WashedStreetRange         = result.Range;
                                    facility.WashedStreetSuffix        = result.Suffix;
                                }

                                Console.WriteLine(GetWashedAddress(result));
                                Console.WriteLine("\tUpdating Facility...");
                                repo.Facilities.Save(facility);
                                Console.WriteLine("\tFacility Updated");
                                successCount++;
                            }
                            else
                            {
                                Console.WriteLine("\tFacility NOT Updated");
                                lengthViolationsCount++;
                            }
                        }
                        else
                        {
                            Console.WriteLine("Unable to obtain washed address.");
                            failureCount++;
                        }
                    }
                    else
                    {
                        skippedDueToMissingStreet++;
                        Console.WriteLine("\tSkipped Due to Missing Street!");
                    }
                }

                Console.WriteLine("Process Completed.");
                Console.WriteLine("Successfully Washed: " + successCount);
                Console.WriteLine("Failed To Wash: " + failureCount);
                Console.WriteLine("Length Violations (NOT Washed): " + lengthViolationsCount);
                Console.WriteLine("Skipped Due to Missing Street: " + skippedDueToMissingStreet);
            }
            Console.Write("Press enter to quit.");
            Console.ReadLine();
        }
コード例 #30
0
        public void EnvelopeCreateWithSmsAuthenticationDocumentTest()
        {
            ConfigLoader.LoadConfig();

            bool expected = true;
            bool actual   = false;

            Account acct = new Account();

            acct.AccountName = Util.MakeUnique("freakin me out {unique}");
            acct.Email       = Util.MakeUnique("freakin_{unique}@gmail.com");
            acct.Password    = "******";

            AddressInformation ai = new AddressInformation();

            acct.Address  = ai;
            ai.address1   = "123 Main ST";
            ai.address2   = string.Empty;
            ai.city       = "Anytown";
            ai.country    = "USA";
            ai.postalCode = "11111";
            ai.state      = "WA";

            CreditCardInformation cc = new CreditCardInformation();

            acct.CreditCard    = cc;
            cc.cardNumber      = "4111111111111111";
            cc.cardType        = "visa";
            cc.expirationMonth = "12";
            cc.expirationYear  = "2015";
            cc.nameOnCard      = "Freak Me Out";

            try
            {
                actual = acct.Create();
            }
            catch (Exception)
            {
            }

            Assert.AreEqual(expected, actual);
            Assert.IsFalse(string.IsNullOrEmpty(acct.BaseUrl));

            if (expected == actual)
            {
                Envelope target = new Envelope();
                target.Login = acct;

                // add signers to the envelope
                target.Recipients = new Recipients()
                {
                    signers = new Signer[]
                    {
                        new Signer()
                        {
                            email                    = "freakin_{unique}@gmail.com",
                            name                     = "freakin",
                            routingOrder             = "1",
                            recipientId              = "1",
                            requireIdLookup          = "true",
                            idCheckConfigurationName = "SMS Auth $",
                            smsAuthentication        = new SmsAuthentication()
                            {
                                senderProvidedNumbers = new string[]
                                {
                                    String.Format("+{0} {1}", "34", "000000000")
                                }
                            }
                        }
                    }
                };

                // Email subject is a required parameter when requesting signatures
                target.EmailSubject = "Example subject";

                // "sent" to send immediately, "created" to save envelope as draft
                target.Status = "sent";

                FileInfo fi   = new FileInfo("./Test Contract.pdf");
                string   path = fi.FullName;

                actual = false;

                try
                {
                    actual = target.Create(path);
                }
                catch (ArgumentNullException)
                {
                }

                Assert.AreEqual(expected, actual);
                Assert.IsFalse(string.IsNullOrEmpty(target.SenderViewUrl));
            }
        }
コード例 #31
0
        public void EnvelopeCreateWithDocumentTest()
        {
            ConfigLoader.LoadConfig();

            bool expected = true;
            bool actual   = false;

            Account acct = new Account();

            acct.AccountName = Util.MakeUnique("freakin me out {unique}");
            acct.Email       = Util.MakeUnique("freakin_{unique}@gmail.com");
            acct.Password    = "******";

            AddressInformation ai = new AddressInformation();

            acct.Address  = ai;
            ai.address1   = "123 Main ST";
            ai.address2   = string.Empty;
            ai.city       = "Anytown";
            ai.country    = "USA";
            ai.postalCode = "11111";
            ai.state      = "WA";

            CreditCardInformation cc = new CreditCardInformation();

            acct.CreditCard    = cc;
            cc.cardNumber      = "4111111111111111";
            cc.cardType        = "visa";
            cc.expirationMonth = "12";
            cc.expirationYear  = "2015";
            cc.nameOnCard      = "Freak Me Out";

            try
            {
                actual = acct.Create();
            }
            catch (Exception)
            {
            }

            Assert.AreEqual(expected, actual);
            Assert.IsFalse(string.IsNullOrEmpty(acct.BaseUrl));

            Envelope target = new Envelope();

            target.Login = acct;
            FileInfo fi   = new FileInfo("./Test Contract.pdf");
            string   path = fi.FullName;

            actual = false;

            try
            {
                actual = target.Create(path);
            }
            catch (ArgumentNullException)
            {
            }

            Assert.AreEqual(expected, actual);
            Assert.IsFalse(string.IsNullOrEmpty(target.SenderViewUrl));
        }
コード例 #32
0
ファイル: InvestorController.cs プロジェクト: jsingh/DeepBlue
        public ActionResult UpdateInvestorAddress(FormCollection collection)
        {
            AddressInformation model = new AddressInformation();
            this.TryUpdateModel(model, collection);
            ResultModel resultModel = new ResultModel();
            if (ModelState.IsValid) {
                InvestorAddress investorAddress = null;
                if ((model.AddressId ?? 0) > 0)
                    investorAddress = InvestorRepository.FindInvestorAddress(model.AddressId ?? 0);
                if (investorAddress == null) {
                    investorAddress = new InvestorAddress();
                    investorAddress.CreatedBy = Authentication.CurrentUser.UserID;
                    investorAddress.CreatedDate = DateTime.Now;
                    investorAddress.Address = new Address();
                    investorAddress.Address.CreatedBy = Authentication.CurrentUser.UserID;
                    investorAddress.Address.CreatedDate = DateTime.Now;
                }
                investorAddress.EntityID = Authentication.CurrentEntity.EntityID;
                investorAddress.LastUpdatedBy = Authentication.CurrentUser.UserID;
                investorAddress.LastUpdatedDate = DateTime.Now;

                if (investorAddress.Address == null) {
                    investorAddress.Address = new Address {
                        CreatedBy = Authentication.CurrentUser.UserID,
                        CreatedDate = DateTime.Now,
                    };
                }

                investorAddress.Address.EntityID = Authentication.CurrentEntity.EntityID;
                investorAddress.Address.AddressTypeID = (int)DeepBlue.Models.Admin.Enums.AddressType.Work;
                investorAddress.Address.Address1 = model.Address1;
                investorAddress.Address.Address2 = model.Address2;
                investorAddress.Address.City = model.City;
                investorAddress.Address.PostalCode = model.Zip;
                investorAddress.Address.Country = model.Country;
                investorAddress.Address.State = model.State;
                investorAddress.Address.LastUpdatedBy = Authentication.CurrentUser.UserID;
                investorAddress.Address.LastUpdatedDate = DateTime.Now;
                investorAddress.InvestorID = model.InvestorId;

                IEnumerable<ErrorInfo> errorInfo = InvestorRepository.SaveInvestorAddress(investorAddress);

                if (errorInfo == null) {
                    List<InvestorCommunication> investorCommunications = InvestorRepository.FindInvestorCommunications(model.InvestorId);

                    // Assign communication values

                    InvestorCommunication investorCommunication = investorCommunications.Where(communication => communication.Communication.CommunicationTypeID == (int)Models.Admin.Enums.CommunicationType.HomePhone).FirstOrDefault();
                    AddCommunication(ref investorCommunication, Models.Admin.Enums.CommunicationType.HomePhone, model.Phone, model.InvestorId);
                    errorInfo = InvestorRepository.SaveInvestorCommunication(investorCommunication);

                    if (errorInfo == null) {
                        investorCommunication = investorCommunications.Where(communication => communication.Communication.CommunicationTypeID == (int)Models.Admin.Enums.CommunicationType.Email).FirstOrDefault();
                        AddCommunication(ref investorCommunication, Models.Admin.Enums.CommunicationType.Email, model.Email, model.InvestorId);
                        errorInfo = InvestorRepository.SaveInvestorCommunication(investorCommunication);
                    }
                    if (errorInfo == null) {
                        investorCommunication = investorCommunications.Where(communication => communication.Communication.CommunicationTypeID == (int)Models.Admin.Enums.CommunicationType.WebAddress).FirstOrDefault();
                        AddCommunication(ref investorCommunication, Models.Admin.Enums.CommunicationType.WebAddress, model.WebAddress, model.InvestorId);
                        errorInfo = InvestorRepository.SaveInvestorCommunication(investorCommunication);
                    }
                    if (errorInfo == null) {
                        investorCommunication = investorCommunications.Where(communication => communication.Communication.CommunicationTypeID == (int)Models.Admin.Enums.CommunicationType.Fax).FirstOrDefault();
                        AddCommunication(ref investorCommunication, Models.Admin.Enums.CommunicationType.Fax, model.Fax, model.InvestorId);
                        errorInfo = InvestorRepository.SaveInvestorCommunication(investorCommunication);
                    }
                }
                resultModel.Result = ValidationHelper.GetErrorInfo(errorInfo);
                if (string.IsNullOrEmpty(resultModel.Result)) {
                    resultModel.Result += "True||" + investorAddress.InvestorAddressID;
                }
            }
            else {
                foreach (var values in ModelState.Values.ToList()) {
                    foreach (var err in values.Errors.ToList()) {
                        if (string.IsNullOrEmpty(err.ErrorMessage) == false) {
                            resultModel.Result += err.ErrorMessage + "\n";
                        }
                    }
                }
            }
            return View("Result", resultModel);
        }