Пример #1
0
        public string SendPasswordReset(ContactUser user)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            var xmlDoc = new XDocument(new XDeclaration("1.0", "utf-8", "true"));
            var root   = new XElement("Root");

            root.Add(new XElement("FirstName", user.ContactUserName));
            root.Add(new XElement("Email", user.Email));
            root.Add(new XElement("PasswordResetUrl", _passwordResetUrlFragment + user.ResetPassword));
            xmlDoc.Add(root);

            var htmlBody = CreateEmailBody(xmlDoc, string.Format(@"Xsl\{0}\PasswordReset.xslt", _currentLanguageIsoCode));
            var textBody = CreateEmailBody(xmlDoc,
                                           string.Format(@"Xsl\{0}\PasswordResetPlainText.xslt", _currentLanguageIsoCode));

            var mailTo = !string.IsNullOrEmpty(_replacementEmailRecipients) ? _replacementEmailRecipients : user.Email;

            string errors;

            EmailService.SendHtmlEmailWithImbeddedImages(Constants.MonsciergeSalesEmailAddress, mailTo, "Welcome!", htmlBody,
                                                         textBody, out errors);

            return(errors);
        }
Пример #2
0
        public ActionResult ShowContact(int contactId = -1)
        {
            string loggedUserName = UserSession.GetLoggedUserName();

            if (contactId > 0)
            {
                ContactUser contactUser = contactProcess.IsContactExist(this, loggedUserName, contactId);

                if (contactUser != null)
                {
                    Contact contact = contactProcess.GetContact(this, loggedUserName, contactId);

                    List <Group> listGroup = contactProcess.GetListGroup(this, loggedUserName, contactId);

                    List <ContactList> listContactList = new List <ContactList>();

                    ContactList contactList = new ContactList();

                    contactList.ContactId = contactId;
                    contactList.Nama      = contact.Nama;
                    contactList.Nomor     = contact.Nomor;
                    contactList.ListGroup = listGroup;

                    listContactList.Add(contactList);

                    return(View(listContactList));
                }
                else
                {
                    return(Redirect("~/Contact"));
                }
            }
            return(Redirect("~/Contact"));
        }
Пример #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //
            string server = ConfigurationManager.AppSettings["Server"];
            string http   = ConfigurationManager.AppSettings["Http"];

            wb.Source = new Uri(http);
            myClient  = new MyClient(server, "");
            myClient.OnOpenedClient          += MyClient_OnOpenedClient;
            myClient.OnCloseSocket           += MyClient_OnCloseSocket;
            myClient.OnErrorClient           += MyClient_OnErrorClient;
            myClient.OnMessageRecievedClient += MyClient_OnMessageRecievedClient;
            myClient.OnChangeContactList     += MyClient_OnChangeContactList;
            myClient.OnChangeDialogList      += MyClient_OnChangeDialogList;
            CurrentContactUser = new ContactUser();
            timerMain          = new DispatcherTimer();
            timerMain.Tick    += TimerMain_Tick;
            timerMain.Interval = new TimeSpan(0, 0, 2);//через каждые 2 секунды
            try
            {
                var name = WindowsIdentity.GetCurrent().Name;
                myClient.Winlogin = name.Substring(name.IndexOf('\\') + 1);
                //запуск клиента по таймеру
                timerMain.Start();
            }
            catch (Exception)
            {
            }
        }
