示例#1
0
        public void EditAddressShouldChangeAddressValues()
        {
            DbContextOptions <UltimateMoviesDbContext> options = new DbContextOptionsBuilder <UltimateMoviesDbContext>()
                                                                 .UseInMemoryDatabase(databaseName: "Addresses_EditAddress_Database")
                                                                 .Options;
            UltimateMoviesDbContext db = new UltimateMoviesDbContext(options);

            IAddressesService addressesService = new AddressService(db);

            db.Addresses.Add(new Address
            {
                Country = "Country",
                City    = "City",
                Street  = "Street",
                AdditionalInformation = "Additional Information",
                Postcode = 1111
            });

            db.SaveChanges();

            addressesService.EditAddress("co", "ci", "st", "ai", 11, db.Addresses.Last().Id);

            Assert.Equal("co", db.Addresses.Last().Country);
            Assert.Equal("ci", db.Addresses.Last().City);
            Assert.Equal("st", db.Addresses.Last().Street);
            Assert.Equal("ai", db.Addresses.Last().AdditionalInformation);
            Assert.Equal(11, db.Addresses.Last().Postcode);
        }
        public int Add(/*[FromBody]*/ AddressItem item)
        {
            this.ControllerContext.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", AccessControlForUrlBase);
            var result = new AddressService().Add(item);

            return(result);
        }
        public void RefreshData()
        {
            AddressService service = new AddressService();

            addresses = new ObservableCollection <AddressEntity>(service.GetAllAddresses());
            this.lvAddreses.ItemsSource = addresses;
        }
示例#4
0
        public void ReturnUpdatedCustomer()
        {
            var options           = Utils.GetOptions(nameof(ReturnUpdatedCustomer));
            var updateCustomerDTO = new Mock <UpdateCustomerDTO>().Object;

            updateCustomerDTO.FirstName = "John";
            updateCustomerDTO.LastName  = "Smith";
            updateCustomerDTO.Email     = "*****@*****.**";
            updateCustomerDTO.AddressId = 1;
            using (var arrContext = new DeliverItContext(options))
            {
                arrContext.Customers.AddRange(Utils.SeedCustomers());
                arrContext.Addresses.AddRange(Utils.SeedAddresses());
                arrContext.Cities.AddRange(Utils.SeedCities());
                arrContext.SaveChanges();
            }
            using (var actContext = new DeliverItContext(options))
            {
                var sutHelp  = new AddressService(actContext);
                var sut      = new CustomerService(actContext, sutHelp);
                var result   = sut.Update(1, updateCustomerDTO);
                var customer = actContext.Customers.FirstOrDefault(c => c.Id == 1);

                Assert.AreEqual(customer.FirstName, result.FirstName);
                Assert.AreEqual(customer.LastName, result.LastName);
                Assert.AreEqual(customer.Email, result.Email);
                Assert.AreEqual(customer.Address.StreetName + ", " + customer.Address.City.Name, result.Address);
                Assert.IsInstanceOfType(result, typeof(CustomerDTO));
            }
        }
        public List <AddressItem> Addresses()
        {
            this.ControllerContext.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", AccessControlForUrlBase);
            var result = new AddressService().Addresses();

            return(result);
        }
示例#6
0
        public void TestarBairroNaoNullo()
        {
            var service = new AddressService(ServiceEnum.ViaCEP);
            var address = service.GetAddress("74922330");

            Assert.IsNotNull(address.Neighborhood);
        }
示例#7
0
        public void TestarRemocaoDeCaracterEspecialDoCep()
        {
            var service = new AddressService(ServiceEnum.Postmon);
            var address = service.RemoveCaracter("74223-170");

            Assert.AreEqual(address, "74223170");
        }
示例#8
0
        public IHttpActionResult SellerGetAllAddresses()
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var session = HttpContext.Current.Request.Cookies.Get("sessionId");

            if (session == null)
            {
                return(BadRequest("Not Login"));
            }

            int sellerId = SellerSession.GetSellerIdFromSession(int.Parse(session.Value));

            if (sellerId < 0)
            {
                return(BadRequest("Not Login"));
            }

            SellerAddress[] sellerAddresses = AddressService.SellerGetAllAddresses(sellerId);
            if (sellerAddresses.Length == 0)
            {
                return(BadRequest("No Address"));
            }

            return(Ok(sellerAddresses));
        }
