public ActionResult Submit(ContactModel model)
        {
            // The empty result. Indicates success without errors messages.
            var result = new ResponseModel();

            // If the ModelState is invalid, return the error messages.
            if (!ModelState.IsValid)
            {
                result.Errors.AddRange(ModelState.Values.SelectMany(v => v.Errors.Select(x => x.ErrorMessage)).ToList());
            }

            // Validate the Captcha Code if it was entered
            if (!string.IsNullOrEmpty(model.CaptchaCode) &&
                !Captcha.Validate(model.CaptchaId, model.CaptchaCode, model.CaptchaInstanceId))
            {
                result.Errors.Add(CaptchaErrorMessage);
            }

            // If there are no errors so far, map the view model to the data model and try to insert it into the database.
            // If the insertion fails, add a user friendly error message.
            if (result.Success && !ContactRepository.Insert(AutoMapper.Mapper.Map<Contact>(model)))
            {
                result.Errors.Add(DefaultErrorMessage);
            }

            return Json(result);
        }
Example #2
0
        public ActionResult Item(int? id, string validation)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            var ownerships = db.OwnerShips.Include(o => o.TypeOwnerShip);
            OwnerShip ownership = ownerships.ToList().Find(x => x.Id == id);

            if (ownership == null)
            {
                return HttpNotFound();
            }
            else
            {
                ContactModel contact = new ContactModel();
                contact.Id = id.Value;
                contact.CodRef = ownership.Ref;
                ownership.Contact = contact;
            }

            if (validation != null)
            {
                ModelState.AddModelError("", "Validar Campos");
            }

            return View(ownership);
        }
Example #3
0
        public virtual JsonResult Index(ContactModel model)
        {
            if (!ModelState.IsValid)
                return Json(ModelState.First(s => s.Value.Errors.Any()).Value.Errors.First().ErrorMessage);

            var mailMessage = new MailMessage(model.Email, ConfigurationManager.AppSettings["ContactMailToAddress"])
            {
                Subject = !string.IsNullOrWhiteSpace(model.Subject)
                    ? model.Subject : "[No subject]",
                IsBodyHtml = false,
                Body = model.Message,
            };

            using (var smtp = new SmtpClient())
            {
                try
                {
                    //throw new SmtpException(SmtpStatusCode.GeneralFailure, "my custom message");
                    //throw new InvalidOperationException("my custom message");
                    smtp.Send(mailMessage);
                }
                catch (SmtpException ex)
                {
                    if (ex.Message.Contains("5.1.8") && ex.Message.Contains("R0107008"))
                        return Json("domain");
                    return Json("other");
                }
            }

            return Json(true);
        }
 public ActionResult Contact(ContactModel model)
 {
     if (_mailService.SendMail("*****@*****.**", "*****@*****.**", "an email", model.Comment))
     {
         ViewBag.MailSent = true;
     }
     return View();
 }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            _contactModel = e.Parameter as ContactModel;

            fullstackpanel.DataContext = _contactModel;

            _contactModel.PageCollapsed = true;
 
        }
Example #6
0
 public ActionResult Contact(ContactModel model)
 {
     var msg = string.Format("Comment From: {1}{0}Email: {2}{0}Website: {3}{0}Comment: {4}", Environment.NewLine, model.Name, model.Email, model.Website, model.Comment);
     if(_mail.SendMail("*****@*****.**", "*****@*****.**", "Web Contact", msg))
     {
         ViewBag.MailSent = true;
     }
     return View();
 }
        public ViewResult Add()
        {
            var newContact = new ContactModel();
            newContact.Children = new Child[2]{
                new Child{Name = "John"},
                new Child{Name = "Math"}
            };

            return View(newContact);
        }
Example #8
0
        public ActionResult Contact(ContactModel model)
        {
            var msg = string.Format("Comment from :{1}{0}Email:{2}{0}Website:{2}{0}Comment:{3}{0}"
                , Environment.NewLine, model.Name, model.Email, model.Website, model.Comment);

            if (mail.SendMail("*****@*****.**", "*****@*****.**", "Contact Us", msg))
            {
                ViewBag.MailSent = true;
            }
            return View();
        }
 public ActionResult Contact(ContactModel model)
 {
     string msg = string.Format("Comment From: {1}{0}Email: {2}{0}Website: {3}{0}Comment: {4}{0}",
         Environment.NewLine, model.Name, model.Email, model.Website, model.Comment);
     if (_mail.SendMail("*****@*****.**", "*****@*****.**", "Website Contact", msg)) {
         ViewBag.MailSent = true;
     } else {
         ViewBag.MailSent = false;
     }
     return View();
 }
        public ActionResult Contact(ContactModel model)
        {
            var msg = string.Format("Comment from: {1}{0}Email:{2}{0}Web Site:{3}{0}Comment{4}{0}",
                Environment.NewLine, model.Name, model.Email, model.WebSite, model.Comment);

            if (_mail.SendMail("*****@*****.**", "*****@*****.**", "Website Contact", msg))
            {
                ViewBag.MailSent = true;
            }
            return View();
        }
Example #11
0
        public ActionResult Contact(ContactModel contactDetails)
        {
            if (m_service.SendMail("*****@*****.**", contactDetails.Email, "Thanks for your interest", string.Format("Comment from {1}{0}Website: {2}",
                Environment.NewLine,
                contactDetails.Name,
                contactDetails.Website)))
            {
                ViewBag.MailSent = true;
            }

            return View();
        }