Пример #4
0
        public void SubmitForm(ContactUser contactUser)
        {
            this.SubjectSelect.Click();
            this.SubjectSelect.FindElement(By.XPath($"option[@value={(int)contactUser.Subject}]")).Click();
            Reporter.LogPassingTestStepForBuglLogger($"Select subject => {contactUser.Subject}");

            this.EmailField.SendKeys(contactUser.Email);
            Reporter.LogPassingTestStepForBuglLogger($"Enter email => {contactUser.Email}");

            if (contactUser.OrderReference != null)
            {
                this.OrderReference.SendKeys(contactUser.OrderReference);
                Reporter.LogPassingTestStepForBuglLogger($"Enter order reference => {this.OrderReference.Text}");
            }

            if (contactUser.FileAttach != null)
            {
                if (this.Driver.GetType() == typeof(RemoteWebDriver))
                {
                    CodePagesEncodingProvider.Instance.GetEncoding(437);
                    Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
                    ((RemoteWebDriver)this.Driver).FileDetector = new LocalFileDetector();
                }

                this.FileAttach.SendKeys(contactUser.FileAttach);
                Reporter.LogPassingTestStepForBuglLogger($"Attach filename => {contactUser.FileAttach}");
            }

            this.MessageTextArea.SendKeys(contactUser.Message);
            Reporter.LogPassingTestStepForBuglLogger($"Enter message text => {contactUser.Message}");

            this.SubmitButton.Click();
            Reporter.LogPassingTestStepForBuglLogger("Submit contact form");
        }
        public int SaveContact(Controller controller, string userName, Contact contact)
        {
            ContactUser contactUser = IsContactExist(controller, userName, contact.ContactId);

            if (contactUser == null)
            {
                db.Contacts.Add(contact);
                db.SaveChanges();

                contactUser = new ContactUser
                {
                    ContactId = contact.ContactId,
                    UserName  = UserSession.GetLoggedUserName()
                };

                db.ContactUser.Add(contactUser);
                db.SaveChanges();
            }
            else
            {
                db.SaveChanges();
            }

            return(contact.ContactId);
        }
Пример #6
0
 public AddUserViewModel(INavigation navigation)
 {
     _navigation       = navigation;
     _contactValidator = new UserValidator();
     _user             = new User();
     _contactUser      = new ContactUser();
     AddUserCommand    = new Command(async() => await AddUser());
 }
Пример #7
0
        private List <ContactUser> VerifyContacts(List <ContactUser> contacts, string winlogin)
        {
            List <ContactUser> lstCont = new List <ContactUser>();
            ContactUser        user    = contacts.Find(x => x.Winlogin == winlogin);

            this._contactuser = user;
            lstCont           = contacts.FindAll(x => x.Winlogin != winlogin);
            return(lstCont);
        }
Пример #8
0
        public void ContactFormShouldSendMessageToCustomerServiceSuccessfully(ContactSubject subject)
        {
            this.contactPage.Open();
            var contactUser = new ContactUser(subject, "*****@*****.**", "Test message");

            contactUser.FileAttach = Directory.GetCurrentDirectory() + @"\Data\example.txt";
            this.contactPage.SubmitForm(contactUser);
            Assert.That(this.contactPage.SuccessMessage.Text == "Your message has been successfully sent to our team.");
        }
        public async Task <ActionResult> DeleteContactUserConfirmed(int id)
        {
            ContactUser contactUser = await db.ContactUsers.FindAsync(id);

            db.ContactUsers.Remove(contactUser);
            await db.SaveChangesAsync();

            return(RedirectToAction("ContactUsersList"));
        }
Пример #10
0
        public ActionResult SendMail(string Emailid, string Message)
        {
            ContactUser objcontact = new ContactUser();

            objcontact.EmailId = Emailid;
            objcontact.Message = Message;
            objcon.AddMailMessage(objcontact);
            objcon.SendMail(Emailid, Message);
            return(View());
        }
Пример #11
0
		public PermissionResult CheckAdBoardPermission( ContactUser user, AdBoard adBoard )
		{
			if( user.UserRoleMaps.Any(
				urm =>
					urm.UserRolePermissionTagMaps.All(
						urptm => adBoard.Hotel.PermissionHotelTagMaps.Any( phtml => phtml.FKPermissionTag == urptm.FKPermissionTag ) ) ) )
				return new PermissionResult() { Result = PermissionResults.Authorized };

			return new PermissionResult( PermissionResults.Unauthorized, "You are unauthorized to access this AdBoard.",
				new[] { new KeyValuePair<string, object>( "userId", user.PKID ), new KeyValuePair<string, object>( "adBoard", adBoard.PKID ), } );
		}
Пример #12
0
        public ActionResult Contact(ContactUser user)
        {
            /*String name = formCol.Get("firstName");
             * String surname = formCol.Get("lastName");
             * String email = formCol.Get("eMail");
             * DateTime dateOfBirth = DateTime.Parse(formCol.Get("dateOfBirth"));
             */
            /*Insert işlemi...*/

            return(View("Index"));
        }
