Exemple #1
0
        public ActionResult AddressDetailDelete(AddressDetailModel model)
        {
            string html = null;

            try
            {
                int a = obj.FunExecuteNonQuery("exec dbo.AddressDetail_Delete '" + model.AddressId + "'");
                if (a > 0)
                {
                    //return RedirectToAction("PropertyTypeGet");
                    DataTable dt = obj.FunDataTable("SELECT * from dbo.AddressDetail_Get ()");
                    if (dt.Rows.Count > 0)
                    {
                        int[]         columnHide = { 0 };
                        StringBuilder htmlTable  = CommonUtil.htmlTableEditMode(dt, columnHide);
                        return(Json(new { Flag = 0, Html = htmlTable.ToString() }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        html = "<div class='alert alert-danger'>'" + Resources.Resource1.norecord + "'</div>";
                        return(Json(new { Flag = 0, Html = html }, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    html = Resources.Resource1.deletefailed;
                    return(Json(new { Flag = 2, Html = html }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                html = Resources.Resource1.deletefailed;
                return(Json(new { Flag = 2, Html = html }, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #2
0
        public ActionResult AddressDetailGet(AddressDetailModel model)
        {
            string html = null;

            try
            {
                DataTable dt = obj.FunDataTable("SELECT * from dbo.AddressDetail_Get ()");
                if (dt.Rows.Count > 0)
                {
                    int[]         columnHide = { 0 };
                    StringBuilder htmlTable  = CommonUtil.htmlTableEditMode(dt, columnHide);
                    return(Json(new { Flag = 0, Html = htmlTable.ToString() }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    html = "<div class='alert alert-danger'>'" + Resources.Resource1.norecord + "'</div>";
                    return(Json(new { Flag = 0, Html = html }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                html = "Fatch Result Failed !!!";
                return(Json(new { Flag = 2, Html = html }, JsonRequestBehavior.AllowGet));
            }
        }
        public void NewAddress_InsertOrUpdate_Persisted()
        {
            var detail = new StudentDetailModel()
            {
                Name    = "Jane Doe",
                Address = new AddressDetailModel()
                {
                    City    = "Brno",
                    Country = "Jihomoravsky-kraj",
                    State   = "Czechia",
                    Street  = "Bozetechova 2",
                },
                Grade   = new GradeMapper().MapListModel(Seed.GradeJane),
                Courses = new List <StudentCourseListModel>()
                {
                    new()
                    {
                        CourseId = Seed.IcsCourse.Id,
                        Name     = Seed.IcsCourse.Name,
                    }
                }
            };

            detail = _facadeSUT.Save(detail);

            Assert.NotEqual(Guid.Empty, detail.Id);

            var entityFromDb = _repository.GetById(detail.Id);

            Assert.Equal(detail, _mapper.Map(entityFromDb));
        }
 public ActionResult Edit(AddressDetailModel address)
 {
     if (ModelState.IsValid)
     {
         _repository.Update(address);
         return(Redirect("~"));
     }
     return(View(address));
 }
Exemple #5
0
 public AddressDetailViewModel(AddressDto operation)
 {
     AddressServiceInstance = ClientServiceLocator.Instance().ContractLocator.AddressServices;
     Model = new AddressDetailModel {
         Address = new AddressDto()
     };
     Model.Address = operation;
     View          = new AddressDetailView {
         DataContext = this
     };
 }
Exemple #6
0
 public AddressDetailViewModel(AddressDto operation)
 {
     AddressServiceAdapter = new ServiceAdapter <IAddressService>();
     Model = new AddressDetailModel {
         Address = new AddressDto()
     };
     Model.Address = operation;
     View          = new AddressDetailView {
         DataContext = this
     };
 }
Exemple #7
0
 public Address MapDetailModelToEntity(AddressDetailModel model, Person person)
 {
     return(new Address
     {
         Id = model.Id,
         City = model.City,
         Street = model.Street,
         ZipCode = model.ZipCode,
         Person = person
     });
 }
        public void Insert(AddressDetailModel model)
        {
            using (var directoryDbContext = new DirectoryDbContext())
            {
                var person = directoryDbContext.Persons.First(p => p.Id == model.PersonId);
                var entity = _mapper.MapDetailModelToEntity(model, person);
                entity.Id = Guid.NewGuid();

                directoryDbContext.Adresses.Add(entity);
                directoryDbContext.SaveChanges();
            }
        }
        public void Update(AddressDetailModel address)
        {
            using (var directoryDbContext = new DirectoryDbContext())
            {
                var entity = directoryDbContext.Adresses.First(p => p.Id == address.Id);

                entity.City    = address.City;
                entity.Street  = address.Street;
                entity.ZipCode = address.ZipCode;

                directoryDbContext.SaveChanges();
            }
        }
Exemple #10
0
        public async Task <ApiResult> Detail(AddressDetailModel model)
        {
            AddressDTO result = await addressService.GetModelAsync(model.Id);

            AddressList apiModel = new AddressList();

            apiModel.address   = result.Address;
            apiModel.id        = result.Id;
            apiModel.mobile    = result.Mobile;
            apiModel.name      = result.Name;
            apiModel.isDefault = result.IsDefault;
            return(new ApiResult {
                status = 1, data = apiModel
            });
        }
        public async void Submit_Valid_InitiationForm(FormDetailModel form)
        {
            var mockFormService = new Mock <IFormService>();

            mockFormService.Setup(x => x.SubmitCustomerForm(It.IsAny <CustomerForm>())).ReturnsAsync(1);

            IMapper     mapper  = TestUtilities.GetMapper(new CustomerProfile(), new FormProfile(), new InstitutionProfile());
            FormManager manager = new FormManager(_logger, mapper, mockFormService.Object, Mock.Of <IItemService>(), Mock.Of <IIsotopeOrderingAuthorizationService>(), Mock.Of <ICustomerService>(), _eventService, Mock.Of <INotificationManager>());

            List <FormInitiationItemModel> items = new List <FormInitiationItemModel>()
            {
                new FormInitiationItemModel()
                {
                    IsSelected = true
                }
            };
            Fixture            fixture = new Fixture();
            AddressDetailModel address = fixture.Create <AddressDetailModel>();

            address.State   = "MO";
            address.ZipCode = "12345";

            ContactDetailModel contact = fixture.Create <ContactDetailModel>();

            contact.Email        = "*****@*****.**";
            contact.PhoneNumber  = "123-123-1234";
            form.InitiationModel = new FormInitiationDetailModel()
            {
                Institution = new InstitutionDetailModel()
                {
                    Name             = "Test",
                    Address          = address,
                    FinancialContact = contact,
                    SafetyContact    = contact
                },
                ShippingAddress = address,
                Items           = items
            };
            form.CustomerDetailFormId = 1;
            form.InitiationModel.CustomerAdminSignature.Email       = "*****@*****.**";
            form.InitiationModel.CustomerAdminSignature.PhoneNumber = "123-123-1234";
            ApplicationResult result = await manager.SubmitInitiationForm(form);

            _output.WriteLine(result.Message);
            CustomAssertions.AssertValidationErrorsDoNotExist(result);
        }
Exemple #12
0
        public IActionResult AddressDetail(int id)
        {
            var model = new AddressDetailModel();

            model.Address   = new UserAddress();
            model.Provinces = DefaultStorage.RegionList("86");
            model.Citys     = new List <Region>();
            model.Districts = new List <Region>();
            if (id > 0)
            {
                var address = DefaultStorage.UserAddressGet(id, User.Id);

                model.Address   = address;
                model.Citys     = DefaultStorage.RegionList(address.ProvinceId);
                model.Districts = DefaultStorage.RegionList(address.CityId);
            }
            return(PartialView(model));
        }
        public void NewAddress_InsertOrUpdate_Persisted()
        {
            var detail = new AddressDetailModel()
            {
                City    = "Brno",
                Country = "Jihomoravsky-kraj",
                State   = "Czechia",
                Street  = "Bozetechova 2",
            };

            detail = _facadeSUT.Save(detail);

            Assert.NotEqual(Guid.Empty, detail.Id);

            var entityFromDb = _repository.GetById(detail.Id);

            Assert.Equal(detail, _mapper.Map(entityFromDb));
        }