Example #12
0
            public ActionResult Contact(ContactModel model)
            {
            var msg = string.Format("Comment Form: {1}{0}Email:{2}{0}Website: {3}{0}Comments" Environment.NewLine,
                model.Name,
                model.Email,
                model.Website,
                model.Comment);

            var svc = new MailService();

            if (_mail.SendMail("*****@*****.**", "*****@*****.**", "Website Contact", msg))
            {
                ViewBag.MailSent = true;
            }
            return View();
            }
        public ActionResult Contact(ContactModel model)
        {
            var msg = string.Format("Comment From: {1}{0} Phone: {2}{0} Email:  {3}{0} Comment: {4}{0}",
                Environment.NewLine,
                model.fullname,
                model.phone,
                model.email,
                model.comment);

            var svc = new MailService();

            if(svc.SendMail("*****@*****.**", "*****@*****.**", "WebSite contact", msg))
            {
                ViewBag.MailSent = true;
            }

            return View();
        }
        public void SetUp()
        {
            theModel = new ContactModel();
            theType = theModel.GetType();

            r1 = MockRepository.GenerateStub<IValidationRule>();
            r2 = MockRepository.GenerateStub<IValidationRule>();
            r3 = MockRepository.GenerateStub<IValidationRule>();

            theMatchingSource = ConfiguredValidationSource.For(type => type == theType, r1, r2);
            theOtherSource = ConfiguredValidationSource.For(type => type == typeof(int), r3);

            theGraph = ValidationGraph.BasicGraph();
            theGraph.RegisterSource(theMatchingSource);
            theGraph.RegisterSource(theOtherSource);

            theContext = ValidationContext.For(theModel);

            thePlan = ValidationPlan.For(theType, theGraph);
        }
        public ActionResult Contact(ContactModel contactModel)
        {
            var svc = new MailService();
            var msg = string.Format("Comment From:  {1}{0}Email:{2}{0}Website:  {3}{0}Comment{4}{0}"
                , Environment.NewLine
                , contactModel.Name
                , contactModel.Email
                , contactModel.Website
                , contactModel.Comment);

            svc.SendMail("*****@*****.**", "*****@*****.**", "Website Contact", msg);

            ViewBag.MailSent = true;

            if (_mail.SendMail("*****@*****.**", "*****@*****.**", "Website Contract", msg))
            {
                ViewBag.MailSent = true;
            }

            return View();
        }
Example #16
0
        public ActionResult Contact(ContactModel contactModel)
        {
            ViewBag.PageTitle =
                "CodeGenerate.me - Contact us today.";

            if (ModelState.IsValid)
            {
                SendEmail sendEmail = new SendEmail(contactModel.Email, contactModel.Subject, contactModel.Description,
                                                    contactModel.Name);

                // Successful
                contactModel.SentSuccesfully = sendEmail.SentSuccessfully;
            }
            else
            {

                // Not ready - validation failed
                contactModel.SentSuccesfully = 1;
            }

            return View(contactModel);
        }
Example #17
0
        public void SaveContact(ContactModel contact)
        {
            var activity = MainActivity.Instance;

            List <ContentProviderOperation> ops = new List <ContentProviderOperation>();

            ops.Add(ContentProviderOperation.NewInsert(ContactsContract.RawContacts.ContentUri)
                    .WithValue(ContactsContract.RawContacts.InterfaceConsts.AccountType, null)
                    .WithValue(ContactsContract.RawContacts.InterfaceConsts.AccountType, null)
                    .Build());

            // Name
            if (contact.Name.Text != null)
            {
                ops.Add(ContentProviderOperation.NewInsert(ContactsContract.Data.ContentUri)
                        .WithValueBackReference(ContactsContract.Data.InterfaceConsts.RawContactId, 0)
                        .WithValue(ContactsContract.Data.InterfaceConsts.Mimetype, ContactsContract.CommonDataKinds.StructuredName.ContentItemType)
                        .WithValue(ContactsContract.CommonDataKinds.StructuredName.DisplayName, contact.Name.Text)
                        .Build());
            }

            // Phone Numbers
            foreach (PhoneField phone in contact.PhoneNumbers)
            {
                if (!String.IsNullOrEmpty(phone.Number))
                {
                    ops.Add(ContentProviderOperation.NewInsert(ContactsContract.Data.ContentUri)
                            .WithValueBackReference(ContactsContract.Data.InterfaceConsts.RawContactId, 0)
                            .WithValue(ContactsContract.Data.InterfaceConsts.Mimetype, ContactsContract.CommonDataKinds.Phone.ContentItemType)
                            .WithValue(ContactsContract.CommonDataKinds.Phone.Number, phone.Number)
                            .WithValue(ContactsContract.CommonDataKinds.Phone.InterfaceConsts.Type, ContactsContract.CommonDataKinds.Phone.InterfaceConsts.TypeCustom)
                            .WithValue(ContactsContract.CommonDataKinds.Phone.InterfaceConsts.Data2, GetPhoneDataKind(phone))
                            .Build());
                }
            }

            // Emails
            foreach (EmailField email in contact.Emails)
            {
                if (email.Email != null)
                {
                    ops.Add(ContentProviderOperation.NewInsert(ContactsContract.Data.ContentUri)
                            .WithValueBackReference(ContactsContract.Data.InterfaceConsts.RawContactId, 0)
                            .WithValue(ContactsContract.Data.InterfaceConsts.Mimetype, ContactsContract.CommonDataKinds.Email.ContentItemType)
                            .WithValue(ContactsContract.CommonDataKinds.Email.InterfaceConsts.Data, email.Email)
                            .WithValue(ContactsContract.CommonDataKinds.Email.InterfaceConsts.Type, ContactsContract.CommonDataKinds.Email.InterfaceConsts.TypeCustom)
                            .WithValue(ContactsContract.CommonDataKinds.Email.InterfaceConsts.Data2, GetEmailDataKind(email))
                            .Build());
                }
            }

            // Websites
            foreach (ContactField website in contact.Websites)
            {
                if (website.Text != null)
                {
                    ops.Add(ContentProviderOperation.NewInsert(ContactsContract.Data.ContentUri)
                            .WithValueBackReference(ContactsContract.Data.InterfaceConsts.RawContactId, 0)
                            .WithValue(ContactsContract.Data.InterfaceConsts.Mimetype, ContactsContract.CommonDataKinds.Website.ContentItemType)
                            .WithValue(ContactsContract.CommonDataKinds.Email.InterfaceConsts.Data, website.Text)
                            .WithValue(ContactsContract.CommonDataKinds.Email.InterfaceConsts.Type, ContactsContract.CommonDataKinds.Website.InterfaceConsts.TypeCustom)
                            .WithValue(ContactsContract.CommonDataKinds.Email.InterfaceConsts.Data2, (int)WebsiteDataKind.Work)
                            .Build());
                }
            }

            // Organization
            foreach (ContactField company in contact.Companies)
            {
                if (company.Text != null)
                {
                    ops.Add(ContentProviderOperation.NewInsert(ContactsContract.Data.ContentUri)
                            .WithValueBackReference(ContactsContract.Data.InterfaceConsts.RawContactId, 0)
                            .WithValue(ContactsContract.Data.InterfaceConsts.Mimetype, ContactsContract.CommonDataKinds.Organization.ContentItemType)
                            .WithValue(ContactsContract.CommonDataKinds.Organization.Company, company.Text)
                            .WithValue(ContactsContract.CommonDataKinds.Organization.InterfaceConsts.Type, ContactsContract.CommonDataKinds.Organization.InterfaceConsts.Data3)

                            .Build());
                }
            }

            // Job Title
            foreach (ContactField jobTitle in contact.JobTitles)
            {
                ops.Add(ContentProviderOperation.NewInsert(ContactsContract.Data.ContentUri)
                        .WithValueBackReference(ContactsContract.Data.InterfaceConsts.RawContactId, 0)
                        .WithValue(ContactsContract.Data.InterfaceConsts.Mimetype, ContactsContract.CommonDataKinds.Organization.ContentItemType)
                        .WithValue(ContactsContract.CommonDataKinds.Organization.Title, jobTitle.Text)
                        .WithValue(ContactsContract.CommonDataKinds.Organization.InterfaceConsts.Type, ContactsContract.CommonDataKinds.Organization.InterfaceConsts.Data3)

                        .Build());
            }

            // Attach thumbnail
            if (System.IO.File.Exists(contact.ProfileImage))
            {
                ops.Add(ContentProviderOperation.NewInsert(ContactsContract.Data.ContentUri)
                        .WithValueBackReference(ContactsContract.Data.InterfaceConsts.RawContactId, 0)
                        .WithValue(ContactsContract.Data.InterfaceConsts.Mimetype, ContactsContract.CommonDataKinds.Photo.ContentItemType)
                        .WithValue(ContactsContract.CommonDataKinds.Photo.InterfaceConsts.Data15, System.IO.File.ReadAllBytes(contact.ProfileImage))
                        .Build());
            }

            activity.ContentResolver.ApplyBatch(ContactsContract.Authority, ops);
        }
