public void returns_expected_message_format()
        {
            var e = new DomainEventEnvelope
            {
                AggregateId   = "A1",
                EventId       = Guid.Empty,
                CorrelationId = "987F693E-EF45-4518-8AFB-105B209887B1",
                Type          = "foo-type",
                Data          = "{\"Foo\":\"bar\"}"
            };

            var result = MessagingHelper.CreateMessageFrom(e);

            var expected = @"
{
    ""version"": ""1"",
    ""eventName"": ""foo-type"",
    ""x-correlationId"": ""987F693E-EF45-4518-8AFB-105B209887B1"",
    ""x-sender"": ""CapabilityService.WebApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"",
    ""payload"": {""foo"":""bar""}
}";

            Assert.Equal(
                expected: expected.Replace(" ", "").Replace("\n", "").Replace("\r", ""),
                actual: result.Replace(" ", "").Replace("\n", "").Replace("\r", "")
                );
        }
Beispiel #2
0
        public async Task TestPublished()
        {
            var guild = ((IGuildUser)Context.Message.Author).Guild;

            var user = ((IGuildUser)Context.Message.Author);

            if (!user.GuildPermissions.ManageGuild)
            {
                return;
            }

            var message = await MessagingHelper.BuildTestPublishedMessage((SocketUser)Context.User, Context.Guild.Id, Context.Channel.Id);

            if (message != null)
            {
                try
                {
                    if (message.Embed != null)
                    {
                        RequestOptions options = new RequestOptions();
                        options.RetryMode = RetryMode.AlwaysRetry;
                        var msg = await Context.Channel.SendMessageAsync(message.Message, false, message.Embed, options);
                    }
                    else
                    {
                        var msg = await Context.Channel.SendMessageAsync(message.Message);
                    }
                }
                catch (Exception ex)
                {
                    Logging.LogError("Error in Message.Test Command: " + ex.Message);
                }
            }
        }
Beispiel #3
0
 public ChaplainController()
 {
     ViewBag.Logs      = ContactLogHelper.GetContactLogsByMentorId(ref this._db, _userId).Take(3);
     ViewBag.Messages  = MessagingHelper.GetMessagesToUserId(ref this._db, _userId).Take(3);
     ViewBag.Events    = CalendarHelper.GetEventsByUserId(ref this._db, _userId).Take(3);
     ViewBag.Resources = ResourceHelper.GetResources(ref this._db).Take(3);
 }