Пример #13
0
        public string SendEventPlannerInvite(ContactUser eventPlanner, bool?newUser, string hotelName)
        {
            if (eventPlanner == null)
            {
                throw new ArgumentNullException("eventPlanner");
            }

            if (newUser.HasValue && newUser.Value)
            {
                var xmlDoc = new XDocument(new XDeclaration("1.0", "utf-8", "true"));
                var root   = new XElement("Root");
                root.Add(new XElement("FirstName", eventPlanner.ContactUserName));
                root.Add(new XElement("Email", eventPlanner.Email));
                root.Add(new XElement("PasswordResetUrl", _verifyAccounUrlFragment + eventPlanner.ResetPassword));
                root.Add(new XElement("Hotel", hotelName));
                xmlDoc.Add(root);

                var htmlBody = CreateEmailBody(xmlDoc, string.Format(@"Xsl\{0}\EventPlannerNew.xslt", _currentLanguageIsoCode));
                var textBody = CreateEmailBody(xmlDoc, string.Format(@"Xsl\{0}\EventPlannerNewPlainText.xslt", _currentLanguageIsoCode));

                var mailTo = !string.IsNullOrEmpty(_replacementEmailRecipients) ? _replacementEmailRecipients : eventPlanner.Email;

                string errors;

                EmailService.SendHtmlEmailWithImbeddedImages(Constants.MonsciergeSalesEmailAddress, mailTo, "Welcome!", htmlBody,
                                                             textBody, out errors);

                return(errors);
            }
            else
            {
                var xmlDoc = new XDocument(new XDeclaration("1.0", "utf-8", "true"));
                var root   = new XElement("Root");
                root.Add(new XElement("FirstName", eventPlanner.ContactUserName));
                root.Add(new XElement("Email", eventPlanner.Email));
                root.Add(new XElement("EventsUrl", "https://connect.monscierge.com/ConnectCMS/events"));
                root.Add(new XElement("Hotel", hotelName));
                xmlDoc.Add(root);

                var htmlBody = CreateEmailBody(xmlDoc, string.Format(@"Xsl\{0}\EventPlannerExisting.xslt", _currentLanguageIsoCode));
                var textBody = CreateEmailBody(xmlDoc, string.Format(@"Xsl\{0}\EventPlannerExistingPlainText.xslt", _currentLanguageIsoCode));

                var mailTo = !string.IsNullOrEmpty(_replacementEmailRecipients) ? _replacementEmailRecipients : eventPlanner.Email;

                string errors;

                EmailService.SendHtmlEmailWithImbeddedImages(Constants.MonsciergeSalesEmailAddress, mailTo, "Welcome!", htmlBody,
                                                             textBody, out errors);

                return(errors);
            }
        }
Пример #14
0
        public ContactUserComment CreateComment(
            ContactUser contact,
            String content
            )
        {
            var comment = new ContactUserComment();

            comment.Content   = content;
            comment.CreatedAt = DateTime.Today;
            contact.Comments.Add(comment);

            return(comment);
        }
Пример #15
0
		public PermissionResult CheckAdBoardPermission( ContactUser user, int adBoardId )
		{
			var adBoard = GetAdBoard( adBoardId ).Include( x => x.Hotel.PermissionHotelTagMaps ).FirstOrDefault();

			if( adBoard == null )
			{
				return new PermissionResult( PermissionResults.InvalidObject,
					"The AdBoard you are trying to access does not exist",
					new[] { new KeyValuePair<string, object>( "adBoardId", adBoardId ) }
					);
			}
			return CheckAdBoardPermission( user, adBoard );
		}
Пример #16
0
        public ActionResult Create(Contact newContact, string groupName = "")
        {
            string loggedUserName = UserSession.GetLoggedUserName();
            bool   sukses         = false;

            if (ModelState.IsValid)
            {
                db.Contacts.Add(newContact);
                db.SaveChanges();

                ContactUser contactUser = new ContactUser {
                    ContactId = newContact.ContactId,
                    UserName  = UserSession.GetLoggedUserName()
                };

                db.ContactUser.Add(contactUser);
                db.SaveChanges();

                //Group group = from dataGroup in db.Groups where dataGroup.GroupName == groupName select dataGroup
                //GroupUser groupUser = (GroupUser)from dataGroup in db.GroupUser where dataGroup.Group.GroupName == groupName && dataGroup.UserName == UserSession.GetLoggedUserName() select dataGroup;
                GroupUser groupUser = db.GroupUser.SingleOrDefault(dataGroup => dataGroup.Group.GroupName == groupName && dataGroup.UserName == loggedUserName);

                if (groupUser == null)
                {
                    Group newGroup = new Group {
                        GroupName = groupName
                    };
                    this.CreateGroup(newGroup);
                    this.AddContactToGroup(newContact, newGroup);
                }
                else
                {
                    this.AddContactToGroup(newContact, groupUser.Group);
                }

                sukses = true;

                if (!Request.IsAjaxRequest())
                {
                    return(Redirect("~/Contact?sukses=1"));
                }
            }

            if (Request.IsAjaxRequest())
            {
                return(Json(sukses));
            }

            return(View());
        }