Example #18
0
        public ActionResult AddOrUpdateContacts(ContactModel model)
        {
            var contactObj = Mapper.Map<ContactModel, Contact>(model);
            var status = 0;
            if (model.Row_Id != null && model.Row_Id != 0)
                status = _repository.UpdateContacts(contactObj);
            else
            {
                contactObj.Created = DateTime.Now;
                var contactid = _repository.AddContacts(contactObj);
                if (contactid != 0)
                {
                    var ordercontact = new OrderContact();
                    ordercontact.OrderId = model.Orderid;
                    ordercontact.ContactId = contactid;
                    ordercontact.Created = DateTime.Now;
                    status = _repository.SaveOrdercontact(ordercontact);
                }

            }

            if (status == 1)
            {
                var contactlist = new List<Contact>();
                var companylstModel = new List<ContactModel>();

                var ordercontacts = _repository.GetOrderContactsbyOrder(model.Orderid);

                if (ordercontacts.Count > 0)
                {
                    foreach (var item in ordercontacts)
                    {
                        if (item != null)
                        {
                            if (item.ContactId != null)
                            {
                                var contact = _repository.GetContactsById(item.ContactId.Value);
                                if (contact != null)
                                {
                                    contactlist.Add(contact);
                                }

                            }
                        }

                    }

                    companylstModel = Mapper.Map<IEnumerable<Contact>, List<ContactModel>>(contactlist);

                }

                return PartialView("Controls/Company/_CompanyContacts", companylstModel);
            }
            return null;
        }
Example #19
0
        public ActionResult AddNewContact(string orderid, string cid)
        {
            var contactModel = new ContactModel();
            if (!string.IsNullOrEmpty(orderid) && !string.IsNullOrEmpty(cid))
            {
                contactModel.CompanyId = int.Parse(cid);
                contactModel.Orderid = int.Parse(orderid);
            }

            return PartialView("Controls/Company/_EditContacts", contactModel);
        }