Beispiel #4
0
 public MessagingController()
 {
     ViewBag.UserId = AccountHelper.GetUserIdByUsername(ref this._db, WebSecurity.CurrentUserName);
     ViewBag.Users  = AccountHelper.GetUserDropdownList(ref this._db);
     ViewBag.Inbox  = MessagingHelper.GetMessagesToUserId(ref this._db, ViewBag.UserId);
     ViewBag.Outbox = MessagingHelper.GetMessagesFromUserId(ref this._db, ViewBag.UserId);
     ViewBag.YesNo  = _db.YesNoList;
 }
        public HttpResponseMessage SaveUser([FromBody] Models.User1 user)
        {
            try
            {
                CivilWorksEntities2 context = new CivilWorksEntities2();
                context.User1.Add(user);
                context.SaveChanges();
                User1 user_ = context.User1.Where(p => p.UserName == user.UserName).FirstOrDefault <User1>();

                #region Insert Invitation
                CivilWorksEntities2 context1 = new CivilWorksEntities2();
                userActivation.PasswordActivattionKey = Guid.NewGuid();
                userActivation.DateCreated            = user.CreatedDate;
                userActivation.UserID     = user_.ID;
                userActivation.IsExpired  = false;
                userActivation.ExpiryDate = System.DateTime.Now.AddDays(1);
                context1.UserPasswordActivations.Add(userActivation);
                context1.SaveChanges();
                #endregion

                #region mail notification
                try
                {
                    string VerificationLink = "<a href='" + Utility.GetConfigValue("VerificationLink") + "/" + userActivation.PasswordActivattionKey + "' target='_blank'>" + Utility.GetConfigValue("VerificationLink") + "/" + userActivation.PasswordActivattionKey + "</a>";

                    string MailMessageForCompany = "Dear " + user_.FirstName + ",<br><br>You have been registered in Our Portal. <br><br> Please confirm your account by clicking below link in order to use.<br><br><b>" + VerificationLink + "</b><br><br>Thanks";
                    //  string NotificationForCompany = "You have been registered in midas portal as a Medical Provider. ";
                    //  string SmsMessageForCompany = "Dear " + user.FirstName + ",<br><br>You have been registered in midas portal as a Medical provider. <br><br> Please confirm your account by clicking below link in order to use.<br><br><b>" + VerificationLink + "</b><br><br>Thanks";

                    // NotificationHelper nh = new NotificationHelper();
                    MessagingHelper mh = new MessagingHelper();

                    #region  company mail object
                    EmailMessage emCompany = new EmailMessage();
                    emCompany.ApplicationName = "Civil Works";
                    emCompany.ToEmail         = user_.UserName;
                    emCompany.EMailSubject    = "Civil Works Notification";
                    emCompany.EMailBody       = MailMessageForCompany;
                    #endregion

                    //  mh.SendEmailAndSms(user_.UserName, 1,emCompany);

                    mh.SendMail(user_.UserName, emCompany.EMailSubject, MailMessageForCompany);
                }
                catch (Exception ex)
                {
                }
                #endregion

                return(Request.CreateResponse(HttpStatusCode.OK, "Successfully Saved"));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }
        private async Task DoWork(CancellationToken stoppingToken)
        {
            using (var scope = _serviceProvider.CreateScope())
            {
                var dbContext             = scope.ServiceProvider.GetRequiredService <CapabilityServiceDbContext>();
                var domainEventsToPublish = await dbContext
                                            .DomainEvents
                                            .Where(x => x.Sent == null)
                                            .ToListAsync(stoppingToken);

                if (domainEventsToPublish.Any() == false)
                {
                    return;
                }

                Log.Information($"Domain events to publish: {domainEventsToPublish.Count}");

                var publisherFactory = scope.ServiceProvider.GetRequiredService <KafkaPublisherFactory>();
                var eventRegistry    = scope.ServiceProvider.GetRequiredService <IDomainEventRegistry>();

                Log.Information("Connecting to kafka...");

                using (var producer = publisherFactory.Create())
                {
                    Log.Information("Connected!");

                    foreach (var evt in domainEventsToPublish)
                    {
                        var topicName = eventRegistry.GetTopicFor(evt.Type);
                        var message   = MessagingHelper.CreateMessageFrom(evt);

                        try
                        {
                            var result = await producer.ProduceAsync(
                                topic : topicName,
                                message : new Message <string, string>
                            {
                                Key   = evt.AggregateId,
                                Value = message
                            }
                                );

                            evt.Sent = result.Timestamp.UtcDateTime;
                            await dbContext.SaveChangesAsync();

                            Log.Information($"Domain event \"{evt.Type}>{evt.EventId}\" has been published!");
                        }
                        catch (Exception)
                        {
                            throw new Exception($"Could not publish domain event \"{evt.Type}>{evt.EventId}\"!!!");
                        }
                    }
                }
            }
        }
        public override Task Handle(NoteAddedIntegrationEvent e, MessagingHelper h)
        {
            var theMessage = $"Added note '{e.AddedNote.Text}' by {e.AddedNote.Author}.";

            System.Console.WriteLine(theMessage);

            myMessageBroadcastHub.Clients.All.SendAsync("Message", theMessage);
            h.Ack();

            return(Task.CompletedTask);
        }
        public void Add(OutreachDTO entry)
        {
            string user = Membership.GetUser().UserName;

            if (entry.OutreachType.Id == 1)
            {
                if (!string.IsNullOrEmpty(entry.EmailRecipient) || !string.IsNullOrEmpty(entry.EmailBody) || entry.PersonaId > 0)
                {
                    if (string.IsNullOrEmpty(entry.EmailRecipient) || string.IsNullOrEmpty(entry.EmailBody) || entry.PersonaId < 1)
                    {
                        throw new Exception("Recipient, Sender, and Email Content must all be populated before sending an email.");
                    }
                    else
                    {
                        string attachmentPath = null;

                        if (entry.ArticleId > 0)
                        {
                            ArticleRepository articleRepo = new ArticleRepository();
                            ArticleDTO        article     = articleRepo.GetArticleById(entry.ArticleId);
                            DocumentUtility   docUtil     = new DocumentUtility();
                            attachmentPath = docUtil.ConvertHtmlToDocPath(new DocumentDTO()
                            {
                                Title = article.Title, Content = article.Content
                            });
                        }

                        PersonaDTO persona = new PersonaRepository().GetById(entry.PersonaId);

                        string smtpServer   = persona.SMTPServer;
                        int    smtpPort     = persona.SMTPPort;
                        string smtpUsername = persona.SMTPUsername;
                        string smtpPassword = persona.SMTPPassword;

                        if (persona.Email.ToLower().Contains("@gmail.com"))
                        {
                            smtpServer   = "smtp.gmail.com";
                            smtpPort     = 587;
                            smtpUsername = persona.GmailUsername;
                            smtpPassword = persona.GmailPassword;
                        }

                        MessagingHelper.SendEmail(persona.Email, entry.EmailRecipient, entry.EmailSubject, entry.EmailBody, attachmentPath, smtpServer, smtpPort, smtpUsername, smtpPassword);
                    }
                }
            }

            repo.AddOutreach(entry, user);
        }
        public HttpResponseMessage GeneratePasswordResetLink([FromBody] User1 passwordToken)
        {
            _context = new CivilWorksEntities2();
            UserPasswordActivation passwordReset = null;

            try
            {
                User1 data_ = _context.User1.Where(x => x.UserName == passwordToken.UserName).FirstOrDefault <User1>();
                if (data_ == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, "No record found for this user"));
                    // return new BO.ErrorObject { ErrorMessage = "No record found for this user.", errorObject = "", ErrorLevel = ErrorLevel.Error };
                }
                #region Insert link
                CivilWorksEntities2 context1 = new CivilWorksEntities2();
                userActivation.PasswordActivattionKey = Guid.NewGuid();
                userActivation.DateCreated            = System.DateTime.Now;
                userActivation.UserID     = data_.ID;
                userActivation.IsExpired  = false;
                userActivation.ExpiryDate = System.DateTime.Now.AddDays(1);
                context1.UserPasswordActivations.Add(userActivation);
                context1.SaveChanges();
                #endregion


                string Message = "Dear " + data_.FirstName + ",<br><br>You are receiving this email because you (or someone pretending to be you) requested that your password be reset on the " + Utility.GetConfigValue("Website") + " site.  If you do not wish to reset your password, please ignore this message.<br><br>To reset your password, please click the following link, or copy and paste it into your web browser:<br><br>" + Utility.GetConfigValue("ForgotPasswordLink") + "/" + userActivation.PasswordActivattionKey + " <br><br>Your username, in case you've forgotten: " + data_.UserName + "<br><br>Thanks";
                #region  company mail object
                EmailMessage emCompany = new EmailMessage();
                emCompany.ApplicationName = "Civil Works";
                emCompany.ToEmail         = passwordToken.UserName;
                emCompany.EMailSubject    = "Civil Works Reset Password Link";
                emCompany.EMailBody       = Message;
                #endregion

                MessagingHelper mh = new MessagingHelper();
                mh.SendMail(passwordToken.UserName, emCompany.EMailSubject, Message);


                User1 userDb = _context.User1.Where(p => p.UserName == passwordToken.UserName && p.IsDeleted.Value == false).FirstOrDefault <User1>();
                return(Request.CreateResponse(HttpStatusCode.OK, userDb));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }
Beispiel #10
0
        public async Task Announce(string channelName)
        {
            if (!IsAdmin)
            {
                return;
            }

            var file   = Constants.ConfigRootDirectory + Constants.GuildDirectory + Context.Guild.Id + ".json";
            var server = new DiscordServer();

            if (File.Exists(file))
            {
                server = JsonConvert.DeserializeObject <DiscordServer>(File.ReadAllText(file));
            }

            var twitchId = await _twitchManager.GetTwitchIdByLogin(channelName);

            if (!string.IsNullOrEmpty(twitchId) && twitchId == "0")
            {
                await Context.Channel.SendMessageAsync(channelName + " doesn't exist on Twitch.");

                return;
            }

            var streamResponse = await _twitchManager.GetStreamById(twitchId);

            var stream = streamResponse.stream;

            if (stream == null)
            {
                await Context.Channel.SendMessageAsync(channelName + " isn't online.");

                return;
            }

            string url          = stream.channel.url;
            string name         = StringUtilities.ScrubChatMessage(stream.channel.display_name);
            string avatarUrl    = stream.channel.logo != null ? stream.channel.logo : "https://static-cdn.jtvnw.net/jtv_user_pictures/xarth/404_user_70x70.png";
            string thumbnailUrl = stream.preview.large;

            var message = await MessagingHelper.BuildMessage(name, stream.game, stream.channel.status, url, avatarUrl,
                                                             thumbnailUrl, Constants.Twitch, stream.channel._id.ToString(), server, server.GoLiveChannel, null);

            await MessagingHelper.SendMessages(Constants.Twitch, new List <BroadcastMessage>() { message });
        }