Пример #17
0
 internal string AddMailMessage(ContactUser model)
 {
     try
     {
         GTLOANEntities dbcontext = new GTLOANEntities();
         dbcontext.ContactUsers.Add(model);
         dbcontext.SaveChanges();
         return("success");
     }
     catch (Exception ex)
     {
         throw;
     }
 }
        public async Task <ActionResult> DeleteContactUser(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ContactUser contactUser = await db.ContactUsers.FindAsync(id);

            if (contactUser == null)
            {
                return(HttpNotFound());
            }
            return(View(contactUser));
        }
Пример #19
0
        public void ShowContact(ContactUser contact)
        {
            Console.WriteLine("{0}\t{1}", contact.Name, contact.Mobile);
            Console.WriteLine("\tGender: {0}\tBirthday: {1}",
                              contact.Gender, contact.Birthday);
            Console.WriteLine("\tCompany: {0}\tAddress: {1}",
                              contact.Company, contact.Address);

            Console.WriteLine("\tUser Comments:");
            foreach (var comment in contact.Comments)
            {
                Console.WriteLine("\t\t{0}", comment.Content);
            }
        }
        public Contact GetContact(Controller controller, string userName, int contactId)
        {
            Contact     contact     = null;
            ContactUser contactUser = null;

            contactUser = (
                from contactUsers in db.ContactUser
                where
                contactUsers.ContactId == contactId && contactUsers.UserName == userName
                select contactUsers
                ).ToList().First();

            contact = contactUser.Contact;

            return(contact);
        }
        public ContactUser IsContactExist(Controller controller, string userName, int contactId)
        {
            List <ContactUser> listGroupUser = (
                from contactUsers in db.ContactUser
                where
                contactUsers.UserName == userName && contactUsers.ContactId == contactId
                select contactUsers
                ).ToList();

            ContactUser contactUser = null;

            if (listGroupUser.Count() > 0)
            {
                contactUser = listGroupUser.First();
            }


            return(contactUser);
        }
Пример #22
0
 /// <summary>
 /// Adding new user details
 /// </summary>
 /// <param name="contactUser"></param>
 /// <returns></returns>
 public string NewContactUser(ContactUser contactUser)
 {
     try
     {
         var usr = _usersContext.ContactUserDbSet.Where(x => x.FName == contactUser.FName && x.LName == contactUser.LName && x.DOB == contactUser.DOB).FirstOrDefault();
         if (usr != null)
         {
             return(Constants.UserExists);
         }
         _usersContext.ContactUserDbSet.Add(contactUser);
         _usersContext.SaveChanges();
         return(Constants.NewUser);
     }
     catch (Exception ex)
     {
         _logger.Log(LogLevel.Error, ex.Message);
         return(null);
     }
 }
Пример #23
0
        public ContactUser CreateContact(
            String name,
            ContactUser.ContactGender gender,
            String address,
            DateTime birthday,
            String company,
            String mobile
            )
        {
            var contact = new ContactUser();

            contact.Name     = name;
            contact.Gender   = gender;
            contact.Address  = address;
            contact.Birthday = birthday;
            contact.Company  = company;
            contact.Mobile   = mobile;

            return(contact);
        }
Пример #24
0
        /// <summary>
        /// Edit and update user details.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="contactUser"></param>
        /// <returns></returns>
        public string EditUpdateUser(int id, ContactUser contactUser)
        {
            try
            {
                var user = _usersContext.ContactUserDbSet.Find(id);
                if (user == null)
                {
                    return(Constants.NoUser);
                }

                _usersContext.ContactUserDbSet.Update(contactUser);
                _usersContext.SaveChanges();
                return(Constants.EditUpdate);
            }
            catch (SqlException ex)
            {
                _logger.Log(LogLevel.Error, ex.Message);
                return(null);
            }
        }