示例#9
0
        public ActionResult ValidateAddress(FormCollection form)
        {
            var model = new AddressValidationJsonModel();

            var address = new Address
            {
                CountryBvin = form["country"] ?? string.Empty,
                Line1       = form["address"] ?? string.Empty,
                Line2       = form["address2"] ?? string.Empty,
                City        = form["city"] ?? string.Empty,
                PostalCode  = form["zip"] ?? string.Empty,
                RegionBvin  = form["state"] ?? string.Empty
            };

            var     service = new AddressService(HccApp.CurrentStore);
            string  message;
            Address nmAddr = null;

            model.IsValid = service.Validate(address, out message, out nmAddr);
            var isNormalized = nmAddr != null;

            model.Message               = message;
            model.NormalizedAddress     = nmAddr;
            model.NormalizedAddressHtml = isNormalized ? nmAddr.GetLinesHtml(false, false) : null;
            model.OriginalAddressHtml   = address.GetLinesHtml(false, false);

            return(new PreJsonResult(Web.Json.ObjectToJson(model)));
        }
示例#10
0
 public ActionResult AddAdressManager(List <int> users, string code, int companySysNo)
 {
     AddressService.InsertAddressManager(users, code, companySysNo);
     return(Json(new AjaxResult {
         Success = true
     }));
 }
示例#11
0
        protected override void RunCallback()
        {
            CompanyDTO company   = null;
            var        dbFactory = new DbFactory();
            var        time      = new TimeService(dbFactory);
            var        settings  = new SettingsService(dbFactory);
            var        log       = GetLogger();

            using (var db = dbFactory.GetRDb())
            {
                company = db.Companies.GetByIdWithSettingsAsDto(CompanyId);
            }

            var companyAddress    = new CompanyAddressService(company);
            var addressService    = new AddressService(null, companyAddress.GetReturnAddress(MarketIdentifier.Empty()), companyAddress.GetPickupAddress(MarketIdentifier.Empty()));
            var emailSmtpSettings = SettingsBuilder.GetSmtpSettingsFromCompany(company, AppSettings.IsDebug, AppSettings.IsSampleLabels);

            var actionService = new SystemActionService(log, time);
            var emailService  = new EmailService(log, emailSmtpSettings, addressService);

            var lastSyncDate = settings.GetOrdersAdjustmentDate(_api.Market, _api.MarketplaceId);

            using (var db = dbFactory.GetRWDb())
            {
                LogWrite("Last sync date=" + lastSyncDate);

                if (!lastSyncDate.HasValue ||
                    (time.GetUtcTime() - lastSyncDate) > _betweenProcessingInverval)
                {
                    var updater = new BaseOrderRefundService(_api, actionService, emailService, log, time);
                    updater.ProcessRefunds(db, null);
                    settings.SetOrdersAdjustmentDate(time.GetUtcTime(), _api.Market, _api.MarketplaceId);
                }
            }
        }