Beispiel #11
0
        public async Task Announce(string channelName)
        {
            if (!IsAdmin)
            {
                return;
            }

            var file   = Constants.ConfigRootDirectory + Constants.GuildDirectory + Context.Guild.Id + ".json";
            var server = new DiscordServer();

            if (File.Exists(file))
            {
                server = JsonConvert.DeserializeObject <DiscordServer>(File.ReadAllText(file));
            }

            var stream = await _mixerManager.GetChannelByName(channelName);

            if (stream == null)
            {
                await Context.Channel.SendMessageAsync(channelName + " doesn't exist on Mixer.");

                return;
            }

            if (stream.online)
            {
                string gameName     = stream.type == null ? "a game" : stream.type.name;
                string url          = "http://mixer.com/" + stream.token;
                string avatarUrl    = stream.user.avatarUrl != null ? stream.user.avatarUrl : "https://mixer.com/_latest/assets/images/main/avatars/default.jpg";
                string thumbnailUrl = "https://thumbs.mixer.com/channel/" + stream.id + ".small.jpg";
                string channelId    = stream.id.Value.ToString();

                var message = await MessagingHelper.BuildMessage(stream.token, gameName, stream.name, url,
                                                                 avatarUrl, thumbnailUrl, Constants.Mixer, channelId, server, server.GoLiveChannel);

                await MessagingHelper.SendMessages(Constants.Mixer, new List <BroadcastMessage>() { message });
            }
            else
            {
                await Context.Channel.SendMessageAsync(channelName + " is offline.");
            }
        }
Beispiel #12
0
        public async Task Announce(string channelName)
        {
            if (!IsAdmin)
            {
                return;
            }

            var file   = Constants.ConfigRootDirectory + Constants.GuildDirectory + Context.Guild.Id + ".json";
            var server = new DiscordServer();

            if (File.Exists(file))
            {
                server = JsonConvert.DeserializeObject <DiscordServer>(File.ReadAllText(file));
            }

            var stream = await _smashcastManager.GetChannelByName(channelName);

            if (stream == null)
            {
                await Context.Channel.SendMessageAsync(channelName + " doesn't exist on Smashcast.");

                return;
            }

            if (stream.livestream[0].media_is_live == "1")
            {
                string gameName     = stream.livestream[0].category_name == null ? "a game" : stream.livestream[0].category_name;
                string url          = "http://smashcast.tv/" + channelName;
                string avatarUrl    = "http://edge.sf.hitbox.tv" + stream.livestream[0].channel.user_logo;
                string thumbnailUrl = "http://edge.sf.hitbox.tv" + stream.livestream[0].media_thumbnail_large;

                var message = await MessagingHelper.BuildMessage(channelName, gameName, stream.livestream[0].media_status,
                                                                 url, avatarUrl, thumbnailUrl, Constants.Smashcast, channelName, server, server.GoLiveChannel, null);

                await MessagingHelper.SendMessages(Constants.Smashcast, new List <BroadcastMessage>() { message });
            }
            else
            {
                await Context.Channel.SendMessageAsync(channelName + " is offline.");
            }
        }