Example #20
0
        async Task GetData()
        {
            var contacts_data = await StoreManager.ContactStore.GetItemsAsync(true, true);

            var company_data = await StoreManager.CompanyStore.GetItemsAsync(true, true);

            #region Contacts

            Contacts = new ObservableCollection <ObservableGroupCollection <ContactModel> >();

            foreach (var item in contacts_data.GroupBy((arg) => arg.Lastname?.First()).OrderBy((arg) => arg.Key))
            {
                var group = new ObservableGroupCollection <ContactModel>()
                {
                    Key = item.Key?.ToString()?.ToUpper()
                };

                foreach (var x in item)
                {
                    ContactModel t;
                    group.Add(t = new ContactModel(x));
                }

                Contacts.Add(group);
            }

            #endregion

            #region Comapnies


            Companies = new ObservableCollection <ObservableGroupCollection <CompanyModel> >();

            foreach (var item in company_data?.Where((arg) => arg.Name != null).OrderBy((arg) => arg.Name))
            {
                var group = new ObservableGroupCollection <CompanyModel>()
                {
                    Key = item.Name?.First().ToString()?.ToUpper()
                };

                List <ContactModel> contacts = new List <ContactModel>();

                foreach (var x in Contacts)
                {
                    contacts.AddRange(x.Where((arg) => arg.Contact.CompanyId == item.Id));
                }

                group.Add(new CompanyModel(item)
                {
                    Contacts = new ObservableCollection <ContactModel>(contacts)
                });

                Companies.Add(group);
            }

            #endregion

            AllContacts = Contacts;

            AllCompanies = Companies;

            TabSelectedChanged(TabIndex);
        }
        protected Boolean SubmitForm()
        {
            StringBuilder formattedHtml = new StringBuilder();
            StringBuilder formattedInternalHtml = new StringBuilder();
            string seasonalMonths = "";

            try
            {
                foreach (ListItem item in cblSeasonal.Items)
                {
                    if (item.Selected)
                    {
                        seasonalMonths += item.Value + " - ";
                    }
                }

                if (seasonalMonths.Length > 3)
                {
                    seasonalMonths = seasonalMonths.Substring(0, seasonalMonths.Length - 3);
                }
            }
            catch (System.Exception ex)
            {
                _newLogic.WriteExceptionToDB(ex, "AdminSubmitForm - Get Seasonal Months");
            }

            try
            {
                //Instanciate new model objects for each piece of data to be created
                MerchantModel newMerchant = new MerchantModel();
                MerchantPrincipalModel newMerchantPrincipal = new MerchantPrincipalModel();
                ContactModel newMerchantPrincipalContact = new ContactModel();
                AddressModel newMerchantPrincipalContactAddress = new AddressModel();
                ContactModel newContact = new ContactModel();
                ContactModel newBusiness = new ContactModel();
                AddressModel newBusinessAddress = new AddressModel();
                ProcessorModel newProcessor = new ProcessorModel();
                DebitCardModel newDebitCard = new DebitCardModel();
                BankModel newBankModel = new BankModel();
                BankAccountModel newBankAccountModel = new BankAccountModel();

                //Set base merchant information in newMerchant object
                if (txtMerchantId.Text != "") { newMerchant.MerchantId = txtMerchantId.Text; }
                if (txtCorpName.Text != "") { newMerchant.CorpName = txtCorpName.Text; }
                if (txtDBAName.Text != "") { newMerchant.DbaName = txtDBAName.Text; }
                if (txtBusLicNumber.Text != "") { newMerchant.BusLicNumber = txtBusLicNumber.Text; }
                if (txtBusLicType.Text != "") { newMerchant.BusLicType = txtBusLicType.Text; }
                if (txtBusLicIssuer.Text != "") { newMerchant.BusLicIssuer = txtBusLicIssuer.Text; }
                if (radBusLicDate.SelectedDate.HasValue) { newMerchant.BusLicDate = Convert.ToDateTime(radBusLicDate.SelectedDate); }
                if (txtFedTaxId.Text != "") { newMerchant.FedTaxId = txtFedTaxId.Text; }
                if (txtMerchandiseSold.Text != "") { newMerchant.MerchandiseSold = txtMerchandiseSold.Text; }
                if (txtYearsInBus.Text != "") { newMerchant.YearsInBusiness = Convert.ToInt32(txtYearsInBus.Text); }
                if (txtMonthsInBus.Text != "") { newMerchant.MonthsInBusiness = Convert.ToInt32(txtMonthsInBus.Text); }
                if (rblSeasonal.SelectedValue != "") { newMerchant.SeasonalSales = Convert.ToBoolean(rblSeasonal.SelectedValue); }
                if (seasonalMonths != "") { newMerchant.SeasonalMonths = seasonalMonths; }
                if (txtSwipedPct.Text != "") { newMerchant.SwipedPct = Convert.ToInt32(txtSwipedPct.Text); }
                if (txtAvgMonthlySales.Text != "") { newMerchant.AvgMonthlySales = Convert.ToDecimal(txtAvgMonthlySales.Text); }
                if (txtHighestMonthlySales.Text != "") { newMerchant.HighestMonthlySales = Convert.ToDecimal(txtHighestMonthlySales.Text); }
                if (txtAvgWeeklySales.Text != "") { newMerchant.AvgWeeklySales = Convert.ToDecimal(txtAvgWeeklySales.Text); }
                if (rblHighRisk.SelectedValue != "") { newMerchant.HighRisk = Convert.ToBoolean(rblHighRisk.SelectedValue); }
                if (txtHighRiskWho.Text != "") { newMerchant.HighRiskWho = txtHighRiskWho.Text; }
                if (radHighRiskDate.SelectedDate.HasValue) { newMerchant.HighRiskDate = Convert.ToDateTime(radHighRiskDate.SelectedDate); }
                if (rblBankruptcy.SelectedValue != "") { newMerchant.Bankruptcy = Convert.ToBoolean(rblBankruptcy.SelectedValue); }
                if (radBankruptcyDate.SelectedDate.HasValue) { newMerchant.BankruptcyDate = Convert.ToDateTime(radBankruptcyDate.SelectedDate); }

                //Add Legal Org State to merchant
                if (ddlLegalOrgState.SelectedValue != "")
                {
                    Int32 legalOrgStateId = Convert.ToInt32(ddlLegalOrgState.SelectedValue);
                    newMerchant.LegalOrgState = _globalCtx.GeoStates.Where(gs => gs.RecordId == legalOrgStateId).FirstOrDefault();
                }

                //Add Legal Org Type to merchant
                if (ddlLegalOrgType.SelectedValue != "")
                {
                    Int32 legalOrgTypeId = Convert.ToInt32(ddlLegalOrgType.SelectedValue);
                    newMerchant.LegalOrgType = _globalCtx.LegalOrgTypes.Where(lot => lot.RecordId == legalOrgTypeId).FirstOrDefault();
                }

                //Add Merchant Type to Merchant
                if (rblMerchantType.SelectedValue != "") { newMerchant.MerchantType = _globalCtx.MerchantTypes.Where(mt => mt.MerchantTypeName == rblMerchantType.SelectedValue).FirstOrDefault(); }

                //Add MCC to merchant
                if (ddlMCC.SelectedValue != "")
                {
                    Int32 mccId = Convert.ToInt32(ddlMCC.SelectedValue);
                    newMerchant.Mcc = _globalCtx.MerchantCategoryCodes.Where(mcc => mcc.RecordId == mccId).FirstOrDefault();
                }

                //Add Business Contact info - Email, Phone, Fax
                if (txtBusEmail.Text != "") { newBusiness.Email = txtBusEmail.Text; }
                if (txtBusFax.Text != "") { newBusiness.Fax = txtBusFax.Text; }
                if (txtBusPhone.Text != "") { newBusiness.HomePhone = txtBusPhone.Text; }

                _globalCtx.Contacts.Add(newBusiness);

                //Add Business Contact Addess
                if (txtCorpAddress.Text != "") { newBusinessAddress.Address = txtCorpAddress.Text; }
                if (txtCorpCity.Text != "") { newBusinessAddress.City = txtCorpCity.Text; }
                if (ddlCorpState.SelectedValue != "")
                {
                    Int32 businessAddressStateId = Convert.ToInt32(ddlCorpState.SelectedValue);
                    newBusinessAddress.State = _globalCtx.GeoStates.Where(gs => gs.RecordId == businessAddressStateId).FirstOrDefault();
                }
                if (txtCorpZip.Text != "") { newBusinessAddress.Zip = txtCorpZip.Text; }

                _globalCtx.Addresses.Add(newBusinessAddress);

                //Add new Business Contact Address to new Business
                newBusiness.Address = newBusinessAddress;

                //Add new Contact to new Merchant
                newMerchant.Business = newBusiness;

                //Add new Contact
                if (txtContactFirstName.Text != "") { newContact.FirstName = txtContactFirstName.Text; }
                if (txtContactLastName.Text != "") { newContact.LastName = txtContactLastName.Text; }
                if (txtContactEmail.Text != "") { newContact.Email = txtContactEmail.Text; }
                if (txtContactPhone.Text != "") { newContact.HomePhone = txtContactPhone.Text; }
                if (txtContactFax.Text != "") { newContact.Fax = txtContactFax.Text; }

                _globalCtx.Contacts.Add(newContact);

                //Add new contact to new Merchant
                newMerchant.Contact = newContact;

                //Add new Merchant Principal
                if (txtPrincipalDLNumber.Text != "") { newMerchantPrincipal.PrincipalDLNumber = PWDTK.StringToUtf8Bytes(txtPrincipalDLNumber.Text); }
                if (ddlPrincipalDLState.SelectedValue != "")
                {
                    Int32 dlStateId = Convert.ToInt32(ddlPrincipalDLState.SelectedValue);
                    newMerchantPrincipal.PrincipalDLState = _globalCtx.GeoStates.Where(gs => gs.RecordId == dlStateId).FirstOrDefault();
                }
                if (radPrincipalDoB.SelectedDate.HasValue) { newMerchantPrincipal.PrincipalDoB = Convert.ToDateTime(radPrincipalDoB.SelectedDate); }
                if (txtPrincipalPctOwn.Text != "") { newMerchantPrincipal.PrincipalPctOwn = Convert.ToInt32(txtPrincipalPctOwn.Text); }

                _globalCtx.MerchantPrincipal.Add(newMerchantPrincipal);

                //Create new contact for Merchant Principal
                if (txtPrincipalFirstName.Text != "") { newMerchantPrincipalContact.FirstName = txtPrincipalFirstName.Text; }
                if (txtPrincipalLastName.Text != "") { newMerchantPrincipalContact.LastName = txtPrincipalLastName.Text; }
                if (txtPrincipalMI.Text != "") { newMerchantPrincipalContact.MiddleInitial = txtPrincipalMI.Text; }
                if (txtPrincipalTitle.Text != "") { newMerchantPrincipalContact.Title = txtPrincipalTitle.Text; }
                if (txtPrincipalCellPhone.Text != "") { newMerchantPrincipalContact.CellPhone = txtPrincipalCellPhone.Text; }
                if (txtPrincipalHomePhone.Text != "") { newMerchantPrincipalContact.HomePhone = txtPrincipalHomePhone.Text; }

                _globalCtx.Contacts.Add(newMerchantPrincipalContact);

                //Create new address for Merchant principal Contact
                if (txtPrincipalAddress.Text != "") { newMerchantPrincipalContactAddress.Address = txtPrincipalAddress.Text; }
                if (txtPrincipalCity.Text != "") { newMerchantPrincipalContactAddress.City = txtPrincipalCity.Text; }
                if (ddlPrincipalState.SelectedValue != "")
                {
                    Int32 mpcStateId = Convert.ToInt32(ddlPrincipalState.SelectedValue);
                    newMerchantPrincipalContactAddress.State = _globalCtx.GeoStates.Where(gs => gs.RecordId == mpcStateId).FirstOrDefault();
                }
                if (txtPrincipalZip.Text != "") { newMerchantPrincipalContactAddress.Zip = txtPrincipalZip.Text; }

                _globalCtx.Addresses.Add(newMerchantPrincipalContactAddress);

                //Add new address to Merchant Principal Contact
                newMerchantPrincipalContact.Address = newMerchantPrincipalContactAddress;

                //Add new Contact to Merchant Principal
                newMerchantPrincipal.Contact = newMerchantPrincipalContact;

                //Add new Principal to the new merchant
                newMerchant.MerchantPrincipal = newMerchantPrincipal;

                //Check if merchant processor already exists, if so link to merchant.  If not, create it and add to merchant.
                if (txtCardProcessor.Text != "")
                {
                    if (_globalCtx.Processor.Where(p => p.ProcessorName == txtCardProcessor.Text.Trim()).ToList().Count > 0)
                    {
                        newMerchant.Processor = _globalCtx.Processor.First(p => p.ProcessorName == txtCardProcessor.Text.Trim());
                    }
                    else
                    {
                        newProcessor.ProcessorName = txtCardProcessor.Text.Trim();
                        _globalCtx.Processor.Add(newProcessor);
                        newMerchant.Processor = newProcessor;
                    }
                }

                _globalCtx.Banks.Add(newBankModel);

                newBankAccountModel.Bank = newBankModel;
                newDebitCard.Bank = newBankModel;

                _globalCtx.BankAccounts.Add(newBankAccountModel);
                _globalCtx.DebitCards.Add(newDebitCard);

                newMerchant.BankAccount = newBankAccountModel;
                newMerchant.DebitCard = newDebitCard;

                //Set Merchant Status to "Admin Registered"
                newMerchant.MerchantStatus = _globalCtx.MerchantStatuses.FirstOrDefault(ms => ms.StatusDescription == "Pre-Enrolled");

                //Set Underwriting Status to "Pending"
                newMerchant.UnderwritingStatus = _globalCtx.UnderwritingStatuses.FirstOrDefault(ms => ms.StatusDescription == "Pending");

                newMerchant.AdvancePlan = _globalCtx.AdvancePlans.First(ap => ap.DefaultPlan == true);

                //Add new Merchant to context
                _globalCtx.Merchants.Add(newMerchant);

                //Add new merchant to selected User
                if (txtSelectedUserName.Text != "")
                {
                    var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(_globalCtx));
                    ApplicationUser selectedUser = manager.FindByName(txtSelectedUserName.Text);
                    if (selectedUser != null)
                    {
                        selectedUser.Merchant = newMerchant;

                        //Save Context and Update DB
                        _globalCtx.SaveChanges();
                    }
                }
                else
                {
                    lblSubmissionMessage.Text = "Please select a User to join with this merchant.";
                    return false;
                }
            }
            catch (System.Exception ex)
            {
                _newLogic.WriteExceptionToDB(ex, "AdminSubmitForm - Add Data to DB");
                return false;
            }

            return true;
        }
