Ejemplo n.º 1
0
        //
        // GET: /Contact/
        // Won't Allow Spaces
        public ActionResult Contact(RenderModel model)
        {
            var contactModel = new ContactInfoModel(model.Content, model.CurrentCulture);

            // Properties
            contactModel.Address  = model.Content.GetPropertyValue <string>("address");
            contactModel.BodyText = model.Content.GetPropertyValue <string>("bodyText");

            // Changed from View to CurrentTemplate
            return(CurrentTemplate(contactModel));
        }
Ejemplo n.º 2
0
        public JsonResult SaveContactInfoDetails(string ContactInfoData)
        {
            var serializer         = new JavaScriptSerializer();
            var contactInfo        = serializer.Deserialize(ContactInfoData, typeof(ContactInfoModel));
            ContactInfoModel model = (dynamic)(contactInfo);

            var company = _db.Companies.FirstOrDefault(a => a.CompanyId == model.CompanyId);

            company.CompanyName                  = model.CompanyName;
            company.ASI                          = "" + model.ASI;
            company.PPAI                         = "" + model.PPAI;
            company.SAGE                         = "" + model.SAGE;
            company.StreetAddress                = "" + model.StreetAddress;
            company.City                         = "" + model.City;
            company.State                        = "" + model.State;
            company.ZipCode                      = "" + model.ZipCode;
            company.Website                      = "" + model.Website;
            company.FOBPointInCanada             = "" + model.FOBPointInCanada;
            company.PrimaryContactFirstName      = "" + model.PrimaryContactFirstName;
            company.PrimaryContactLastName       = "" + model.PrimaryContactLastName;
            company.PrimaryContactEmail          = "" + model.PrimaryContactEmail;
            company.PrimaryContactDirectLine     = "" + model.PrimaryContactDirectLine;
            company.PrimaryContactFax            = "" + model.PrimaryContactFax;
            company.PrimaryContactTradeOnly      = "" + model.PrimaryContactTradeOnly;
            company.PrimaryContactAffiliations   = "" + model.PrimaryContactAffilations;
            company.SecondaryContactFirstName    = "" + model.SecondaryContactFirstName;
            company.SecondaryContactLastName     = "" + model.SecondaryContactLastName;
            company.SecondaryContactEmail        = "" + model.SecondaryContactEmail;
            company.SecondaryContactDirectLine   = "" + model.SecondaryContactDirectLine;
            company.SecondaryContactFax          = "" + model.SecondaryContactFax;
            company.SecondaryContactTradeOnly    = "" + model.SecondaryContactTradeOnly;
            company.SecondaryContactAffiliations = "" + model.SecondaryContactAffilations;
            company.TertiaryContactFirstName     = "" + model.TertiaryContactFirstName;
            company.TertiaryContactLastName      = "" + model.TertiaryContactLastName;
            company.TertiaryContactEmail         = "" + model.TertiaryContactEmail;
            company.TertiaryContactDirectLine    = "" + model.TertiaryContactDirectLine;
            company.TertiaryContactFax           = "" + model.TertiaryContactFax;
            company.TertiaryContactTradeOnly     = "" + model.TertiaryContactTradeOnly;
            company.TertiaryContactAffiliations  = "" + model.TertiaryContactAffilations;
            if (!string.IsNullOrEmpty(model.CompanyLogo))
            {
                company.Company_Logo = Path.Combine(Server.MapPath("~/Uploads/"), model.CompanyLogo);
            }
            else
            {
                company.Company_Logo = "";
            }


            _db.Entry(company).State = EntityState.Modified;
            _db.SaveChanges();
            return(Json("success", JsonRequestBehavior.AllowGet));
        }
        public void SaveContactInfo()
        {
            //arrange
            IFlowManager flowManager = serviceProvider.GetRequiredService <IFlowManager>();
            var          user        = new UserModel
            {
                UserName    = "******",
                EntityState = LogicBuilder.Domain.EntityStateType.Added
            };

            flowManager.FlowDataCache.Request = new SaveEntityRequest {
                Entity = user
            };
            flowManager.Start("saveuser");
            Assert.True(user.UserId > 1);

            var contactInfo = new ContactInfoModel
            {
                UserId               = user.UserId,
                EntityState          = LogicBuilder.Domain.EntityStateType.Added,
                HasFormerName        = true,
                FormerFirstName      = "John",
                FormerMiddleName     = "Michael",
                FormerLastName       = "Smith",
                DateOfBirth          = new DateTime(2003, 10, 10),
                SocialSecurityNumber = "111-22-3333",
                Gender               = "M",
                Race      = "AN",
                Ethnicity = "HIS",
                EnergencyContactFirstName    = "Jackson",
                EnergencyContactLastName     = "Zamarano",
                EnergencyContactRelationship = "Father",
                EnergencyContactPhoneNumber  = "704-333-4444"
            };

            flowManager.FlowDataCache.Request = new SaveEntityRequest {
                Entity = contactInfo
            };

            //act
            System.Diagnostics.Stopwatch stopWatch = System.Diagnostics.Stopwatch.StartNew();
            flowManager.Start("savecontactInfo");
            stopWatch.Stop();
            this.output.WriteLine("Saving valid contactInfo  = {0}", stopWatch.Elapsed.TotalMilliseconds);

            //assert
            Assert.True(flowManager.FlowDataCache.Response.Success);
            Assert.Empty(flowManager.FlowDataCache.Response.ErrorMessages);

            ContactInfoModel model = (ContactInfoModel)((SaveEntityResponse)flowManager.FlowDataCache.Response).Entity;

            Assert.Equal("Jackson", model.EnergencyContactFirstName);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 更新联系人信息和证件信息
 /// </summary>
 /// <param name="contactInfo"></param>
 private void UpdateContact(ContactInfoModel contactInfo)
 {
     if (contactInfo.ContactId == 0)
     {
         return;
     }
     //更新联系人信息
     _contactBll.UpdateContact(contactInfo);
     //根据联系人Id获取证件信息
     if (contactInfo.CardNoType.HasValue && !string.IsNullOrEmpty(contactInfo.CardNo))
     {
         List <IdentificationModel> identificationModels =
             _identificationInfoBll.GetIdentificationInfoByContactId(new List <int>()
         {
             contactInfo.ContactId
         });
         if (identificationModels == null)
         {
             _identificationInfoBll.AddIdentificationInfo(new IdentificationModel()
             {
                 ContactId = contactInfo.ContactId,
                 Iid       = contactInfo.CardNoType.Value,
                 CardNo    = contactInfo.CardNo
             });
         }
         else
         {
             IdentificationModel identificationModel =
                 identificationModels.Find(n => n.Iid == contactInfo.CardNoType.Value);//根据证件类型获取证件信息
             if (identificationModel != null)
             {
                 if (identificationModel.CardNo != contactInfo.CardNo)//有该证件类型,但是证件号不一致,则更新
                 {
                     identificationModel.CardNo = contactInfo.CardNo;
                     _identificationInfoBll.UpdateIdentificationInfo(identificationModel);
                 }
             }
             else//没有该证件,则新增
             {
                 _identificationInfoBll.AddIdentificationInfo(new IdentificationModel()
                 {
                     ContactId = contactInfo.ContactId,
                     Iid       = contactInfo.CardNoType.Value,
                     CardNo    = contactInfo.CardNo
                 });
             }
         }
     }
 }
Ejemplo n.º 5
0
 public void Bind(ContactInfo model)
 {
     _entityModel = new ContactInfoModel(model);
     txtName.DataBindings.Add("Text", _entityModel, "FirstName");
     txtSurname.DataBindings.Add("Text", _entityModel, "LastName");
     //rbUnknown.DataBindings.Add("Checked", _entityModel, "HasUnknowSex");
     //rbMale.DataBindings.Add("Checked", _entityModel, "IsMale");
     //rbFemale.DataBindings.Add("Checked", _entityModel, "IsFemale");
     //dpDateOfBirth.DataBindings.Add("Value", _entityModel, "DateOfBirth");
     //cbHasDate.DataBindings.Add("Checked", _entityModel, "HasNoDateOfBirth");
     cbHasDate.CheckedChanged += CbHasDate_CheckedChanged;
     dpDateOfBirth.MinDate     = DateTime.MinValue;
     pbPhoto.Image             = _entityModel.Picture;
     mtxtPhoneNumber.Mask      = Consts.PhoneRegex;
 }
 public static ContactInfoModel CreateUserContactInfo(ContactInfoModel contactInfoModel)
 {
     using (var _context = new bbbsDbContext())
     {
         var newContactInfo = _context.Add(new ContactInfo
         {
             Email         = contactInfoModel.Email,
             PhoneNumber   = contactInfoModel.PhoneNumber,
             UserAccountId = contactInfoModel.UserAccountId,
             UserAddressId = contactInfoModel.UserAddressId
         });
         _context.SaveChanges();
         contactInfoModel.Id = newContactInfo.Entity.Id;
         return(contactInfoModel);
     }
 }
Ejemplo n.º 7
0
        public GetContactInfoModel GetCorpContactByCid(int cid)
        {
            ContactInfoModel contactInfoModel = _getContactBll.GetCorpContactByCid(cid);

            if (contactInfoModel == null)
            {
                return(null);
            }
            GetContactInfoModel getContactInfoModel = new GetContactInfoModel().ConvertEntity(contactInfoModel);

            List <ContactIdentificationInfoEntity> contactIdentificationInfoEntities = _contactIdentificationDal.Query <ContactIdentificationInfoEntity>(
                n => n.Contactid == getContactInfoModel.ContactId, true).ToList();

            getContactInfoModel.IdentificationList = Mapper
                                                     .Map <List <ContactIdentificationInfoEntity>, List <IdentificationModel> >(contactIdentificationInfoEntities);

            return(getContactInfoModel);
        }
        public static ContactInfoModel UpdateUserContactInfo(ContactInfoModel contactInfoModel)
        {
            using (var _context = new bbbsDbContext())
            {
                var existingContactInfo = _context.ContactInfo.FirstOrDefault(x => x.Id == contactInfoModel.Id);

                if (existingContactInfo != null)
                {
                    existingContactInfo.Email         = contactInfoModel.Email;
                    existingContactInfo.PhoneNumber   = contactInfoModel.PhoneNumber;
                    existingContactInfo.UserAccountId = existingContactInfo.UserAccountId;
                    existingContactInfo.UserAddressId = existingContactInfo.UserAddressId;
                    _context.SaveChanges();
                    return(contactInfoModel);
                }
            }
            return(null);
        }
Ejemplo n.º 9
0
        internal string validateChangeContactInfo(string token, ContactInfoModel contactInfo)
        {
            //if token is invalide throw exception
            getPermissionFromDatabaseByTokenIsAdmin(token);
            //failed response by default
            string failResponse = ResponseR.fail.ToString(); string response = failResponse;



            contactInfoDao.changeContactInfoByModelInDatabase(contactInfo);

            //change to success response and return
            response = ResponseR.success.ToString();


            //return fail or success response
            return(response);
        }
Ejemplo n.º 10
0
        public void EditContactInformation()
        {
            var testData            = TestDataFactory.CreateLoginAccount();
            var expectedContactInfo = new ContactInfoModel
            {
                FirstName   = "john",
                LastName    = "doe",
                Email       = "*****@*****.**",
                PhoneNumber = "1231230312"
            };
            string expectedTitle = "Contact information";

            IndexPage indexPage = new IndexPage(driver, url);
            LoginPage loginPage = indexPage.Header.ClickOnSignIn();

            loginPage.Login(testData.Email, testData.Password);

            ContactInfoHomePage contactInfoPage = loginPage.Header.ClickOnContactInfo();

            //store the company name before changes
            expectedContactInfo.Company = contactInfoPage.GetContactFieldText(ContactInfoFields.Company);

            ContactInfoEditPage editContactInfoPage = contactInfoPage.ClickOnEditLink();

            editContactInfoPage.FillInputText(ContactInfoFields.FirstName, expectedContactInfo.FirstName);
            editContactInfoPage.FillInputText(ContactInfoFields.LastName, expectedContactInfo.LastName);
            editContactInfoPage.FillInputText(ContactInfoFields.PhoneNumber, expectedContactInfo.PhoneNumber);
            editContactInfoPage.FillInputText(ContactInfoFields.EmailAddress, expectedContactInfo.Email);
            contactInfoPage = editContactInfoPage.ClickOnSubmit();

            string actualContactFirstName   = contactInfoPage.GetContactFieldText(ContactInfoFields.FirstName);
            string actualContactLastName    = contactInfoPage.GetContactFieldText(ContactInfoFields.LastName);
            string actualContactCompanyName = contactInfoPage.GetContactFieldText(ContactInfoFields.Company);
            string actualContactPhone       = contactInfoPage.GetContactFieldText(ContactInfoFields.PhoneNumber);
            string actualContactEmail       = contactInfoPage.GetContactFieldText(ContactInfoFields.EmailAddress);

            //validate redirection is to contact info page
            Assert.IsTrue(driver.Title == expectedTitle, $"The page title is not {expectedTitle}");
            Assert.IsTrue(actualContactFirstName == expectedContactInfo.FirstName, $"{actualContactFirstName} is different from {expectedContactInfo.FirstName}");
            Assert.IsTrue(actualContactLastName == expectedContactInfo.LastName, $"{actualContactLastName} is different from {expectedContactInfo.LastName}");
            Assert.IsTrue(actualContactCompanyName == expectedContactInfo.Company, $"{actualContactCompanyName} is different from {expectedContactInfo.Company}");
            Assert.IsTrue(actualContactPhone == expectedContactInfo.PhoneNumber, $"{actualContactPhone} is different from {expectedContactInfo.PhoneNumber}");
            Assert.IsTrue(actualContactEmail == expectedContactInfo.Email, $"{actualContactEmail} is different from {expectedContactInfo.Email}");
        }
Ejemplo n.º 11
0
        public ActionResult Company(int companyId)
        {
            CompanyModel model   = new CompanyModel();
            var          company = _db.Companies.FirstOrDefault(a => a.CompanyId == companyId);

            if (null != company)
            {
                ContactInfoModel _ContactInfo = GetContactInfo(company);
                model.ContactInfo = _ContactInfo;

                ProductsCapabilityModel _ProductsCapabilityModel = GetProductCapabilities(company.CompanyId);
                model.ProductsCapability = _ProductsCapabilityModel;

                ProformaProgramModel _ProformaProgramModel = GetProFormaPrograms(company.CompanyId);
                model.ProformaProgram = _ProformaProgramModel;
            }


            return(View(model));
        }
Ejemplo n.º 12
0
        public ContactInfoModel GetContactInfo(Company company)
        {
            ContactInfoModel _ContactInfo = new ContactInfoModel();

            _ContactInfo.CompanyName                 = company.CompanyName;
            _ContactInfo.CompanyId                   = company.CompanyId;
            _ContactInfo.ASI                         = company.ASI;
            _ContactInfo.PPAI                        = company.PPAI;
            _ContactInfo.SAGE                        = company.SAGE;
            _ContactInfo.StreetAddress               = company.StreetAddress;
            _ContactInfo.City                        = company.City;
            _ContactInfo.State                       = company.State;
            _ContactInfo.ZipCode                     = company.ZipCode;
            _ContactInfo.Website                     = company.Website;
            _ContactInfo.FOBPointInCanada            = company.FOBPointInCanada;
            _ContactInfo.PrimaryContactFirstName     = company.PrimaryContactFirstName;
            _ContactInfo.PrimaryContactLastName      = company.PrimaryContactLastName;
            _ContactInfo.PrimaryContactEmail         = company.PrimaryContactEmail;
            _ContactInfo.PrimaryContactDirectLine    = company.PrimaryContactDirectLine;
            _ContactInfo.PrimaryContactAffilations   = company.PrimaryContactAffiliations;
            _ContactInfo.PrimaryContactFax           = company.PrimaryContactFax;
            _ContactInfo.PrimaryContactTradeOnly     = company.PrimaryContactTradeOnly;
            _ContactInfo.SecondaryContactFirstName   = company.SecondaryContactFirstName;
            _ContactInfo.SecondaryContactLastName    = company.SecondaryContactLastName;
            _ContactInfo.SecondaryContactEmail       = company.SecondaryContactEmail;
            _ContactInfo.SecondaryContactDirectLine  = company.SecondaryContactDirectLine;
            _ContactInfo.SecondaryContactAffilations = company.SecondaryContactAffiliations;
            _ContactInfo.SecondaryContactFax         = company.SecondaryContactFax;
            _ContactInfo.SecondaryContactTradeOnly   = company.SecondaryContactTradeOnly;
            _ContactInfo.TertiaryContactFirstName    = company.TertiaryContactFirstName;
            _ContactInfo.TertiaryContactLastName     = company.TertiaryContactLastName;
            _ContactInfo.TertiaryContactEmail        = company.TertiaryContactEmail;
            _ContactInfo.TertiaryContactDirectLine   = company.TertiaryContactDirectLine;
            _ContactInfo.TertiaryContactAffilations  = company.TertiaryContactAffiliations;
            _ContactInfo.TertiaryContactFax          = company.TertiaryContactFax;
            _ContactInfo.TertiaryContactTradeOnly    = company.TertiaryContactTradeOnly;
            _ContactInfo.CompanyLogo                 = company.Company_Logo;
            return(_ContactInfo);
        }
Ejemplo n.º 13
0
        public async Task <IHttpActionResult> GetContactInfo(int?surveyId = null, Guid?deviceId = null)
        {
            ContactInfo info = null;

            var model = new ContactInfoModel();

            // We don't use this here, but it ensures the volunteer record is created if it doesn't exist yet.
            Volunteer sv = await GetAuthenticatedVolunteerAsync(deviceId);

            // We can target a specific survey.
            if (surveyId.HasValue)
            {
                info = db.Surveys.Where(s => s.ID == surveyId.Value).SingleOrDefault()?.ContactInfo;
            }
            else
            {
                // For now, we're hard-coding this.
                info = db.ContactInfos.Where(i => i.ID == 1).SingleOrDefault();
            }

            if (info != null)
            {
                model.Notes = info.Notes;

                foreach (Contact contact in info.Contacts)
                {
                    model.Contacts.Add(new ContactModel()
                    {
                        Name = contact.Name, Phone = contact.PhoneNumber
                    });
                }
            }

            // TODO: We can target users, if we map them to groups or some other property in the db. Not needed for now.
            // We can even target device type, if we use relevant user-agent headers.

            return(Ok(model));
        }
Ejemplo n.º 14
0
        public ActionResult ContactInfoPartial(ContactInfoModel model)
        {
            var company = _db.Companies.FirstOrDefault(a => a.CompanyId == model.CompanyId);
            ContactInfoModel _ContactInfo = new ContactInfoModel();

            if (null != company)
            {
                company.CompanyName                = model.CompanyName;
                company.CompanyId                  = model.CompanyId;
                company.ASI                        = model.ASI;
                company.PPAI                       = model.PPAI;
                company.SAGE                       = model.SAGE;
                company.StreetAddress              = model.StreetAddress;
                company.City                       = model.City;
                company.State                      = model.State;
                company.ZipCode                    = model.ZipCode;
                company.Website                    = model.Website;
                company.FOBPointInCanada           = model.FOBPointInCanada;
                company.PrimaryContactFirstName    = model.PrimaryContactFirstName + " " + model.PrimaryContactLastName;
                company.PrimaryContactEmail        = model.PrimaryContactEmail;
                company.PrimaryContactDirectLine   = model.PrimaryContactDirectLine;
                company.PrimaryContactFax          = model.PrimaryContactFax;
                company.PrimaryContactTradeOnly    = model.PrimaryContactTradeOnly;
                company.SecondaryContactFirstName  = model.SecondaryContactFirstName + " " + model.SecondaryContactLastName;
                company.SecondaryContactEmail      = model.SecondaryContactEmail;
                company.SecondaryContactDirectLine = model.SecondaryContactDirectLine;
                company.SecondaryContactFax        = model.SecondaryContactFax;
                company.SecondaryContactTradeOnly  = model.SecondaryContactTradeOnly;
                //  company.SecondaryContactAffilations = "";
                //company.PrimaryContactAffilations = "";
                _db.Entry(company).State = EntityState.Modified;
                _db.SaveChanges();

                //To Do: Edit company data
                _ContactInfo = GetContactInfo(company);
            }
            return(PartialView(_ContactInfo));
        }
Ejemplo n.º 15
0
        public IHttpActionResult SendContactInfo(ContactInfoModel contactInfoModel)
        {
            if (contactInfoModel == null)
            {
                var errorMessage = _messages.GetMessage(Generic.NullObject);
                return(BadRequest(errorMessage));
            }
            try
            {
                string body = $"Name: {contactInfoModel.FullName}\n" +
                              $"Email address: {contactInfoModel.Email}\n" +
                              $"Phone: {contactInfoModel.Phone}\n" +
                              $"Message: {contactInfoModel.Message}";

                _mailSender.SendMail("*****@*****.**", "Contact info", body);
                var message = _messages.GetMessage(Email.MailSucceded);
                return(Ok(message));
            }
            catch (Exception)
            {
                var errorMessage = _messages.GetMessage(Email.MailFailed);
                return(ExpectationFailed(errorMessage));
            }
        }
Ejemplo n.º 16
0
        public TravelResponseViewModel GetTravel(TravelRequestViewModel request)
        {
            ContactInfoModel contactInfoModel = _getContactBll.GetCorpContactByCid(request.Cid);

            if (contactInfoModel == null)
            {
                throw new Exception("无法查询到对应的联系人信息");
            }
            //1.查询机场信息
            SearchCityAportModel aportModel = _getCityForFlightServiceBll.SearchAirport(new List <string>()
            {
                "N"
            });
            TravelQueryModel query = Mapper.Map <TravelRequestViewModel, TravelQueryModel>(request);

            query.AportInfo = aportModel;
            query.ContactId = contactInfoModel.ContactId;

            TravelModel travelModel = _getTravelServiceBll.GetTravelList(query);

            TravelResponseViewModel viewModel = Mapper.Map <TravelModel, TravelResponseViewModel>(travelModel);

            return(viewModel);
        }
Ejemplo n.º 17
0
        public List <ContactInfoModel> GetAllContactsForParty(int partyID)
        {
            List <ContactInfoModel> contacts = new List <ContactInfoModel>();

            try
            {
                ServiceMASTERS        _serice      = new ServiceMASTERS(_dbContext);
                List <SelectListItem> departments  = _serice.GetAllDepartments();
                List <SelectListItem> designations = _serice.GetAllDesignation();

                List <Tbl_MP_Master_PartyContact_Detail> dbList = _dbContext.Tbl_MP_Master_PartyContact_Detail.Where(xx => xx.FK_PartyID == (int?)partyID && xx.IsActive == true).ToList();
                foreach (Tbl_MP_Master_PartyContact_Detail item in dbList)
                {
                    ContactInfoModel model = new ContactInfoModel();

                    model.ContactID             = item.PK_PartyContactDetails;
                    model.CompanyID             = (int)item.FK_PartyID;
                    model.AlternateMobileNumber = item.AltMobileNo;
                    model.AlternateTelephoneNo  = item.AltTelephoneNo;
                    model.ContactAddress        = item.Address;
                    model.ContactName           = item.ContactPersoneName;
                    model.ContactType           = item.ContactType_Text;
                    model.EmailAddress          = item.EmailID;
                    model.MobileNumber          = item.MobileNo;
                    model.TelephoneNo           = item.TelephoneNo;
                    model.DepartmentID          = item.FK_Department;
                    model.DesignationID         = item.FK_Designation;
                    model.FAXNumber             = item.FaxNo;
                    if (model.DepartmentID != null)
                    {
                        SelectListItem deptItem = departments.Where(x => x.ID == item.FK_Department).FirstOrDefault();
                        if (deptItem != null)
                        {
                            model.DepartmentName = deptItem.Description;
                        }
                    }
                    if (model.DesignationID != null)
                    {
                        SelectListItem designationItem = designations.Where(x => x.ID == item.FK_Designation).FirstOrDefault();
                        if (designationItem != null)
                        {
                            model.DepartmentName = designationItem.Description;
                        }
                    }



                    contacts.Add(model);
                }
            }
            catch (Exception ex)
            {
                string errMessage = ex.Message;
                if (ex.InnerException != null)
                {
                    errMessage += string.Format("\n{0}", ex.InnerException.Message);
                }
                MessageBox.Show(errMessage, "ServiceContacts::GetAllContactsForParty", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(contacts);
        }
Ejemplo n.º 18
0
        public void E2E01()
        {
            //Search & Price
            APIndexPage indexPage = new APIndexPage(Driver, Url);

            indexPage.Header.SetSearchFieldText("103-1035");
            CatalogItemsPage catalogItemsPage = indexPage.Header.ClickOnSearchButton();

            //Add product to the cart from the result page
            Assert.IsTrue(catalogItemsPage.IsListPriceDisplayed(), "There is no numeric price shown.");
            int quantityBeforeAdd = catalogItemsPage.Header.GetMiniCartQuantity();

            catalogItemsPage.AddToCartElementByIndex(0);
            int quantityAfterAdd = catalogItemsPage.Header.GetMiniCartQuantity(quantityBeforeAdd);
            //Assert.IsTrue(quantityAfterAdd > quantityBeforeAdd, "The item quantity did no increment");

            //Click on the product to go to the Product Detail Page
            OfferingProductsPage offeringProductsPage = catalogItemsPage.ClickOnFirstItemInCatalog();

            Assert.IsTrue(offeringProductsPage.ListPriceLabelforANON(), "List price tag not shown.");
            Assert.IsTrue(offeringProductsPage.NumericPriceDisplayed(), "No numeric price diplayed.");
            offeringProductsPage.UpdateAmountQuantity();
            int amountQuantityBeforeAdd = offeringProductsPage.GetAmountQuantity();

            //Add product to the cart from Product Detail Page and click on cart
            offeringProductsPage.AddToCartFirstProduct();
            offeringProductsPage.UpdateAmountQuantity();
            int amountQuantityAfterAdd = offeringProductsPage.GetAmountQuantity();

            Assert.IsTrue(offeringProductsPage.AumontQuantityIncremented(amountQuantityBeforeAdd, amountQuantityAfterAdd),
                          "Quantity did not incremented.");
            APCartPage cartPage = offeringProductsPage.ClickOnCart();

            Assert.AreEqual(1, cartPage.NumberOfItemsInCart(), "Should be just one product in cart.");
            Assert.AreEqual(2, cartPage.GetQuantityInput(), "Quantity must be 2.");

            //Checkout
            cartPage.ProceedToCheckOut();
            APCheckoutPage   checkoutPage     = cartPage.CheckoutAsGuest();
            ContactInfoModel contactInfoModel = new ContactInfoModel();

            contactInfoModel.FirstName   = "Jesus Carlos";
            contactInfoModel.LastName    = "Acosta Rocha";
            contactInfoModel.Email       = "*****@*****.**";
            contactInfoModel.Company     = "Softtek";
            contactInfoModel.PhoneNumber = "6681596072";
            checkoutPage.SetContactElement(ContactInputs.FirstName, contactInfoModel.FirstName);
            checkoutPage.SetContactElement(ContactInputs.LastName, contactInfoModel.LastName);
            checkoutPage.SetContactElement(ContactInputs.Email, contactInfoModel.Email);
            checkoutPage.SetContactElement(ContactInputs.Company, contactInfoModel.Company);
            checkoutPage.SetContactElement(ContactInputs.PhoneNumber, contactInfoModel.PhoneNumber);
            checkoutPage.NextStep();
            AddressModel addressModel = GetAddressModel();

            checkoutPage.SetAddressElement(AddressInputs.StreetAddress, addressModel.street);
            checkoutPage.SetAddressElement(AddressInputs.City, addressModel.city);
            checkoutPage.SetAddressElement(AddressInputs.State, addressModel.state);
            checkoutPage.SetAddressElement(AddressInputs.Postal, addressModel.postal);
            checkoutPage.NextStep();
            SetCreditCard(checkoutPage);
            checkoutPage.NextStep();

            //Confirmation page and continue shopping
            OrderConfirmationPage orderConfirmationPage = checkoutPage.PlaceOrderSubmitClick();

            orderConfirmationPage.ClickOnContinueShoppingButton(ContinueShoppingButtons.PrintOrderConfirmation);
            Assert.AreEqual(2, Driver.WindowHandles.Count, "Printable Order Confirmation Not Shown.");
            Driver.SwitchTo().DefaultContent();
            orderConfirmationPage.ClickOnContinueShoppingButton(ContinueShoppingButtons.ContinueShopping);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 如果联系人id为0,新增联系人信息;如果不为0,则更新
        /// </summary>
        /// <param name="contactInfo"></param>
        /// <returns></returns>
        public int AddContact(ContactInfoModel contactInfo)
        {
            if (!contactInfo.Cid.HasValue)
            {
                return(0);
            }
            CustomerInfoModel cutCustomerInfoModel = _customerBll.GetCustomerByCid(contactInfo.Cid.Value);

            if (!string.IsNullOrEmpty(cutCustomerInfoModel.CorpId))
            {
                CorporationModel corporationModel = _corporationBll.GetCorpInfoByCorpId(cutCustomerInfoModel.CorpId);
                if (corporationModel.IsAmplitudeCorp == "T")//如果是差旅客户则跳出
                {
                    return(0);
                }
            }

            if (contactInfo.ContactId == 0)//新联系人信息
            {
                //判断是存在相同证件的常用乘客
                bool flag = false;
                List <ContactInfoModel> contactList = _contactBll.GetPassengerContactInfoList(contactInfo.Cid.Value);
                if (contactList != null && contactList.Count > 0)
                {
                    var contact = contactList.Find(n => n.Name == contactInfo.Name);
                    if (contact != null)//存在
                    {
                        List <IdentificationModel> identificationModels =
                            _identificationInfoBll.GetIdentificationInfoByContactId(new List <int>()
                        {
                            contactInfo.ContactId
                        })?.FindAll(n => n.CardNo == contactInfo.CardNo && n.Iid == (contactInfo.CardNoType ?? 0));

                        if (identificationModels != null && identificationModels.Count > 0)
                        {
                            contactInfo.ContactId = contact.ContactId;
                            flag = true;
                        }
                    }
                }


                if (flag)
                {
                    //存在同人,更新
                    UpdateContact(contactInfo);
                }
                else
                {
                    //不存在同人,则新增
                    int contactId = _contactBll.AddContact(contactInfo); //新增联系人信息
                    if (contactInfo.CardNoType.HasValue && !string.IsNullOrEmpty(contactInfo.CardNo))
                    {
                        //新增证件信息
                        _identificationInfoBll.AddIdentificationInfo(new IdentificationModel()
                        {
                            ContactId = contactId,
                            Iid       = contactInfo.CardNoType.Value,
                            CardNo    = contactInfo.CardNo
                        });
                    }
                }
            }
            else
            {
                UpdateContact(contactInfo);
            }

            return(0);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 获取乘机人/乘车人信息
        /// </summary>
        /// <param name="cid">客户Id</param>
        /// <param name="departId"></param>
        /// <param name="searchArgs">查询参数</param>
        /// <returns></returns>
        public List <PassengerInfoModel> GetPassengerInfoList(int cid, int?departId, string searchArgs = "")
        {
            CustomerInfoModel customer         = GetCustomerInfo(cid);
            CorporationModel  corporationModel = null;

            if (!string.IsNullOrEmpty(customer.CorpId))
            {
                corporationModel = _corporationBll.GetCorpInfoByCorpId(customer.CorpId);
                if (!customer.CorpDepartId.HasValue && corporationModel.IsAmplitudeCorp == "T")
                {
                    throw new Exception("该客户没有所属部门");
                }
            }

            List <PassengerInfoModel> passengerList = new List <PassengerInfoModel>();

            if (corporationModel != null && corporationModel.IsAmplitudeCorp == "T")
            {
                #region 差旅系统客户
                if (departId.HasValue && departId.Value == -1)
                {
                    return(passengerList);
                }
                //1.根据Cid判断当前预定人是否有是预定人
                if (!string.IsNullOrEmpty(customer.IsMaster) && customer.IsMaster.ToUpper() == "T")
                {
                    if (!departId.HasValue)
                    {
                        throw new Exception("预定人请传入departId参数");
                    }

                    #region 是预定人
                    //1.1 根据departId获取对应的Cid
                    List <CustomerInfoModel> customerList = _customerBll.GetCustomerByDepartId(departId.Value, searchArgs);
                    List <int> cidList = new List <int>();
                    if (customerList == null)
                    {
                        customerList = new List <CustomerInfoModel>();
                    }
                    customerList.ForEach(n => cidList.Add(n.Cid));
                    //1.2 然后在通过Cid获取是乘机人信息的联系人信息
                    List <ContactInfoModel> contactList = _contactBll.GetPassengerContactInfoList(cidList) ??
                                                          new List <ContactInfoModel>();
                    passengerList = ConvertContactToPassenger(contactList);
                    #endregion
                }
                else
                {
                    #region 乘车人

                    ContactInfoModel           contactInfo        = _contactBll.GetPassengerContactInfo(cid);
                    List <IdentificationModel> identificationList =
                        _identificationInfoBll.GetIdentificationInfoByContactId(new List <int>()
                    {
                        contactInfo.ContactId
                    });
                    passengerList.Add(new PassengerInfoModel()
                    {
                        ContactId          = contactInfo.ContactId,
                        PassengerName      = contactInfo.Name,
                        Mobile             = contactInfo.Mobile,
                        IdentificationList = identificationList
                    });

                    #endregion
                }

                #endregion
            }
            else
            {
                #region 非差旅系统客户,从常用联系人中获取
                List <ContactInfoModel> contactList = _contactBll.GetPassengerContactInfoList(cid) ??
                                                      new List <ContactInfoModel>();
                if (!string.IsNullOrEmpty(searchArgs))
                {
                    contactList = contactList.FindAll(
                        n => (!string.IsNullOrEmpty(n.EName) && n.EName.Contains(searchArgs)) ||
                        (!string.IsNullOrEmpty(n.CName) && n.CName.Contains(searchArgs)) ||
                        (!string.IsNullOrEmpty(n.Mobile) && n.Mobile == searchArgs));
                }
                if (contactList.Count > 20)
                {
                    contactList = contactList.Take(20).ToList();
                }

                List <ContactInfoModel> contactList2 = new List <ContactInfoModel>();

                contactList.ForEach(n =>
                {
                    if (contactList2.Find(x => x.Name == n.Name) == null)//去除重名
                    {
                        contactList2.Add(n);
                    }
                });

                passengerList = ConvertContactToPassenger(contactList2);
                #endregion
            }
            return(passengerList);
        }
Ejemplo n.º 21
0
 public static ContactInfoModel UpdateUserContactInfo(ContactInfoModel contactInfoModel)
 {
     return(ContactInfoRepository.UpdateUserContactInfo(contactInfoModel));
 }
 public ContactInfoModel CreateUserContactInfo(ContactInfoModel contactInfoModel)
 {
     return(ContactInfoService.CreateUserContactInfo(contactInfoModel));
 }
 public string changeContactInfo([FromBody] ContactInfoModel contactInfo, [FromQuery]  string token)
 {
     return(contactInfoService.validateChangeContactInfo(token, contactInfo));
 }
Ejemplo n.º 24
0
 public JsonResult ContactSubmit(ContactInfoModel ContactInfo)
 {
     return(Json(new { isSuccess = true }, JsonRequestBehavior.DenyGet));
 }