Beispiel #13
0
        public async Task TestLive(string platform)
        {
            if (platform.ToLower() != Constants.Mixer.ToLower() && platform.ToLower() != Constants.YouTube.ToLower() && platform.ToLower() != Constants.Twitch.ToLower() && platform.ToLower() != Constants.Smashcast.ToLower())
            {
                await Context.Channel.SendMessageAsync("Please pass in mixer, smashcast, twitch, youtube or youtube gaming when requesting a test message. (ie: !cb message test youtube)");

                return;
            }

            var guild = ((IGuildUser)Context.Message.Author).Guild;

            var user = ((IGuildUser)Context.Message.Author);

            if (!user.GuildPermissions.ManageGuild)
            {
                return;
            }

            var message = await MessagingHelper.BuildTestMessage((SocketUser)Context.User, Context.Guild.Id, Context.Channel.Id, platform.ToLower());

            if (message != null)
            {
                try
                {
                    if (message.Embed != null)
                    {
                        RequestOptions options = new RequestOptions();
                        options.RetryMode = RetryMode.AlwaysRetry;
                        var msg = await Context.Channel.SendMessageAsync(message.Message, false, message.Embed, options);
                    }
                    else
                    {
                        var msg = await Context.Channel.SendMessageAsync(message.Message);
                    }
                }
                catch (Exception ex)
                {
                    Logging.LogError("Error in Message.Test Command: " + ex.Message);
                }
            }
        }
Beispiel #14
0
        public MentorController()
        {
            ViewBag.UserId       = base._userId;
            ViewBag.Logs         = ContactLogHelper.GetContactLogsByMentorId(ref this._db, _userId).Take(3);
            ViewBag.Messages     = MessagingHelper.GetMessagesToUserId(ref this._db, _userId).Take(3);
            ViewBag.Events       = CalendarHelper.GetEventsByUserId(ref this._db, _userId).Take(3);
            ViewBag.Resources    = ResourceHelper.GetResources(ref this._db).Take(3);
            ViewBag.Mentees      = MentorHelper.GetMenteesDropdownList(ref this._db);
            ViewBag.Ministries   = MinistryHelper.GetMinistriesDropdownList(ref this._db);
            ViewBag.ContactTypes = this._db.ContactTypes;
            ViewBag.Ministries   = _db.MinistriesList;
            ViewBag.States       = _db.StateList;
            ViewBag.Cities       = _db.CityList;
            ViewBag.Prefixes     = _db.Prefixes;
            ViewBag.Suffixes     = _db.Suffixes;
            ViewBag.Genders      = _db.Genders;
            ViewBag.Races        = _db.Races;
            ViewBag.YesNoList    = _db.YesNoList;

            Mapper.CreateMap <ContactLog, ContactLogViewModel>();
            Mapper.CreateMap <ContactLogViewModel, ContactLog>();
        }
Beispiel #15
0
        public async Task Announce(string videoId)
        {
            if (!IsAdmin)
            {
                return;
            }

            var file   = Constants.ConfigRootDirectory + Constants.GuildDirectory + Context.Guild.Id + ".json";
            var server = new DiscordServer();

            if (File.Exists(file))
            {
                server = JsonConvert.DeserializeObject <DiscordServer>(File.ReadAllText(file));
            }

            var videoResponse = await _youTubeManager.GetVideoById(videoId);

            if (videoResponse == null || videoResponse.items == null || videoResponse.items.Count == 0)
            {
                await Context.Channel.SendMessageAsync("A video with the ID " + videoId + " doesn't exist on YouTube.");

                return;
            }

            var video       = videoResponse.items[0];
            var channelData = await _youTubeManager.GetYouTubeChannelSnippetById(video.snippet.channelId);

            string url          = "http://" + (server.UseYouTubeGamingPublished ? "gaming" : "www") + ".youtube.com/watch?v=" + videoId;
            string channelTitle = video.snippet.channelTitle;
            string avatarUrl    = channelData.items.Count > 0 ? channelData.items[0].snippet.thumbnails.high.url : "";
            string thumbnailUrl = video.snippet.thumbnails.high.url;

            var message = await MessagingHelper.BuildMessage(channelTitle, "a game", video.snippet.title, url, avatarUrl, thumbnailUrl,
                                                             Constants.YouTubeGaming, video.snippet.channelId, server, server.GoLiveChannel);

            await MessagingHelper.SendMessages(Constants.YouTube, new List <BroadcastMessage>() { message });
        }
        public void returns_expected_message_format()
        {
            var e = new DomainEventEnvelope
            {
                AggregateId = "A1",
                EventId     = Guid.Empty,
                Type        = "foo-type",
                Data        = "{\"Foo\":\"bar\"}"
            };

            var result = MessagingHelper.CreateMessageFrom(e);

            var expected = @"
{
    ""messageId"": ""00000000-0000-0000-0000-000000000000"",
    ""type"": ""foo-type"",
    ""data"": {""foo"":""bar""}
}";

            Assert.Equal(
                expected: expected.Replace(" ", "").Replace("\n", "").Replace("\r", ""),
                actual: result.Replace(" ", "").Replace("\n", "").Replace("\r", "")
                );
        }
