Exemplo n.º 1
0
        public string SaveContactDetails(ContactDetailModel contactDetailModel)
        {
            if (contactDetailModel != null)
            {
                List <KeyValuePair <string, object> > param = new List <KeyValuePair <string, object> >()
                {
                    new KeyValuePair <string, object>("@ContactTitle", contactDetailModel.ContactTitle),
                    new KeyValuePair <string, object>("@ContactDescription", contactDetailModel.ContactDescription),
                    new KeyValuePair <string, object>("@Address", contactDetailModel.Address),
                    new KeyValuePair <string, object>("@Mobile", contactDetailModel.Mobile),
                    new KeyValuePair <string, object>("@Email", contactDetailModel.Email),
                    new KeyValuePair <string, object>("@ConsultationMethods", contactDetailModel.ConsultationMethods),
                    new KeyValuePair <string, object>("@UserId", contactDetailModel.UserId),

                    new KeyValuePair <string, object>("@GoogleLink", contactDetailModel.GoogleLink),
                    new KeyValuePair <string, object>("@FacebookLink", contactDetailModel.FacebookLink),
                    new KeyValuePair <string, object>("@TwitterLink", contactDetailModel.TwitterLink),
                    new KeyValuePair <string, object>("@InstagramLink", contactDetailModel.InstagramLink),
                    new KeyValuePair <string, object>("@YoutubeLink", contactDetailModel.YoutubeLink)
                };

                return(DataExecutor.ExecuteScalar(UtilityConstant.Procedures.Mst_SaveContactDetails, param));
            }
            return(UtilityConstant.UserResponseStatus.Error);
        }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            ContactDetailModel contactDetail = new ContactDetailModel();
            IList <Profile>    allProfile    = new List <Profile>();

            if (HttpRuntime.Cache["profile"] != null)
            {
                allProfile = HttpRuntime.Cache["profile"] as List <Profile>;
            }
            else
            {
                allProfile = _profileService.GetAll().ToList();
                SqlCacheHelper.FetchFromDb("profile", allProfile);
            }

            if (allProfile.Count > 0)
            {
                contactDetail = allProfile.Select(p => new ContactDetailModel
                {
                    Phone   = p.Phone,
                    Email   = p.Email,
                    Street  = p.Street,
                    Suburb  = p.Suburb,
                    State   = p.State,
                    Country = p.Country
                }).First();
            }

            return(View(contactDetail));
        }
        public IHttpActionResult GetContact([FromBody] ContactDetailModel _ContactDetail)
        {
            try
            {
                if (_ContactDetail.Id > 0)
                {
                    var contact = _ContactDetailModel.GetContactById(_ContactDetail.Id);

                    if (contact != null)
                    {
                        return(Ok(contact));
                    }
                    else
                    {
                        return(NotFound());
                    }
                }
                else
                {
                    return(BadRequest("The Contact Id is invalid"));
                }
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Exemplo n.º 4
0
        public ActionResult NewContact(int id, AccountFilterModel filter, FormCollection collection)
        {
            var account = AccountServices.GetAccount(id);
            var contact = new ContactModel()
            {
                AccountId = id
            };

            try
            {
                // Need to specify properties because the id (account) overwrites Contact.Id
                UpdateModel(contact, new string[] { "ContactTypeId", "ContactDetail", "FirstName", "LastName" });
                AccountServices.AddContact(account, contact);

                return(RedirectToAction("EditAccount", filter.GenerateAccountDetailRoute(id)));
            }
            catch (Exception ex)
            {
                // Invalid - redisplay with errors
                Logger.Error(ex.ToString());
                ModelState.AddModelError(String.Empty, Constants.ServerError);

                var model = new ContactDetailModel()
                {
                    Action  = "NewContact",
                    Contact = contact,
                    Filter  = filter,
                };

                ViewBag.ContactTypes = AccountServices.GetContactTypes(contact.ContactTypeId);

                return(View("ContactDetail", model));
            }
        }
Exemplo n.º 5
0
 public ActionResult Edit(ContactDetailModel _ContactDetailModel)
 {
     if (!_APIClient.UpdateContact(_ContactDetailModel))
     {
         return(View("Error"));
     }
     return(RedirectToAction("Index"));
 }
Exemplo n.º 6
0
        public ActionResult Edit(int _Id)
        {
            ContactDetailModel _ContactDetailModel = null;

            _ContactDetailModel = _APIClient.GetContactById(_Id);
            if (_ContactDetailModel == null)
            {
                TempData["ErrorMsg"] = "No Matching Record Found";
                return(RedirectToAction("Index"));
            }
            return(View(_ContactDetailModel));
        }
Exemplo n.º 7
0
        public ActionResult EditContact(int id, int contactId, AccountFilterModel filter)
        {
            var account = AccountServices.GetAccount(id);

            var model = new ContactDetailModel()
            {
                Action  = "EditContact",
                Contact = account.ContactList.Where(c => c.Id == contactId).FirstOrDefault(),
                Filter  = filter,
            };

            ViewBag.ContactTypes = AccountServices.GetContactTypes(model.Contact.ContactTypeId);

            return(View("ContactDetail", model));
        }
        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);
        }
Exemplo n.º 9
0
        public ActionResult NewContact(int id, AccountFilterModel filter)
        {
            var account = AccountServices.GetAccount(id);

            var model = new ContactDetailModel()
            {
                Action  = "NewContact",
                Contact = new ContactModel()
                {
                    AccountId = id
                },
                Filter = filter,
            };

            ViewBag.ContactTypes = AccountServices.GetContactTypes(model.Contact.ContactTypeId);

            return(View("ContactDetail", model));
        }
Exemplo n.º 10
0
        public IActionResult Detail(int id)
        {
            var contactFromDb = _contactDatabase.GetContact(id);

            var contact = new ContactDetailModel()
            {
                FirstName   = contactFromDb.FirstName,
                LastName    = contactFromDb.LastName,
                PhoneNumber = contactFromDb.PhoneNumber,
                Address     = contactFromDb.Addres,
                Email       = contactFromDb.Email,
                Description = contactFromDb.Description,
                BirthDate   = contactFromDb.BirthDate,
                PhotoUrl    = contactFromDb.PhotoUrl
            };


            return(View(contact));
        }
 public IHttpActionResult DeleteContact([FromBody] ContactDetailModel _ContactDetail)
 {
     try
     {
         if (_ContactDetail.Id > 0)
         {
             _ContactDetailModel.DeleteContact(_ContactDetail.Id);
             return(Ok(true));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
        public IHttpActionResult CreateContact([FromBody] ContactDetailModel _ContactDetail)
        {
            try
            {
                if (_ContactDetail == null)
                {
                    return(BadRequest());
                }

                if (_ContactDetailModel.CreateContact(_ContactDetail) == "Save_Successfull")
                {
                    return(Ok(true));
                }
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
            return(Ok(false));
        }
 public ContactDetailController()
 {
     _ContactDetailModel = new ContactDetailModel();
 }