Пример #25
0
        public async Task <ActionResult> SendSug(ContactViewModel model)
        {
            var response = new AjaxResponse {
                Success = false
            };
            var errorMessages = new List <string>();

            try
            {
                if (ModelState.IsValid)
                {
                    var user = new ContactUser
                    {
                        Names        = model.ContactNames,
                        Email        = model.ContactEmail,
                        PhoneNumber  = model.ContactPhoneNumber,
                        Suggests     = model.ContactSuggests,
                        DateCreation = DateTime.Now
                    };
                    var result = storeDB.ContactUsers.Add(user);
                    await storeDB.SaveChangesAsync();

                    response.Success = true;
                    response.Message = "Los datos fueron enviados correctamente";
                    return(Json(response, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    response.Message = "Lo sentimos, no se pudo realizar la operación. Ha ocurrido un error en el servidor.";
                    return(Json(response, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception)
            {
                response.Message = "Lo sentimos, no se pudo realizar la operación. Ha ocurrido un error en el servidor.";
                return(Json(response, JsonRequestBehavior.AllowGet));
            }
        }
        public async Task UserController_Should_Post_Valid_Request()
        {
            string msg = "Successfully added new contact";
            var    usr = new ContactUser
            {
                ContactID = 2345,
                FName     = "Test1",
                LName     = "TestLast",
                DOB       = DateTime.Parse("09/02/1984"),
                Email     = "*****@*****.**",
                Phone     = "5678907890"
            };

            var usersManager = new Mock <IContactUser>();

            usersManager.Setup(m => m.NewContactUser(It.IsAny <ContactUser>())).Returns(await Task.FromResult(msg));
            var userController = new UsersController(usersManager.Object);
            var resp           = userController.Post(usr);
            var result         = resp as OkObjectResult;
            var actualValue    = result.Value as string;

            Assert.AreEqual(msg, actualValue);
        }
        public async Task<ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ContactUser() { UserName = model.Email, IsDisabled = false };
                IdentityResult result = await UserManager.CreateAsync(user, model.Password);
                if (result.Succeeded)
                {
                    await SignInAsync(user, isPersistent: false);

                    // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    AddErrors(result);
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
 private async Task SignInAsync(ContactUser user, bool isPersistent)
 {
     AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
     AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, await user.GenerateUserIdentityAsync(UserManager));
 }
        public async Task<ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl)
        {
            if (User.Identity.IsAuthenticated)
            {
                return RedirectToAction("Manage");
            }

            if (ModelState.IsValid)
            {
                // Get the information about the user from the external login provider
                var info = await AuthenticationManager.GetExternalLoginInfoAsync();
                if (info == null)
                {
                    return View("ExternalLoginFailure");
                }
                var user = new ContactUser() { UserName = model.Email, IsDisabled = false };
                IdentityResult result = await UserManager.CreateAsync(user);
                if (result.Succeeded)
                {
                    result = await UserManager.AddLoginAsync(user.Id, info.Login);
                    if (result.Succeeded)
                    {
                        await SignInAsync(user, isPersistent: false);
                        
                        // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                        // Send an email with this link
                        // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                        // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                        // SendEmail(user.Email, callbackUrl, "Confirm your account", "Please confirm your account by clicking this link");
                        
                        return RedirectToLocal(returnUrl);
                    }
                }
                AddErrors(result);
            }

            ViewBag.ReturnUrl = returnUrl;
            return View(model);
        }
Пример #30
0
        public IActionResult Post([FromBody] ContactUser userModel)
        {
            var respoonse = _userService.NewContactUser(userModel);

            return(Ok(respoonse));
        }
Пример #31
0
        public ContactManager AddContact(ContactUser contact)
        {
            Contacts.Add(contact);

            return(this);
        }
Пример #32
0
        public IActionResult Put(int id, [FromBody] ContactUser userModel)
        {
            var respoonse = _userService.EditUpdateUser(id, userModel);

            return(Ok(respoonse));
        }
Пример #33
0
 public bool RemoveContact(ContactUser contact)
 {
     return(Contacts.Remove(contact));
 }