Beispiel #17
0
        public override Object Save <T>(T entity)
        {
            BO.User userBO = (BO.User)(object) entity;
            if (userBO == null)
            {
                return new BO.ErrorObject {
                           ErrorMessage = "User object can't be null", errorObject = "", ErrorLevel = BO.ErrorLevel.Error
                }
            }
            ;

            EO.User userDB = new EO.User();
            EO.UserPasswordActivation activationDB = new EO.UserPasswordActivation();
            bool isEditMode = false;

            userDB.UserName      = userBO.UserName;
            userDB.FirstName     = userBO.FirstName;
            userDB.LastName      = userBO.LastName;
            userDB.ID            = userBO.ID;
            userDB.Password      = userBO.Password;
            userDB.CreatedBy     = userBO.CreatedBy;
            userDB.CreatedDate   = userBO.CreatedDate;
            userDB.UpdatedBy     = userBO.UpdatedBy;
            userDB.UpdatedDate   = userBO.UpdatedDate;
            userDB.IsDeleted     = userBO.IsDeleted;
            userDB.ImageUrl      = userBO.ImageUrl;
            userDB.ContactNumber = userBO.ContactNumber;
            if (userDB.ID > 0)
            {
                //UPDATE
            }
            else
            {
                //  if (_context.Users.Any(o => o.UserName == userBO.UserName && o.IsDeleted.Value == false))   return new BO.ErrorObject { ErrorMessage = "User already exists.", errorObject = "", ErrorLevel = BO.ErrorLevel.Information };
                userDB.CreatedDate = DateTime.UtcNow;

                _context.Users.Add(userDB);
            }
            _context.SaveChanges();

            #region Insert UserPasswordActivations

            activationDB.PasswordActivattionKey = Guid.NewGuid();
            activationDB.DateCreated            = userDB.CreatedDate;
            activationDB.UserID     = userDB.ID;
            activationDB.IsExpired  = false;
            activationDB.ExpiryDate = System.DateTime.Now.AddDays(1);
            _context.UserPasswordActivations.Add(activationDB);
            _context.SaveChanges();
            #endregion

            #region mail notification
            try
            {
                string VerificationLink = "<a href='" + Utility.GetConfigValue("VerificationLink") + "/" + activationDB.PasswordActivattionKey + "' target='_blank'>" + Utility.GetConfigValue("VerificationLink") + "/" + activationDB.PasswordActivattionKey + "</a>";

                string MailMessageForCompany = "Dear " + userDB.FirstName + ",<br><br>You have been registered in Our Portal. <br><br> Please confirm your account by clicking below link in order to use.<br><br><b>" + VerificationLink + "</b><br><br>Thanks";
                //  string NotificationForCompany = "You have been registered in midas portal as a Medical Provider. ";
                //  string SmsMessageForCompany = "Dear " + user.FirstName + ",<br><br>You have been registered in midas portal as a Medical provider. <br><br> Please confirm your account by clicking below link in order to use.<br><br><b>" + VerificationLink + "</b><br><br>Thanks";

                // NotificationHelper nh = new NotificationHelper();
                MessagingHelper mh = new MessagingHelper();

                #region  company mail object
                EmailMessage emCompany = new EmailMessage();
                emCompany.ApplicationName = "Civil Works";
                emCompany.ToEmail         = userDB.UserName;
                emCompany.EMailSubject    = "Civil Works Notification";
                emCompany.EMailBody       = MailMessageForCompany;
                #endregion

                //  mh.SendEmailAndSms(user_.UserName, 1,emCompany);

                mh.SendMail(userDB.UserName, emCompany.EMailSubject, MailMessageForCompany);
            }
            catch (Exception ex)
            {
            }
            #endregion
            return((object)userDB);
        }