示例#12
0
        public async void Update_ErrorsOccurred_ShouldReturnErrorResponse()
        {
            var mock          = new ServiceMockFacade <IAddressService, IAddressRepository>();
            var model         = new ApiAddressServerRequestModel();
            var validatorMock = new Mock <IApiAddressServerRequestModelValidator>();

            validatorMock.Setup(x => x.ValidateUpdateAsync(It.IsAny <int>(), It.IsAny <ApiAddressServerRequestModel>())).Returns(Task.FromResult(new ValidationResult(new List <ValidationFailure>()
            {
                new ValidationFailure("text", "test")
            })));
            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(new Address()));
            var service = new AddressService(mock.LoggerMock.Object,
                                             mock.MediatorMock.Object,
                                             mock.RepositoryMock.Object,
                                             validatorMock.Object,
                                             mock.DALMapperMockFactory.DALAddressMapperMock,
                                             mock.DALMapperMockFactory.DALCallMapperMock);

            UpdateResponse <ApiAddressServerResponseModel> response = await service.Update(default(int), model);

            response.Should().NotBeNull();
            response.Success.Should().BeFalse();
            validatorMock.Verify(x => x.ValidateUpdateAsync(It.IsAny <int>(), It.IsAny <ApiAddressServerRequestModel>()));
            mock.MediatorMock.Verify(x => x.Publish(It.IsAny <AddressUpdatedNotification>(), It.IsAny <CancellationToken>()), Times.Never());
        }
        public void Not_Add_IfAddress_Exists()
        {
            var contextOptions = new DbContextOptionsBuilder <LibrarySystemContext>()
                                 .UseInMemoryDatabase(databaseName: "Not_Add_IfAddress_Exists")
                                 .Options;
            var validationMock = new Mock <CommonValidations>();

            string streetAddress1 = "str test 1";
            string streetAddress2 = "str test 1";

            // Act
            using (var actContext = new LibrarySystemContext(contextOptions))
            {
                var unit = new UnitOfWork(actContext);
                var repo = unit.GetRepo <Address>();

                var service = new AddressService(unit, validationMock.Object);

                service.AddAddress(streetAddress1, 1);
                service.AddAddress(streetAddress2, 1);
            }

            // Assert
            using (var assertContext = new LibrarySystemContext(contextOptions))
            {
                var unit = new UnitOfWork(assertContext);
                var repo = unit.GetRepo <Address>();

                var service = new AddressService(unit, validationMock.Object);

                int count = assertContext.Addresses.Count();
                Assert.AreEqual(1, count);
                Assert.AreEqual(streetAddress1, assertContext.Addresses.First().StreetAddress);
            }
        }
        public void ShouldGetZipByState()
        {
            var addressService = new AddressService(new DataManager(), new RandomNumberGenerator());
            var zip            = addressService.GetZip("WA");

            zip.ShouldContain("990");
        }
示例#15
0
        public void GetAddresssPaged_Success_Test()
        {
            // Arrange
            string searchTerm = "";
            int    pageIndex  = 0;
            int    pageSize   = 10;

            // list
            IList <R_Address> list = new List <R_Address>();

            for (int i = 1; i <= pageSize; i++)
            {
                list.Add(SampleAddress(i));
            }

            // create mock for repository
            var mock = new Mock <IAddressRepository>();

            mock.Setup(s => s.GetAddresss(Moq.It.IsAny <string>(), Moq.It.IsAny <int>(), Moq.It.IsAny <int>())).Returns(list);

            // service
            AddressService addressService = new AddressService();

            AddressService.Repository = mock.Object;

            // Act
            var        resultList = addressService.GetAddresss(searchTerm, pageIndex, pageSize);
            AddressDTO result     = resultList.FirstOrDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.AddressId);
            Assert.AreEqual(10, resultList.Count);
        }
示例#16
0
        // GET: Default
        public ActionResult Index()
        {
            var addressService = new AddressService();

            addressService.GetAddress();
            return(View());
        }
示例#17
0
        public void TestarBairroNullCEPGenerico()
        {
            var service = new AddressService(ServiceEnum.ViaCEP);
            var address = service.GetAddress("77500000");

            Assert.IsNotNull(address.Neighborhood);
        }
示例#18
0
        public async Task ReturnProper_WhenValidOfferIdIsPassed()
        {
            int validOfferId = 1;

            var sale = new OfferCUViewModel
            {
                OfferID         = validOfferId,
                ClientID        = 1,
                OrderDate       = new DateTime(2019, 5, 5),
                AddressID       = 1,
                CityID          = 1,
                CountryID       = 1,
                ProductDiscount = 10,
                DeadlineDate    = new DateTime(2019, 5, 5).AddDays(1),
                DeliveryDate    = new DateTime(2019, 5, 5)
            };

            var sut = CreateController();

            sut.ModelState.ClearValidationState("error");

            //Act
            var result = await sut.Edit(validOfferId, sale);

            //Assert
            Assert.IsInstanceOfType(result, typeof(RedirectToActionResult));


            OfferService.Verify(mock => mock.UpdateOfferAsync(validOfferId, 1, 10, new DateTime(2019, 5, 5), 1, new DateTime(2019, 5, 5), 1, 1, 1), Times.Once());

            AddressService.Verify(mock => mock.GetAllAddressesAsync(), Times.Never());
            CityService.Verify(mock => mock.GetAllCitiesAsync(), Times.Never());
            CountryService.Verify(mock => mock.GetAllCountriesAsync(), Times.Never());
            ClientService.Verify(mock => mock.GetAllClientsAsync(It.IsAny <int>(), It.IsAny <int>(), "*"), Times.Never());
        }