Example #22
0
 public void Delete(ContactModel contactModel)
 {
     contactsModel.Remove(contactModel);
 }
Example #23
0
 private void uxFileDelete_Click(object sender, RoutedEventArgs e)
 {
     App.ContactRepository.Delete(selectedContact.Id);
     selectedContact = null;
     LoadContacts();
 }
Example #24
0
        public ActionResult API(ContactModel contactModel)
        {
            ViewBag.PageTitle = 
                "CodeGenerate.me - Our new API is currently in development.";

            if (ModelState.IsValid)
            {
                SendEmail sendEmail = new SendEmail(contactModel.Email, contactModel.Subject, contactModel.Description,
                                                    contactModel.Name);

                // Successful
                contactModel.SentSuccesfully = 2;
            }
            else
            {

                // Not ready - validation failed
                contactModel.SentSuccesfully = 1;
            }

            return View(contactModel);
        }
Example #25
0
 public void Put(int id, [FromBody] ContactModel model)
 {
     contactService.UpdateContact(model, id);
 }
 public bool AddContact(ContactModel contactModel)
 {
     contactModel.Status = ContactStatus.Active.ToString();
     _unitOfWork.Contacts.Add(MapModelToDataModel(contactModel));
     return(_unitOfWork.SaveChanges() > 0);
 }
        private void SaveContactChanges(MerchantModel editMerchant)
        {
            try
            {
                foreach (RepeaterItem rItem in rptrContactChanges.Items)
                {
                    Label lblFieldName = (Label)rItem.FindControl("lblFieldName2");
                    Label lblNewValue = (Label)rItem.FindControl("lblNewValue2");
                    CheckBox cbConfirmed = (CheckBox)rItem.FindControl("cbConfirmed2");

                    if (lblFieldName != null && lblNewValue != null && cbConfirmed != null)
                    {
                        if (lblFieldName.Text == "FirstName")
                        {
                            if (cbConfirmed.Checked)
                            {
                                if (editMerchant.Contact != null)
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Contact.FirstName, lblNewValue.Text);

                                    editMerchant.Contact.FirstName = lblNewValue.Text.Trim();
                                }
                                else
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "", lblNewValue.Text);

                                    ContactModel newContact = new ContactModel();
                                    newContact.FirstName = lblNewValue.Text.Trim();
                                    _globalCtx.Contacts.Add(newContact);
                                    editMerchant.Contact = newContact;
                                }
                            }
                            else
                            {
                                if (editMerchant.Contact != null)
                                {
                                    txtContactFirstName.Text = editMerchant.Contact.FirstName;
                                }
                                else
                                {
                                    txtContactFirstName.Text = "";
                                }
                            }
                        }

                        if (lblFieldName.Text == "LastName")
                        {
                            if (cbConfirmed.Checked)
                            {
                                if (editMerchant.Contact != null)
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Contact.LastName, lblNewValue.Text);

                                    editMerchant.Contact.LastName = lblNewValue.Text.Trim();
                                }
                                else
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "", lblNewValue.Text);

                                    ContactModel newContact = new ContactModel();
                                    newContact.LastName = lblNewValue.Text.Trim();
                                    _globalCtx.Contacts.Add(newContact);
                                    editMerchant.Contact = newContact;
                                }
                            }
                            else
                            {
                                if (editMerchant.Contact != null)
                                {
                                    txtContactLastName.Text = editMerchant.Contact.LastName;
                                }
                                else
                                {
                                    txtContactLastName.Text = "";
                                }
                            }
                        }

                        if (lblFieldName.Text == "Email")
                        {
                            if (cbConfirmed.Checked)
                            {
                                if (editMerchant.Contact != null)
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Contact.Email, lblNewValue.Text);

                                    editMerchant.Contact.Email = lblNewValue.Text.Trim();
                                }
                                else
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "", lblNewValue.Text);

                                    ContactModel newContact = new ContactModel();
                                    newContact.Email = lblNewValue.Text.Trim();
                                    _globalCtx.Contacts.Add(newContact);
                                    editMerchant.Contact = newContact;
                                }
                            }
                            else
                            {
                                if (editMerchant.Contact != null)
                                {
                                    txtContactEmail.Text = editMerchant.Contact.Email;
                                }
                                else
                                {
                                    txtContactEmail.Text = "";
                                }
                            }
                        }

                        if (lblFieldName.Text == "Phone")
                        {
                            if (cbConfirmed.Checked)
                            {
                                if (editMerchant.Contact != null)
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Contact.HomePhone, lblNewValue.Text);

                                    editMerchant.Contact.HomePhone = lblNewValue.Text.Trim();
                                }
                                else
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "", lblNewValue.Text);

                                    ContactModel newContact = new ContactModel();
                                    newContact.HomePhone = lblNewValue.Text.Trim();
                                    _globalCtx.Contacts.Add(newContact);
                                    editMerchant.Contact = newContact;
                                }
                            }
                            else
                            {
                                if (editMerchant.Contact != null)
                                {
                                    txtContactPhone.Text = editMerchant.Contact.HomePhone;
                                }
                                else
                                {
                                    txtContactPhone.Text = "";
                                }
                            }
                        }

                        if (lblFieldName.Text == "Fax")
                        {
                            if (cbConfirmed.Checked)
                            {
                                if (editMerchant.Contact != null)
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, editMerchant.Contact.Fax, lblNewValue.Text);

                                    editMerchant.Contact.Fax = lblNewValue.Text.Trim();
                                }
                                else
                                {
                                    AddChangeToAudit(editMerchant.RecordId, lblFieldName.Text, "", lblNewValue.Text);

                                    ContactModel newContact = new ContactModel();
                                    newContact.Fax = lblNewValue.Text.Trim();
                                    _globalCtx.Contacts.Add(newContact);
                                    editMerchant.Contact = newContact;
                                }
                            }
                            else
                            {
                                if (editMerchant.Contact != null)
                                {
                                    txtContactFax.Text = editMerchant.Contact.Fax;
                                }
                                else
                                {
                                    txtContactFax.Text = "";
                                }
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                string userId = "";

                if (Request.IsAuthenticated)
                {
                    userId = Page.User.Identity.GetUserId();
                }
                _newLogic.WriteExceptionToDB(ex, "SaveContactChanges", 0, editMerchant.RecordId, userId);
            }
        }