示例#19
0
        private AddressService CreateAddressService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new AddressService(userId);

            return(service);
        }
示例#20
0
        public async Task ReturnResutViewWithProperModel_WhenValidOfferModelIsAndInvalidIdPassed()
        {
            int validOfferId = 1;

            var sale = new OfferCUViewModel
            {
                OfferID         = validOfferId,
                ClientID        = 1,
                DeadlineDate    = new DateTime(2019, 5, 5),
                AddressID       = 1,
                CityID          = 1,
                CountryID       = 1,
                ProductDiscount = 10,
            };

            var sut = CreateController();

            sut.ModelState.AddModelError("error", "error");

            AddressService.Setup(x => x.GetAllAddressesAsync()).ReturnsAsync(new List <Address>());
            CityService.Setup(x => x.GetAllCitiesAsync()).ReturnsAsync(new List <City>());
            CountryService.Setup(x => x.GetAllCountriesAsync()).ReturnsAsync(new List <Country>());
            ClientService.Setup(x => x.GetAllClientsAsync(It.IsAny <int>(), It.IsAny <int>(), "*")).ReturnsAsync(new List <Client>());

            //Act
            var result = await sut.Edit(validOfferId, sale);

            //Assert
            Assert.IsInstanceOfType(result, typeof(ViewResult));
            Assert.IsInstanceOfType((result as ViewResult).Model, typeof(OfferCUViewModel));
            AddressService.Verify(mock => mock.GetAllAddressesAsync(), Times.Once());
            CityService.Verify(mock => mock.GetAllCitiesAsync(), Times.Once());
            CountryService.Verify(mock => mock.GetAllCountriesAsync(), Times.Once());
            ClientService.Verify(mock => mock.GetAllClientsAsync(It.IsAny <int>(), It.IsAny <int>(), "*"), Times.Once());
        }
示例#21
0
        public void TestarQuantidadeDeCaracter()
        {
            var service = new AddressService(ServiceEnum.Postmon);
            var isValid = service.ValidQuantityCaracter("74223-170");

            Assert.AreEqual(isValid, true);
        }
        public void UpdateUSPSTrackOrders()
        {
            while (true)
            {
                using (var db = new UnitOfWork(_log))
                {
                    var service             = new UpdateOrderTrackingStatus(_company.Id, null, TimeSpan.FromSeconds(10));
                    var actionService       = new SystemActionService(_log, _time);
                    var dbFactory           = new DbFactory();
                    var notificationService = new NotificationService(_log, _time, dbFactory);
                    var companyAddress      = new CompanyAddressService(_company);
                    var addressService      = new AddressService(null, companyAddress.GetReturnAddress(MarketIdentifier.Empty()), companyAddress.GetPickupAddress(MarketIdentifier.Empty()));
                    var ruleList            = new List <ITrackingRule>()
                    {
                    };

                    var trackingService = new TrackingManager(_log, actionService, addressService, _emailService, _time, ruleList);

                    var uspsTrackingProvider = new ComposedUspsAndCanadaPostTrackingProvider(_log, _time, _company.USPSUserId, _company.CanadaPostKeys);

                    service.UpdateAllShippedOrderStatus(trackingService,
                                                        _time,
                                                        db,
                                                        uspsTrackingProvider,
                                                        _company);
                }
                Thread.Sleep(TimeSpan.FromMinutes(0));
            }
        }
        public void RePrintLastPack(long packId)
        {
            IList <long> orderIds;
            var          labelService   = new LabelService(GetShipmentProviders(_company), _log, _time, _dbFactory, _emailService, _pdfMaker, AddressService.Default);
            var          companyAddress = new CompanyAddressService(_company);
            var          addressService = new AddressService(new List <IAddressCheckService>(), companyAddress.GetReturnAddress(MarketIdentifier.Empty()), companyAddress.GetPickupAddress(MarketIdentifier.Empty()));

            using (var db = new UnitOfWork(_log))
            {
                //packId = 329;// db.GetSet<LabelPrintPack>().OrderByDescending(l => l.CreateDate).FirstOrDefault().Id;
//                var shippings = db.OrderShippingInfos.GetByLabelPackId(packId);
//                orderIds = shippings.Select(o => o.OrderId).ToList();
//#if DEBUG
//                //orderIds = orderIds.Take(3).ToList();
//#endif
//                labelService.PrintLabels(_log,
//                    db,
//                    addressService,
//                    _user,
//                    new EmptySyncInformer(SyncType.PostagePurchase),
//                    shippings.AsQueryable(),
//                    false,
//                    null,
//                    SortMode.ByLocation,
//                    AppSettings.LabelDirectory,
//                   AppSettings.IsSampleLabels);

//                string orderListAsString = String.Join(",", orderIds);
//                _log.Debug(orderListAsString);
            }
        }