Example #28
0
        public ActionResult Contact()
        {
            var model = new ContactModel();

            return(PartialView(model));
        }
 public HttpStatusCodeResult Add(ContactModel model)
 {
     return new HttpStatusCodeResult(HttpStatusCode.OK);
 }
        internal void editContact(BookModel bookModel)
        {
            if (!bookRepo.GetBookByName(bookModel.bookName, bookModel.bookType))
            {
                Console.WriteLine("Book Name Not Exist");
            }
            else
            {
                ContactModel contactModel = new ContactModel();
                Console.WriteLine("which data you want to edit please enter your choice");
                Console.WriteLine("1.first Name");
                Console.WriteLine("2.last Name");
                Console.WriteLine("3.address");
                Console.WriteLine("4.city ");
                Console.WriteLine("5.state");
                Console.WriteLine("6.zip code");
                Console.WriteLine("7.phone number");
                Console.WriteLine("8.email");
                string choice = Console.ReadLine();
                Console.WriteLine("Enter first Name");
                contactModel.firstName = Console.ReadLine();
                switch (choice)
                {
                case "1":
                    contactRepo.updateFirstName(contactModel.firstName);
                    break;

                case "2":
                    contactRepo.updateLastName(contactModel.firstName);
                    break;

                case "3":
                    contactRepo.updateAddress(contactModel.firstName);
                    break;

                case "4":
                    contactRepo.updateCity(contactModel.firstName);
                    break;

                case "5":
                    contactRepo.updateState(contactModel.firstName);
                    break;

                case "6":
                    contactRepo.updateZip(contactModel.firstName);
                    break;

                case "7":
                    contactRepo.updatePhoneNumber(contactModel.firstName);
                    break;

                case "8":
                    contactRepo.updateEmail(contactModel.firstName);
                    break;

                default:
                    Console.WriteLine("Invalid choice try again!");
                    break;
                }
            }
        }