示例#24
0
 private void AddSession()
 {
     if (MessageBox.Show("Are you sure", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         var sessions = SessionService.GetAllSessions().Where(d => d.CourseId == SelectedCourse.Id);
         if (ScheduleConflict(sessions))
         {
             //if Session Start is within Start and End of existing session for the same course - there is a schedule conflict and the operation must not be allowed
             MessageBox.Show("Schedule Conflict");
             return;
         }
         //create location from strings
         var address = AddressService.AddAddress(new Address()
         {
             ZipCode = VenueAddress,
         });
         var location = LocationService.AddLocation(new Location()
         {
             Address  = address,
             Capacity = VenueCapacity
         });
         Session = SessionService.AddSession(Session);
         var sessionLocation = SessionLocationService.Add(new Session_Location()
         {
             Session  = Session,
             Location = location
         });
         BackProc();
     }
 }
        public AddressItem Info(int addressIndex)
        {
            this.ControllerContext.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", AccessControlForUrlBase);
            var result = new AddressService().Address(addressIndex);

            return(result);
        }
示例#26
0
 static ServiceLocator()
 {
     AddressService        = new AddressService();
     BoatService           = new BoatService();
     ClubService           = new ClubService();
     UserService           = new UserService();
     EntryService          = new EntryService();
     RaceEventService      = new RaceEventService();
     RegattaService        = new RegattaService();
     SocialEventService    = new SocialEventService();
     TeamService           = new TeamService();
     EmailService          = new EmailService();
     PhoneNumberService    = new PhoneNumberService();
     RegisteredUserService = new RegisteredUserService();
     ResultService         = new ResultService();
     UserRoleService       = new UserRoleService();
     ClubsUsersUserRolesJunctionsService    = new Clubs_Users_UserRoles_JunctionsService();
     RegattasUsersUserRolesJunctionsService = new Regattas_Users_UserRoles_JunctionsService();
     RegisteredUserSocialEventService       = new RegisteredUser_SocialEventService();
     TeamRaceEventService      = new Team_RaceEventService();
     TeamRegisteredUserService = new Team_RegisteredUserService();
     BoatService = new BoatService();
     SocialEventsUsersUserRolesJunctionsService = new SocialEvents_Users_UserRoles_JunctionsService();
     RaceEventsUsersUserRolesJunctionsService   = new RaceEvents_Users_UserRoles_JunctionsService();
     ClubsEmailsService       = new ClubsEmailsService();
     ClubsPhoneNumbersService = new ClubsPhoneNumbersService();
 }
        private void DeleteUserButton_Click(object sender, RoutedEventArgs e)
        {
            var selectedItem = this.lvAddreses.SelectedItem;

            if (selectedItem != null)
            {
                AddressEntity address = selectedItem as AddressEntity;

                AddressService service = new AddressService();
                if (MessageBox.Show("Sei sicuro di voler eliminare \"" + address.AddressName + " \" ?", "Elimina Indirizzo", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    if (service.Delete(address) == 0)
                    {
                        MessageBox.Show("cancellato!");
                        this.RefreshData();
                    }
                    else
                    {
                        MessageBox.Show("NON cancellato!");
                    }
                }
                else
                {
                    MessageBox.Show("NON cancellato!");
                }
            }
        }
示例#28
0
        public void GetAddresss_Success_Test()
        {
            // Arrange
            R_Address address = SampleAddress(1);

            IList <R_Address> list = new List <R_Address>();

            list.Add(address);

            // create mock for repository
            var mock = new Mock <IAddressRepository>();

            mock.Setup(s => s.GetAddresss()).Returns(list);

            // service
            AddressService addressService = new AddressService();

            AddressService.Repository = mock.Object;

            // Act
            var        resultList = addressService.GetAddresss();
            AddressDTO result     = resultList.FirstOrDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.AddressId);
        }
示例#29
0
        public void RemoveAddressShouldRemoveAnAddressFromTheDatabase()
        {
            DbContextOptions <UltimateMoviesDbContext> options = new DbContextOptionsBuilder <UltimateMoviesDbContext>()
                                                                 .UseInMemoryDatabase(databaseName: "Addresses_RemoveAddress_Database")
                                                                 .Options;
            UltimateMoviesDbContext db = new UltimateMoviesDbContext(options);

            IAddressesService addressesService = new AddressService(db);

            db.Addresses.Add(new Address {
                Country = "Test 1"
            });
            db.Addresses.Add(new Address {
                Country = "Test 2"
            });

            db.SaveChanges();

            addressesService.RemoveAddress(db.Addresses.Last().Id);

            int    addressesCount     = db.Addresses.ToList().Count();
            string leftAddressCountry = db.Addresses.ToList()[0].Country;

            Assert.Equal(1, addressesCount);
            Assert.Equal("Test 1", leftAddressCountry);
        }
示例#30
0
        public void TestarRequisiçãoDeEndereçoViaCEP()
        {
            var service = new AddressService(ServiceEnum.ViaCEP);
            var address = service.GetAddress("74223-170");

            Assert.AreEqual("Rua T 61", address.Street);
        }
示例#31
0
        public ActionResult Index()
        {
            AddressService _addressService = new AddressService();

            EventVM eventVM = new EventVM(){
                Addresses = _addressService.GetRecords()};

            return View(eventVM);
        }
示例#32
0
文件: pt.cs 项目: ozotony/ipocldng
 public string addAos(AddressService c_aos, string pwalletID)
 {
     string str = DateTime.Today.Date.ToString("yyyy-MM-dd");
     string str2 = "1";
     if (c_aos.countryID == null)
     {
         c_aos.countryID = "";
     }
     if (c_aos.stateID == null)
     {
         c_aos.stateID = "";
     }
     if (c_aos.city == null)
     {
         c_aos.city = "";
     }
     if (c_aos.street == null)
     {
         c_aos.street = "";
     }
     if (c_aos.telephone1 == null)
     {
         c_aos.telephone1 = "";
     }
     if (c_aos.email1 == null)
     {
         c_aos.email1 = "";
     }
     string connectionString = this.Connect();
     string str4 = "0";
     SqlConnection connection = new SqlConnection(connectionString);
     SqlCommand command = connection.CreateCommand();
     command.CommandText = "INSERT INTO address_service (countryID,stateID,city,street,telephone1,email1,log_staff,reg_date,visible) VALUES (@countryID,@stateID,@city,@street,@telephone1,@email1,@log_staff,@reg_date,@visible) SELECT SCOPE_IDENTITY()";
     connection.Open();
     command.Parameters.Add("@countryID", SqlDbType.VarChar, 10);
     command.Parameters.Add("@stateID", SqlDbType.NVarChar, 10);
     command.Parameters.Add("@city", SqlDbType.VarChar, 40);
     command.Parameters.Add("@street", SqlDbType.Text);
     command.Parameters.Add("@telephone1", SqlDbType.NVarChar, 40);
     command.Parameters.Add("@email1", SqlDbType.VarChar, 40);
     command.Parameters.Add("@log_staff", SqlDbType.VarChar, 40);
     command.Parameters.Add("@reg_date", SqlDbType.VarChar, 40);
     command.Parameters.Add("@visible", SqlDbType.VarChar, 1);
     command.Parameters["@countryID"].Value = c_aos.countryID;
     command.Parameters["@stateID"].Value = c_aos.stateID;
     command.Parameters["@city"].Value = c_aos.city;
     command.Parameters["@street"].Value = ConvertApos2Tab(c_aos.street);
     command.Parameters["@telephone1"].Value = c_aos.telephone1;
     command.Parameters["@email1"].Value = ConvertApos2Tab(c_aos.email1);
     command.Parameters["@log_staff"].Value = pwalletID;
     command.Parameters["@reg_date"].Value = str;
     command.Parameters["@visible"].Value = str2;
     str4 = command.ExecuteScalar().ToString();
     connection.Close();
     return str4;
 }
示例#33
0
文件: tm.cs 项目: ozotony/payx
 public string addExcelAos(AddressService c_aos)
 {
     if (c_aos.countryID == null)
     {
         c_aos.countryID = "";
     }
     if (c_aos.stateID == null)
     {
         c_aos.stateID = "";
     }
     if (c_aos.city == null)
     {
         c_aos.city = "";
     }
     if (c_aos.street == null)
     {
         c_aos.street = "";
     }
     if (c_aos.telephone1 == null)
     {
         c_aos.telephone1 = "";
     }
     if (c_aos.email1 == null)
     {
         c_aos.email1 = "";
     }
     string connectionString = this.Connect();
     string str2 = "0";
     SqlConnection connection = new SqlConnection(connectionString);
     SqlCommand command = connection.CreateCommand();
     command.CommandText = "INSERT INTO address_service (countryID,stateID,city,street,telephone1,email1,log_staff,reg_date,visible) VALUES (@countryID,@stateID,@city,@street,@telephone1,@email1,@log_staff,@reg_date,@visible) SELECT SCOPE_IDENTITY()";
     connection.Open();
     command.Parameters.Add("@countryID", SqlDbType.VarChar, 10);
     command.Parameters.Add("@stateID", SqlDbType.NVarChar, 10);
     command.Parameters.Add("@city", SqlDbType.VarChar, 40);
     command.Parameters.Add("@street", SqlDbType.Text);
     command.Parameters.Add("@telephone1", SqlDbType.NVarChar, 40);
     command.Parameters.Add("@email1", SqlDbType.VarChar, 40);
     command.Parameters.Add("@log_staff", SqlDbType.VarChar, 40);
     command.Parameters.Add("@reg_date", SqlDbType.VarChar, 40);
     command.Parameters.Add("@visible", SqlDbType.VarChar, 1);
     command.Parameters["@countryID"].Value = c_aos.countryID;
     command.Parameters["@stateID"].Value = c_aos.stateID;
     command.Parameters["@city"].Value = c_aos.city;
     command.Parameters["@street"].Value = c_aos.street;
     command.Parameters["@telephone1"].Value = c_aos.telephone1;
     command.Parameters["@email1"].Value = c_aos.email1;
     command.Parameters["@log_staff"].Value = c_aos.log_staff;
     command.Parameters["@reg_date"].Value = c_aos.reg_date;
     command.Parameters["@visible"].Value = c_aos.visible;
     str2 = command.ExecuteScalar().ToString();
     connection.Close();
     return str2;
 }
示例#34
0
文件: tm.cs 项目: ozotony/ipocldng
 public string addCurrentTrademark(Applicant c_app, MarkInfo c_mark, AddressService c_aos, Representative c_rep, Address c_app_addy, Address c_rep_addy, string pwallet, string log_officer)
 {
     Stage s = getStageClassByUserID(pwallet);
     string xID = ""; string date = s.reg_date; string year = s.reg_date.Substring(0, 4);
     this.addCurrentApplicant(c_app, c_app_addy, pwallet, date);
     xID = this.addCurrentMark(c_mark, pwallet, date);
     this.updateCurrentMarkReg(xID, c_mark.tm_typeID, year);
     this.addCurrentAos(c_aos, pwallet, date);
     this.addCurrentRepresentative(c_rep, c_rep_addy, pwallet, date);
     this.updatePwalletStatus(pwallet, log_officer);
     return xID;
 }
示例#35
0
文件: tm.cs 项目: ozotony/ipocldng
 public string addTrademark(Applicant c_app, MarkInfo c_mark, AddressService c_aos, Representative c_rep, Address c_app_addy, Address c_rep_addy, string pwallet, string log_officer)
 {
     string xID = "";
     this.addApplicant(c_app, c_app_addy, pwallet);
     xID = this.addMark(c_mark, pwallet);
     this.updateMarkReg(xID, c_mark.tm_typeID);
     this.addAos(c_aos, pwallet);
     this.addRepresentative(c_rep, c_rep_addy, pwallet);
     this.updatePwalletStatus(pwallet, log_officer);
     return xID;
 }
示例#36
0
文件: pt.cs 项目: ozotony/ipocldng
 public List<AddressService> getAddressServiceByID(string ID)
 {
     List<AddressService> list = new List<AddressService>();
     new AddressService();
     SqlConnection connection = new SqlConnection(this.Connect());
     SqlCommand command = new SqlCommand("SELECT * FROM address_service WHERE log_staff='" + ID + "' ", connection);
     connection.Open();
     SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
     while (reader.Read())
     {
         AddressService item = new AddressService
         {
             ID = Convert.ToInt64(reader["ID"]).ToString(),
             countryID = reader["countryID"].ToString(),
             stateID = reader["stateID"].ToString(),
             lgaID = reader["lgaID"].ToString(),
             city = ConvertTab2Apos(reader["city"].ToString()),
             street = ConvertTab2Apos(reader["street"].ToString()),
             zip = reader["zip"].ToString(),
             telephone1 = reader["telephone1"].ToString(),
             telephone2 = reader["telephone2"].ToString(),
             email1 = ConvertTab2Apos(reader["email1"].ToString()),
             email2 = ConvertTab2Apos(reader["email2"].ToString()),
             log_staff = reader["log_staff"].ToString(),
             reg_date = reader["reg_date"].ToString(),
             visible = reader["visible"].ToString()
         };
         list.Add(item);
     }
     reader.Close();
     return list;
 }
 public AddressController()
 {
     _ctx = new CurrentContext();
     _addressService = new AddressService(new ModelStateWrapper(ModelState));
 }
示例#38
0
文件: tm.cs 项目: ozotony/ipocldng
 public AddressService getAddressServiceByID(string ID)
 {
     AddressService service = new AddressService();
     service.ID = Convert.ToInt64("0").ToString();
     service.countryID = "";
     service.stateID = "";
     service.lgaID = "";
     service.city = "";
     service.street = "";
     service.zip = "";
     service.telephone1 = "";
     service.telephone2 = "";
     service.email1 = "";
     service.email2 = "";
     service.zip = "";
     service.log_staff = "";
     service.reg_date = "";
     service.visible = "";
     SqlConnection connection = new SqlConnection(this.Connect());
     SqlCommand command = new SqlCommand("SELECT * FROM address_service WHERE log_staff='" + ID + "' ", connection);
     connection.Open();
     SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
     while (reader.Read())
     {
         service.ID = Convert.ToInt64(reader["ID"]).ToString();
         service.countryID = reader["countryID"].ToString();
         service.stateID = reader["stateID"].ToString();
         service.lgaID = reader["lgaID"].ToString();
         service.city = reader["city"].ToString();
         service.street = reader["street"].ToString();
         service.zip = reader["zip"].ToString();
         service.telephone1 = reader["telephone1"].ToString();
         service.telephone2 = reader["telephone2"].ToString();
         service.email1 = reader["email1"].ToString();
         service.email2 = reader["email2"].ToString();
         service.zip = reader["zip"].ToString();
         service.log_staff = reader["log_staff"].ToString();
         service.reg_date = reader["reg_date"].ToString();
         service.visible = reader["visible"].ToString();
     }
     reader.Close();
     return service;
 }