Example #31
0
 public ActionResult Save(ContactModel model, FormCollection collection)
 {
     ServiceProvider.ContactService.Save(model, Request.Files);
     return(Json(new { Msg = "OK" }, JsonRequestBehavior.AllowGet));
 }
 /// <summary>
 /// It initializes the NewContact property and sets a few values
 /// </summary>
 private void InitializeNewContact()
 {
     NewContact             = new ContactModel();
     NewContact.DateOfBirth = DateTime.Today;
     NewContact.ImagePath   = "/Images/default.jpg";
 }
Example #33
0
 public void Add(ContactModel contactModel)
 {
     contactsModel.Add(contactModel);
 }
        public ContactModel[] LookupContactList(string firstname, string lastname, string phone, string email, int _logIncidentId = 0, int _logContactId = 0)
        {
            ContactModel[] retvals = null;
            string request = "";
            string response = "";
            string logMessage, logNote;

            if (String.IsNullOrWhiteSpace(ContactListLookupURL) || String.IsNullOrWhiteSpace(ContactServiceUsername) || String.IsNullOrWhiteSpace(ContactServicePassword))
            {
                throw new Exception("Provider's InitForContact not run.");
            }

            CONTACT.HZ_INTEGRATION_PUB_Service client = EBSProxyFactory.GetContactInstance(ContactListLookupURL, ContactServiceUsername, ContactServicePassword, ContactServiceTimeout);

            CONTACT.SOAHeader hdr = new CONTACT.SOAHeader();
            hdr.Responsibility = "SYSTEM_ADMINISTRATOR";
            hdr.RespApplication = "SYSADMIN";
            hdr.SecurityGroup = "STANDARD";
            hdr.NLSLanguage = "AMERICAN";
            hdr.Org_Id = "204";

            client.SOAHeaderValue = hdr;

            CONTACT.InputParameters ip_contact_list = new CONTACT.InputParameters();

            /* not supported in new official api
            ip.P_FIRST_NAME = firstname;
            ip.P_LAST_NAME = lastname;
             */

            if (email != null)
                ip_contact_list.P_EMAIL = email;

            ip_contact_list.P_RECORD_LIMIT = 200;
            ip_contact_list.P_RECORD_LIMITSpecified = true;

            if (!String.IsNullOrEmpty(phone) && phone.Length >= 7)
            {
                if (phone[phone.Length - 5] == '-' || phone[phone.Length - 5] == ' ')
                {
                    ip_contact_list.P_PHONE = phone.Substring(phone.Length - 8);
                }
                else
                {
                    ip_contact_list.P_PHONE = phone.Substring(phone.Length - 7);
                }
            }

            Stopwatch stopwatch = new Stopwatch();
            try
            {
                request = serializer.Serialize(ip_contact_list);
                stopwatch.Start();
                CONTACT.OutputParameters op_contact_list = client.GET_CONTACT_DETAIL(ip_contact_list);
                stopwatch.Stop();
                response = serializer.Serialize(op_contact_list);

                if (op_contact_list.X_RETURN_STATUS == "S")
                {
                    List<ContactModel> contacts = new List<ContactModel>();

                    foreach (CONTACT.APPSHZ_INTEGRATION_PX3348183X1X7 op in op_contact_list.X_CONTACT_REC_TBL)
                    {
                        ContactModel contact = new ContactModel();
                        contact.ContactPartyID = op.RELATIONSHIP_PARTY_ID;
                        contact.FirstName = op.PERSON_FIRST_NAME;
                        contact.LastName = op.PERSON_LAST_NAME;
                        contact.Email = op.PRIMARY_EMAIL;
                        contact.ContactOrgID = op.ORG_PARTY_ID;
                        contact.PhoneNumber = op.PRIMARY_PHONE;
                        contacts.Add(contact);
                    }
                    retvals = contacts.ToArray();

                    logMessage = "Request of search Contact (Success). Email = " + email + "; Phone = " + phone;
                    logNote = "Request Payload: " + request;
                    log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote);

                    logMessage = "Response of search Contact (Success). Email = " + email + "; Phone = " + phone;
                    logNote = "Response Payload: " + response;
                    log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote, (int)stopwatch.ElapsedMilliseconds);
                }
                else
                {
                    List<ContactModel> contacts = new List<ContactModel>();
                    ContactModel contact = new ContactModel();
                    contact.ErrorMessage = "There has been an error communicating with EBS. Please check log for detail.";
                    contacts.Add(contact);
                    retvals = contacts.ToArray();

                    logMessage = "Request of search Contact (Failure). Email = " + email + "; Phone = " + phone;
                    logNote = "Request Payload: " + request;
                    log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote);

                    logMessage = "Response of search Contact (Failure). Email = " + email + "; Phone = " + phone;
                    logNote = "Response Payload: " + response;
                    log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote);
                }
            }

            catch (Exception ex)
            {
                List<ContactModel> contacts = new List<ContactModel>();
                ContactModel contact = new ContactModel();
                contact.ErrorMessage = "There has been an error communicating with EBS. Please check log for detail.";
                contacts.Add(contact);
                retvals = contacts.ToArray();

                logMessage = "Request of search Contact (Failure). Email = " + email + "; Phone = " + phone + ". Error: " + ex.Message;
                logNote = "Request Payload: " + request;
                log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote);

                logMessage = "Response of search Contact (Failure). Email = " + email + "; Phone = " + phone + ". Error: " + ex.Message;
                logNote = "Response Payload: " + response;
                log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote);

                handleEBSException(ex, "Search Contact", _logIncidentId, _logContactId);
            }

            return retvals;
        }
Example #35
0
        public IActionResult Contact4(ContactModel model)
        {
            ViewData["Message"] = "Your contact page.";

            return(View(!ModelState.IsValid ? model : new ContactModel()));
        }
        /* This method calls
         * HZ_INTEGRATION_PUB_Service : GET_CONTACT_DETAIL()
         * Its output is a table, foreach loop is used 
         * (even though only one row is returned by setting record limit = 1)
         * APPSHZ_INTEGRATION_PX3348183X1X7 is generated and need to be updated 
         * if proxy is regenerated
         *  call dictAddProperty() to add the individual property name, type, and value
         *  for dynamic columns feature
         */
        public Dictionary<string, string> LookupContactDetail(decimal party_id, int _logIncidentId = 0, int _logContactId = 0)
        {
            string request = "";
            string response = "";
            string logMessage, logNote;

            if (String.IsNullOrWhiteSpace(ContactListLookupURL) || String.IsNullOrWhiteSpace(ContactServiceUsername) || String.IsNullOrWhiteSpace(ContactServicePassword))
            {
                throw new Exception("Provider's InitForContact not run.");
            }

            CONTACT.HZ_INTEGRATION_PUB_Service client = EBSProxyFactory.GetContactInstance(ContactListLookupURL, ContactServiceUsername, ContactServicePassword, ContactServiceTimeout);

            CONTACT.InputParameters ip = new CONTACT.InputParameters();
            ip.P_PARTY_ID = party_id;
            ip.P_PARTY_IDSpecified = true;
            ip.P_RECORD_LIMIT = 1; // only return one contact
            ip.P_RECORD_LIMITSpecified = true;
            CONTACT.OutputParameters op = null;
            Stopwatch stopwatch = new Stopwatch();
            try
            {
                request = serializer.Serialize(ip);

                logMessage = "Request of getting EBS contact details (GET_CONTACT_DETAIL). ";
                logNote = "Request Payload: " + request;
                log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote);
                // call the web service, catch the exception right away
                stopwatch.Start();
                op = client.GET_CONTACT_DETAIL(ip);
                stopwatch.Stop();
                response = serializer.Serialize(op);
            }
            catch (Exception ex)
            {
                handleEBSException(ex, "GET_CONTACT_DETAIL", 0, (int)party_id);
                // will throw the new exception (either timeout or error communicating ...)
                // b/c caller ContactDetailVirtualTable GetRows expect reportRows, so need to throw it to show the msg box
                throw;
            }
            if (op.X_RETURN_STATUS == "S")
            {
                logMessage = "Response of getting EBS contact details (GET_CONTACT_DETAIL). ";
                logNote = "Response Payload: " + response;
                log.DebugLog(_logIncidentId, _logContactId, logMessage, logNote, (int) stopwatch.ElapsedMilliseconds);
            }
            else
            {
                logMessage = "Response of getting EBS contact details (GET_CONTACT_DETAIL) (Failure). ";
                logNote = "Response Payload: " + response;
                log.ErrorLog(_logIncidentId, _logContactId, logMessage, logNote);
            }
            Dictionary<string, string> dictDetail = new Dictionary<string, string>();
            ContactModel[] retvals = new ContactModel[op.X_CONTACT_REC_TBL.Length];

            foreach (CONTACT.APPSHZ_INTEGRATION_PX3348183X1X7 contact in op.X_CONTACT_REC_TBL)
            {
                foreach (PropertyInfo propertyInfo in contact.GetType().GetProperties())
                {
                    Object propVal = contact.GetType().GetProperty(propertyInfo.Name).GetValue(contact, null);
                    dictAddProperty(propertyInfo, propVal, ref dictDetail);                                      
                }
            }
            return dictDetail;
        }
 public ContactViewModel()
 {
     CM = new ContactModel();
     this.GetData(2);
     this.MessageData = new MessageData { ToAddress = "*****@*****.**" };
 }
Example #38
0
 private void uxContactList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     selectedContact = (ContactModel)uxContactList.SelectedValue;
 }
        private void addContactClick(object sender, RoutedEventArgs e)
        {
            Regex regex = new Regex("\\d+");
            Regex whitespace = new Regex("[ ()-.]");

            // format lại chuỗi: xoá các khoảng trắng các dấu
            string temp = whitespace.Replace(_textContentVM.Content, String.Empty);
            MatchCollection matches = regex.Matches(temp);

            List<string> listPhoneNumber = new List<string>();
            int countStr = matches.Count;
            for (int i = 0; i < countStr; i++)
			{
               listPhoneNumber.Add(matches[i].Value);
			}

            ContactModel contactmodel = new ContactModel();
            contactmodel.Mobilephone = getMobilePhone(listPhoneNumber);
            contactmodel.AlternateMobilePhone = getAlternateMobilePhone(listPhoneNumber);

            contactmodel.GivenName = getGivenName();

            contactmodel.Email = getEmail();

            Frame.Navigate(typeof(AddContact), contactmodel);
        }
Example #40
0
 public void Register([FromBody] ContactModel model)
 {
     contactService.SaveContact(model);
 }