Exemplo n.º 1
0
        public ActionResult ReplyToMessage(string listingDetailsID, string toUserId, string message, string CommentID = null)
        {
            var brokerListings        = new BrokerListings();
            var serialization         = new Serialization();
            var sharedFunctions       = new SharedFunctions();
            var emailNotifications    = new EmailNotifications();
            var outgoingEmailLogModel = new OutgoingEmailLogModel();
            var HashCriteria          = new Hashtable();
            var actualCriteria        = string.Empty;
            var CommentSubject        = " You got reply ";

            HashCriteria.Add("ID", listingDetailsID);
            HashCriteria.Add("ToUserID", toUserId);
            HashCriteria.Add("Message", message);
            HashCriteria.Add("UserID", userID);
            HashCriteria.Add("ReplyToComment", CommentID);
            HashCriteria.Add("CommentSubject", CommentSubject);
            HashCriteria.Add("IsContactToBroker", true);
            actualCriteria = serialization.SerializeBinary((object)HashCriteria);
            var result    = Convert.ToString(brokerListings.ReplyToMessage(actualCriteria));
            var commentID = Convert.ToInt64(serialization.DeSerializeBinary(Convert.ToString(result)));

            HashCriteria   = new Hashtable();
            actualCriteria = string.Empty;
            HashCriteria.Add("ID", commentID);
            actualCriteria = Convert.ToString(serialization.SerializeBinary((object)HashCriteria));
            var resultEmail = Convert.ToString(emailNotifications.GetNotificationDetails(actualCriteria));

            outgoingEmailLogModel = (OutgoingEmailLogModel)(serialization.DeSerializeBinary(Convert.ToString(resultEmail)));
            outgoingEmailLogModel.ExternalEmail = System.Configuration.ConfigurationManager.AppSettings["ExternalEmail"];
            var response = sharedFunctions.SendEmail(outgoingEmailLogModel.EmailTo, Convert.ToString(EmailTemplates.MessageCenter), "Synoptek : " + outgoingEmailLogModel.MessageSender + " sent you message on - " + outgoingEmailLogModel.DealName, null, outgoingEmailLogModel);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public static void MailSend(Int32 mailId, String emailTo, String replaceThis, String replaceWithThat)
        {
            var message = new MailMessage
            {
                From = new MailAddress(MainEmail, NotOfficialName)
            };

            message.ReplyToList.Add(new MailAddress(MainEmail, NotOfficialName));
            message.To.Add(new MailAddress(emailTo));
            var mail = new EmailNotifications()
            {
                ID = mailId
            };

            mail.GetById();
            if (!String.IsNullOrEmpty(replaceThis) && !String.IsNullOrEmpty(replaceWithThat))
            {
                message.Subject = mail.Title.Replace(replaceThis, replaceWithThat);
                message.Body    = mail.Description.Replace(replaceThis, replaceWithThat);
            }
            else
            {
                message.Subject = "[" + BackendHelper.TagToValue("server_name") + "] " + mail.Title;
                message.Body    = mail.Description;
            }

            client.Send(message);
        }
Exemplo n.º 3
0
        public void TestSendingEmailWithAttachment()
        {
            string testpath = $"{Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@".\PushNotificationTestResults\test-out-{System.DateTime.Now.ToString("yyyyMMddHHmmss")}")}";

            string sender  = "*****@*****.**";
            string subject = "Amazon SES Test WITH ATTACHMENT";
            string body    = "AmazonSES Test (.NET) with Attachment\r\nThis email and its attachment were sent through AmazonSES using the AWS SDK for .NET.";

            // If you want to actually get emails while testing, change the email address below to whatever one you want to receive at.
            // This was already done earlier.
            User fakeUser = new User("Test", "User", "*****@*****.**", NotificationTypeEnum.ALL);

            // Gather dummy data
            RFData junkdata = new RFData();

            junkdata.Id             = 0;
            junkdata.appointment_id = 0;
            junkdata.TimeCaptured   = System.DateTime.Now;
            junkdata.Intensity      = 8675309;

            List <RFData> JunkRFData = new List <RFData>();

            JunkRFData.Add(junkdata);

            DataToCSV.ExportToCSV(JunkRFData, testpath);

            // Execute task
            Task <bool> task = EmailNotifications.sendToUser(fakeUser, subject, body, sender, $"{testpath}.csv", true);

            // Wait for main task to finish before assertion
            task.Wait();

            Assert.IsTrue(task.Result);
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = PagesTitles.ManagerEmailNotificationEdit + BackendHelper.TagToValue("page_title_part");
            OtherMethods.ActiveRightMenuStyleChanche("hlEmailNotifications", this.Page);
            OtherMethods.ActiveRightMenuStyleChanche("hlContent", this.Page);

            #region Блок доступа к странице
            var userInSession = (Users)Session["userinsession"];
            var rolesList     = Application["RolesList"] as List <Roles>;
            var currentRole   = (Roles)rolesList.SingleOrDefault(u => u.Name.ToLower() == userInSession.Role.ToLower());
            if (currentRole.PageEmailNotificationsEdit != 1)
            {
                Response.Redirect("~/Error.aspx?id=1");
            }
            #endregion

            if (Page.Request.Params["id"] != null)
            {
                var mail = new EmailNotifications {
                    ID = Convert.ToInt32(Page.Request.Params["id"])
                };
                mail.GetById();
                if (!IsPostBack)
                {
                    if (string.IsNullOrEmpty(mail.Title))
                    {
                        tbTitle.Visible  = false;
                        lblTitle.Visible = false;
                    }
                    tbTitle.Text            = mail.Title;
                    tbBody.Text             = mail.Body;
                    lblDescriptionMore.Text = mail.Description;
                }
            }
        }
Exemplo n.º 5
0
        public string sendNotification_RejectStandby(List <TravelRequestMasterModels> sodRequestsList, List <FlightDetailModels> sodflightList, List <PassengerDetailModels> passengerList, List <PassengerMealAllocationModels> passengerMealsList, List <TravelRequestHotelDetailModels> hotelDetailList, string s, string pnrc)
        {
            var bookingType = sodRequestsList[0].SodBookingTypeId == 1 ? "SOD" : "NON-SOD";

            if (sodRequestsList[0].IsAmountPaidByTraveller.Equals(true))
            {
                var strHoldPNR = string.Empty;
                //Get PNR Booking Time
                var pnrInfo           = _userRepository.GetPNRAmountAndTime(sodRequestsList[0].TravelRequestId);
                var holdAmount        = float.Parse(pnrInfo.Split('|')[1]);
                var holdAmounts       = string.Format("{0:0.00}", holdAmount).ToString();
                var pnrGenerationTime = Convert.ToDateTime(pnrInfo.Split('|')[2]);

                //Get Hold Time
                var holdDateTime = CommonWebMethod.CommonWebMethods.GetHoldBookingDateTime(sodRequestsList[0].SodBookingTypeId, sodRequestsList[0].BookingFor, sodflightList[0].TravelDate, sodflightList[0].DepartureTime, pnrGenerationTime);
                var HoldTime     = holdDateTime.ToString("t");
                var HoldDate     = holdDateTime.ToString("dd/MMM/yyyy");
                var strholdDT    = HoldTime + " dated " + HoldDate;
                strHoldPNR = strHoldPNR.Replace("[holdDT]", strholdDT);
                strHoldPNR = strHoldPNR.Replace("[pnrAmt]", holdAmounts);
                pnrc       = pnrc + "." + strHoldPNR;
            }
            var emailSubject      = bookingType + " " + "Standby Booking PNR Request Notification :" + System.DateTime.Now.ToString();
            var emailTemplateName = "SodBookingRequestNotificationTemplateFor_HOD_Booking.html";
            var emailCredentials  = EmailCredentials(emailSubject, emailTemplateName, sodRequestsList, sodflightList, passengerList, passengerMealsList, hotelDetailList, s, pnrc);

            emailCredentials.TemplateFilePath = emailCredentials.TemplateFilePath.Replace("[PNR]", pnrc);
            EmailNotifications.SendBookingRequestNotificationTo_Requester(emailCredentials, sodRequestsList[0].EmailId);
            return("sucess");
        }
Exemplo n.º 6
0
        public void btnBlock_Click(Object sender, EventArgs e)
        {
            var id            = Page.Request.Params["id"];
            var userInSession = (Users)Session["userinsession"];
            var user          = new Users
            {
                ID     = Convert.ToInt32(id),
                Status = 3
            };

            user.Update(userInSession.ID, OtherMethods.GetIPAddress(), "ClientEdit");
            user.GetById();
            var emailNotification = new EmailNotifications {
                Name = "account_blocked"
            };

            emailNotification.GetByName();
            EmailMethods.MailSendHTML(
                emailNotification.Title,
                string.Format(emailNotification.Body,
                              BackendHelper.TagToValue("current_app_address"),
                              BackendHelper.TagToValue("not_official_name"),
                              BackendHelper.TagToValue("main_phones")),
                user.Email,
                true);
            Page.Response.Redirect(Request.RawUrl);
        }
Exemplo n.º 7
0
        public void btnActivate_Click(Object sender, EventArgs e)
        {
            var id      = Page.Request.Params["id"];
            var regUser = new Users {
                ID = Convert.ToInt32(id)
            };
            var userInSession = (Users)Session["userinsession"];
            //var newPassword = OtherMethods.CreateUniqId(DateTime.Now.ToString("yyMdHms"));
            var user = new Users
            {
                ID            = Convert.ToInt32(id),
                Status        = 2,
                ActivatedDate = DateTime.Now,
                Password      = regUser.Password
            };

            user.Update(userInSession.ID, OtherMethods.GetIPAddress(), "ClientEdit");
            user.GetById();
            var emailNotification = new EmailNotifications {
                Name = "account_activated"
            };

            emailNotification.GetByName();
            EmailMethods.MailSendHTML(
                emailNotification.Title,
                string.Format(emailNotification.Body,
                              user.Login,
                              regUser.Password,
                              BackendHelper.TagToValue("official_name"),
                              BackendHelper.TagToValue("current_app_address"),
                              BackendHelper.TagToValue("not_official_name")),
                user.Email, true);
            Page.Response.Redirect(Request.RawUrl);
        }
Exemplo n.º 8
0
        public async Task SaveEmailNotificationChangesAsync(string currentUserId,
                                                            bool sendGiftNotifications,
                                                            bool sendMessageNotifications,
                                                            bool sendNewFollowerNotifications,
                                                            bool sendTagNotifications,
                                                            bool sendReviewNotifications)
        {
            Debug.Assert(!String.IsNullOrEmpty(currentUserId));

            EmailNotifications emailNotifications = await db.EmailNotifications.FindAsync(currentUserId);

            if (emailNotifications == null)
            {
                emailNotifications = new EmailNotifications();
                emailNotifications.ApplicationUserId            = currentUserId;
                emailNotifications.SendGiftNotifications        = sendGiftNotifications;
                emailNotifications.SendMessageNotifications     = sendMessageNotifications;
                emailNotifications.SendNewFollowerNotifications = sendNewFollowerNotifications;
                emailNotifications.SendTagNotifications         = sendTagNotifications;
                emailNotifications.SendReviewNotifications      = sendReviewNotifications;
                db.EmailNotifications.Add(emailNotifications);
            }
            else
            {
                emailNotifications.SendGiftNotifications        = sendGiftNotifications;
                emailNotifications.SendMessageNotifications     = sendMessageNotifications;
                emailNotifications.SendNewFollowerNotifications = sendNewFollowerNotifications;
                emailNotifications.SendTagNotifications         = sendTagNotifications;
                emailNotifications.SendReviewNotifications      = sendReviewNotifications;
            }

            await db.SaveChangesAsync();
        }
Exemplo n.º 9
0
        private void AutomaticSnowDumpInterval(Object source, ElapsedEventArgs e)
        {
            double      DELTA = 0.01;
            Orientation currentOrientation = GetCurrentOrientation();

            // Check if we need to dump the snow off of the telescope
            if (RadioTelescope.WeatherStation.GetOutsideTemp() <= 30.00 && RadioTelescope.WeatherStation.GetTotalRain() > 0.00)
            {
                // We want to check stow position precision with a 0.01 degree margin of error
                if (Math.Abs(currentOrientation.Azimuth - MiscellaneousConstants.Stow.Azimuth) <= DELTA && Math.Abs(currentOrientation.Elevation - MiscellaneousConstants.Stow.Elevation) <= DELTA)
                {
                    Console.WriteLine("Time threshold reached. Running snow dump...");

                    MovementResult result = SnowDump(MovementPriority.Appointment);

                    if (result != MovementResult.Success)
                    {
                        logger.Info($"{Utilities.GetTimeStamp()}: Automatic snow dump FAILED with error message: {result.ToString()}");
                        pushNotification.sendToAllAdmins("Snow Dump Failed", $"Automatic snow dump FAILED with error message: {result.ToString()}");
                        EmailNotifications.sendToAllAdmins("Snow Dump Failed", $"Automatic snow dump FAILED with error message: {result.ToString()}");
                    }
                    else
                    {
                        Console.WriteLine("Snow dump completed");
                    }
                }
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// This will set the overrides based on input. Takes in the sensor that it will be changing,
        /// and then the status, true or false.
        /// true = overriding
        /// false = enabled
        /// </summary>
        /// <param name="sensor"></param>
        /// <param name="set"></param>
        public void setOverride(String sensor, bool set)
        {
            if (sensor.Equals("azimuth motor temperature"))
            {
                overrides.setAzimuthMotTemp(set);
            }
            else if (sensor.Equals("elevation motor temperature"))
            {
                overrides.setElevationMotTemp(set);
            }
            else if (sensor.Equals("main gate"))
            {
                overrides.setGatesOverride(set);
            }
            else if (sensor.Equals("elevation proximity (1)"))
            {
                overrides.setElProx0Override(set);
            }
            else if (sensor.Equals("elevation proximity (2)"))
            {
                overrides.setElProx90Override(set);
            }
            else if (sensor.Equals("azimuth absolute encoder"))
            {
                overrides.setAzimuthAbsEncoder(set);
            }
            else if (sensor.Equals("elevation absolute encoder"))
            {
                overrides.setElevationAbsEncoder(set);
            }
            else if (sensor.Equals("azimuth motor accelerometer"))
            {
                overrides.setAzimuthAccelerometer(set);
            }
            else if (sensor.Equals("elevation motor accelerometer"))
            {
                overrides.setElevationAccelerometer(set);
            }
            else if (sensor.Equals("counterbalance accelerometer"))
            {
                overrides.setCounterbalanceAccelerometer(set);
            }


            if (set)
            {
                logger.Info(Utilities.GetTimeStamp() + ": Overriding " + sensor + " sensor.");

                pushNotification.sendToAllAdmins("SENSOR OVERRIDES", "Overriding " + sensor + " sensor.");
                EmailNotifications.sendToAllAdmins("SENSOR OVERRIDES", "Overriding " + sensor + " sensor.");
            }
            else
            {
                logger.Info(Utilities.GetTimeStamp() + ": Enabled " + sensor + " sensor.");

                pushNotification.sendToAllAdmins("SENSOR OVERRIDES", "Enabled " + sensor + " sensor.");
                EmailNotifications.sendToAllAdmins("SENSOR OVERRIDES", "Enabled " + sensor + " sensor.");
            }
        }
Exemplo n.º 11
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            _logger.Info("User submitted registration Form! Params: " + model.ToJson());

            if (ModelState.IsValid)
            {
                try
                {
                    var user = new ClientUsers {
                        UserName = model.UserName.Trim(' '), Email = model.Email
                    };
                    var result = await UserManager.CreateAsync(user, model.Password);

                    if (result.Succeeded)
                    {
                        _logger.Info("User registered Successfully!");

                        //Send notification to office mail
                        await EmailNotifications.RegiteredUserNotification(user.UserName, user.Email, user.PhoneNumber);

                        //Subscribe him if checked
                        if (model.IsSubscribed)
                        {
                            await MailListManager.Subscribe(model.Email);
                        }

                        var currentUser = await UserManager.FindByNameAsync(user.UserName);

                        await UserManager.AddToRoleAsync(currentUser.Id, "Client");

                        // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                        // Send an email with this link
                        string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);

                        if (Request.Url != null)
                        {
                            var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code },
                                                         Request.Url.Scheme);
                            await EmailNotifications.NoReplyMailService.SendHtmlEmailAsync(user.Email,
                                                                                           "Потвърдете акаунтът си в sProperties",
                                                                                           "За да потвърдите регистрацията си натиснете <a href=\"" + callbackUrl + "\">ТУК</a>");
                        }

                        return(RedirectToAction("Login", "Account", new { confirmation = "email" }));
                    }
                    AddErrorsToModelState(result);
                }
                catch (Exception ex)
                {
                    _logger.Error(ex, "Something went wrong during the registration!");
                }
            }

            _logger.Error("User registration form Invalid! Errors: " + ModelState.ToJson());

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Exemplo n.º 12
0
        /// <summary>
        /// Send Email Notification to user :Rejection
        /// </summary>
        /// <returns></returns>
        public string sendRejectionNotification()
        {
            var jmsg = string.Empty;

            if (TempData["emailData"] != null && TempData["emailId"] != null)
            {
                var emaildata = TempData["emailData"] as EmailNotificationModel;
                var emailid   = TempData["emailId"].ToString();
                EmailNotifications.SendBookingRequestNotificationTo_Requester(emaildata, emailid);
                jmsg = "Rejected";
            }
            return(jmsg);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Send Email To User
        /// </summary>
        /// <param name="list"></param>
        /// <param name="reqName"></param>
        /// <param name="reqEmailId"></param>
        /// <param name="hodName"></param>
        /// <param name="appStatus"></param>
        private void SendEmailToUser(List <VendorModels> list, string reqName, string reqEmailId, string hodName, string appStatus)
        {
            var subject = "NON SOD Vendor Booking Response Notification  :" + System.DateTime.Now.ToString("dd/MMM/yyyy hh:mm:ss tt");
            var VendorResponseTemplateName = "VendorResponseEmailTemplate.html";
            var emailCredentials           = EmailCredentials(subject, VendorResponseTemplateName, list);
            var requesttemplateData        = emailCredentials.TemplateFilePath;

            requesttemplateData = requesttemplateData.Replace("[RequesterName]", reqName);
            requesttemplateData = requesttemplateData.Replace("[hodname]", hodName);
            requesttemplateData = requesttemplateData.Replace("[AppStatus]", appStatus);
            emailCredentials.TemplateFilePath = requesttemplateData;
            EmailNotifications.SendBookingRequestNotificationTo_Requester(emailCredentials, reqEmailId);
        }
Exemplo n.º 14
0
        public void TestSendingEmailToAllAdmins()
        {
            string sender  = "*****@*****.**";
            string subject = "Amazon SES Test";
            string body    = "AmazonSES Test (.NET)\r\nThis email was sent through AmazonSES using the AWS SDK for .NET.";

            // Execute task
            Task <bool> task = EmailNotifications.sendToAllAdmins(subject, body, sender, true);

            // Wait for main task to finish before assertion
            task.Wait();

            Assert.IsTrue(task.Result);
        }
Exemplo n.º 15
0
 public int SaveEmailNotifications(EmailNotifications notification)
 {
     try
     {
         notification.RecordDate = DateTime.UtcNow;
         EmailNotifications.Add(notification);
         this.SaveChanges();
         return(notification.EmailNotificationID);
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 16
0
        public bool SendEmail(string emailTo, string emailTemplate, string emailSubject, object model = null, OutgoingEmailLogModel outgoingEmailLogModel = null)
        {
            var emailNotificationBA     = new EmailNotifications();
            var emailNotificationsModel = GetEmailNotificationsModel();

            if (outgoingEmailLogModel == null)
            {
                outgoingEmailLogModel = new OutgoingEmailLogModel();
            }
            outgoingEmailLogModel.EmailSubject = emailSubject;
            outgoingEmailLogModel.DomainName   = Convert.ToString(ConfigurationManager.AppSettings["DomainName"]);
            SendEmailNotification(emailTo, emailTemplate, model, emailNotificationsModel, outgoingEmailLogModel);
            return(true);
        }
Exemplo n.º 17
0
        public void bntCreate_Click(Object sender, EventArgs e)
        {
            var id   = Page.Request.Params["id"];
            var mail = new EmailNotifications {
                Title = tbTitle.Text, Body = tbBody.Text
            };

            if (id != null)
            {
                mail.ID = Convert.ToInt32(id);
                mail.Update();
            }
            Page.Response.Redirect("~/ManagerUI/Menu/Content/EmailNotificationsView.aspx");
        }
Exemplo n.º 18
0
        public JsonResult sendmailtoHOD(List <ITHResponseDetailModels> ithlist)
        {
            var dicList = new Dictionary <string, object>();
            var plist   = new List <OALPassengerModel>();
            var mlist   = new List <OALTravelRequestMasterModel>();

            dicList = _oalRepository.GetOATDetailsData("OAT-" + ithlist[0].TravelRequestId.ToString());
            plist   = dicList["pasgList"] as List <OALPassengerModel>;
            mlist   = dicList["masterList"] as List <OALTravelRequestMasterModel>;

            string hodEmailId = SOD.Services.ADO.SodCommonServices.GetHodEmailDetails(mlist[0].RequestedEmpId.ToString().Trim(), 2);
            var    status     = _oalRepository.saveHODStatus(ithlist[0].TravelRequestId, "Pending");

            if (status > 0)
            {
                //send mail to hod- pasg details, ith details with radio button
                var emailSubject      = "OAT Request Notification from Travel Desk:" + System.DateTime.Now.ToString("dd-MMM-yyyy hh:mm:ss tt");
                var emailTemplateName = "OatRequestNotificationTemplateHodApproval_ITH.html";
                var emailCredentials  = EmailCredentialsHODApproval(emailSubject, emailTemplateName, ithlist, plist);

                var skey = new StringBuilder();
                skey.Append(mlist[0].TravelRequestId.ToString() + ",");
                skey.Append(hodEmailId);

                var uri1 = "";
                var uri2 = "";

                uri1 = ConfigurationManager.AppSettings["emailApprovalPathHod_ITH"].Trim() + "?str=" + skey + "&type=a&trid=" + mlist[0].TravelRequestId;
                //uri2 = ConfigurationManager.AppSettings["emailRejectionPathHod_ITH"].Trim() + "?str=" + skey + "&type=r&trid=" + mlist[0].TravelRequestId;

                var appLink = string.Empty;
                appLink = "<table><tr style='font-family:Arial;'><td style='width:110px; height:25px; background-color:#04B431;text-align:center;border-radius:5px'><a style='color:#fff; text-decoration:none;' href='" + uri1 + "'>Select Option</a></td></tr></table>";
                //appLink = appLink + "<td style='width:110px; height:25px; background-color:#b33;text-align:center;border-radius:5px'><a style='color:#fff; text-decoration:none;' href='" + uri2 + "'>Rejection</a> </td></tr></table>";

                var templateData = emailCredentials.TemplateFilePath;
                var hodName      = hodEmailId.Split(',')[1];

                templateData = templateData.Replace("[appLink]", appLink);
                templateData = templateData.Replace("[hodname]", hodName);

                emailCredentials.TemplateFilePath = templateData;

                TempData["emailData_Hod"] = emailCredentials;
                TempData["emailId_Hod"]   = hodEmailId.Split(',')[0];
                EmailNotifications.SendBookingRequestNotificationTo_Requester(emailCredentials, hodEmailId.Split(',')[0].ToString());

                TempData["msgResponse"] = "OAT Response Notification : Flight details have been sent successfully to Travel desk.";
            }
            return(Json("sent", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 19
0
        public bool SendContactRequestEmail(long commentID, bool IsContactBroker)
        {
            var    serialization            = new Serialization();
            var    sharedFunctions          = new SharedFunctions();
            var    emailNotifications       = new EmailNotifications();
            var    outgoingEmailLogModel    = new OutgoingEmailLogModel();
            var    HashCriteriaNotification = new Hashtable();
            string actualCriteriaNotification;

            HashCriteriaNotification.Add("ID", commentID);
            actualCriteriaNotification = serialization.SerializeBinary((object)HashCriteriaNotification);
            var resultEmail = emailNotifications.GetNotificationDetails(actualCriteriaNotification);

            outgoingEmailLogModel = (OutgoingEmailLogModel)(serialization.DeSerializeBinary(Convert.ToString(resultEmail)));
            outgoingEmailLogModel.ExternalEmail = System.Configuration.ConfigurationManager.AppSettings["ExternalEmail"];
            //For schedule consulations end email to law
            var scheduleConsulationEmail = System.Configuration.ConfigurationManager.AppSettings["ScheduleConsulationEmail"];

            if (IsContactBroker)
            {
                if (outgoingEmailLogModel.DealName == null || outgoingEmailLogModel.DealName == "")
                {
                    sharedFunctions.SendEmail(outgoingEmailLogModel.EmailTo, Convert.ToString(EmailTemplates.ContactBrokerUnlikeListing), "Synoptek : " + outgoingEmailLogModel.MessageSender + " wants to contact you.", null, outgoingEmailLogModel);
                }
                else
                {
                    sharedFunctions.SendEmail(outgoingEmailLogModel.EmailTo, Convert.ToString(EmailTemplates.ContactBroker), "Synoptek : " + outgoingEmailLogModel.MessageSender + " wants to contact you for - " + outgoingEmailLogModel.DealName, null, outgoingEmailLogModel);
                }
            }
            else
            {
                //Added by Jyotibala P. for public user set Emailto is external address specified in web.config
                if (string.IsNullOrWhiteSpace(outgoingEmailLogModel.EmailTo))
                {
                    if (scheduleConsulationEmail != null && scheduleConsulationEmail != "")
                    {
                        outgoingEmailLogModel.EmailTo = scheduleConsulationEmail;
                    }
                    outgoingEmailLogModel.DealName     = "Portal";
                    outgoingEmailLogModel.ReceiverName = "Admin";
                    sharedFunctions.SendEmail(outgoingEmailLogModel.EmailTo, Convert.ToString(EmailTemplates.ScheduleConsultation), "Synoptek : User needs consultation", null, outgoingEmailLogModel);
                }
                else
                {
                    sharedFunctions.SendEmail(outgoingEmailLogModel.EmailTo, Convert.ToString(EmailTemplates.ScheduleConsultation), "Synoptek : " + outgoingEmailLogModel.MessageSender + " needs consultation for - " + outgoingEmailLogModel.DealName, null, outgoingEmailLogModel);
                }
            }
            return(true);
        }
Exemplo n.º 20
0
 /// <summary>
 /// Send Email to User as well as HOD
 /// </summary>
 public void sendEmailNotification()
 {
     if (TempData["emailData"] != null && TempData["emailId"] != null)
     {
         var emaildata = TempData["emailData"] as EmailNotificationModel;
         var emailid   = TempData["emailId"].ToString();
         EmailNotifications.SendBookingRequestNotificationTo_Requester(emaildata, emailid);
     }
     if (TempData["emailData_HR"] != null && TempData["emailId_HR"] != null)
     {
         var emaildataHod = TempData["emailData_HR"] as EmailNotificationModel;
         var emailidHod   = TempData["emailId_HR"].ToString();
         EmailNotifications.SendBookingRequestNotificationTo_HOD(emaildataHod, emailidHod);
     }
 }
Exemplo n.º 21
0
        public void TestSendingEmailToUser()
        {
            string sender   = "*****@*****.**";
            string subject  = "Amazon SES Test";
            string body     = "AmazonSES Test (.NET)\r\nThis email was sent through AmazonSES using the AWS SDK for .NET.";
            User   fakeUser = new User("Test", "User", "*****@*****.**", NotificationTypeEnum.ALL);

            // Execute task
            Task <bool> task = EmailNotifications.sendToUser(fakeUser, subject, body, sender, null, true);

            // Wait for main task to finish before assertion
            task.Wait();

            Assert.IsTrue(task.Result);
        }
        protected void ListViewDataBind()
        {
            var mail = new EmailNotifications();

            lvAllEmailNotifications.DataSource = mail.GetAllItems();
            lvAllEmailNotifications.DataBind();

            #region  едирект на первую страницу при поиске
            if (lvAllEmailNotifications.Items.Count == 0 && lvDataPager.TotalRowCount != 0)
            {
                lvDataPager.SetPageProperties(0, lvDataPager.PageSize, false);
                lvAllEmailNotifications.DataBind();
            }
            #endregion
        }
Exemplo n.º 23
0
        public async Task <ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl)
        {
            if (User.Identity.IsAuthenticated)
            {
                _logger.Info("User is authenticated and will be redirected to Manage/Index");
                return(RedirectToAction("Index", "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 ClientUsers {
                    UserName = model.UserName, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    _logger.Info("User registered successfully with external login!");
                    //Send notification to office mail
                    await EmailNotifications.RegiteredUserNotification(user.UserName, user.Email, user.PhoneNumber);

                    result = await UserManager.AddLoginAsync(user.Id, info.Login);

                    if (result.Succeeded)
                    {
                        await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                        return(RedirectToLocal(returnUrl));
                    }
                }
                AddErrorsToModelState(result);
            }

            _logger.Error("Problem in external login Form! Errors: " + ModelState.ToJson());

            ViewBag.ReturnUrl = returnUrl;
            return(View(model));
        }
Exemplo n.º 24
0
        public async Task <ActionResult> CreateOwner(OwnerCreateViewModel model)
        {
            _logger.Info("Creating Owner Account! Params: " + model.ToJson());

            if (!ModelState.IsValid)
            {
                _logger.Error("Creating Owner Account Form Invalid! Errors: " + ModelState.ToJson());
                return(Json(ModelState.ToDictionary()));
            }

            var owner = new OwnerUsers
            {
                UserName             = model.UserName,
                FirstName            = model.FirstName,
                LastName             = model.LastName,
                PhoneNumber          = model.PhoneNumber,
                Email                = model.Email,
                PhoneNumberConfirmed = true,
                BirthDate            = model.BirthDate
            };

            var result = await UserManager.CreateAsync(owner, model.Password);

            if (result.Succeeded)
            {
                _logger.Info("Owner Created Successfully!");
                //Send notification to office mail
                await EmailNotifications.RegiteredUserNotification(owner.UserName, owner.Email, owner.PhoneNumber);

                await UserManager.AddToRoleAsync(owner.Id, "Owner");

                return(Json(new UsersIdInfoViewModel
                {
                    Id = owner.Id,
                    Info = "Име: " + owner.FirstName + " " + (owner.LastName ?? "") + ", Телефон: " + owner.PhoneNumber
                }));
            }
            else
            {
                AddErrorsToModelState(result);
                _logger.Info("Owner Creation Failed! Errors: " + ModelState.ToJson());

                return(Json(ModelState.ToDictionary()));
            }
        }
Exemplo n.º 25
0
 public Api(ApiKeys apiKeys, HttpClient httpClient = null)
 {
     Security            = new Security(apiKeys, httpClient: httpClient);
     findService         = new FindService(apiKeys.AddressLookupKey, httpClient: httpClient);
     autocompleteService = new AutocompleteService(apiKeys.AddressLookupKey, httpClient: httpClient);
     getService          = new GetService(apiKeys.AddressLookupKey, httpClient: httpClient);
     typeaheadService    = new TypeaheadService(apiKeys.AddressLookupKey, httpClient: httpClient);
     EmailNotifications  = new EmailNotifications(apiKeys.AdministrationKey, httpClient: httpClient);
     usageService        = new UsageService(apiKeys.AdministrationKey, httpClient: httpClient);
     distanceService     = new DistanceService(apiKeys.AddressLookupKey, httpClient: httpClient);
     Subscription        = new SubscriptionService(apiKeys.AdministrationKey, httpClient: httpClient);
     Plans          = new PlansService(apiKeys.AdministrationKey, httpClient: httpClient);
     Webhooks       = new Webhooks(apiKeys.AdministrationKey, httpClient: httpClient);
     Account        = new Account(apiKeys.AdministrationKey, httpClient: httpClient);
     Invoice        = new InvoiceService(apiKeys.AdministrationKey, httpClient: httpClient);
     PrivateAddress = new PrivateAddressService(apiKeys.AdministrationKey, httpClient: httpClient);
     DirectDebt     = new DirectDebtService(apiKeys.AdministrationKey, httpClient: httpClient);
 }
Exemplo n.º 26
0
        public async Task <ActionResult> RegisterOwner(RegisterOwnerViewModel model)
        {
            if (ModelState.IsValid)
            {
                //Checking the register code in the db and delete the code if exists
                if (OwnerRegisterCodeManager.CheckOwnerRegisterCode(model.RegisterCode))
                {
                    var owner = new OwnerUsers {
                        UserName = model.UserName.Trim(' '), Email = model.Email
                    };
                    var result = await UserManager.CreateAsync(owner, model.Password);

                    if (result.Succeeded)
                    {
                        //Send notification to office mail
                        await EmailNotifications.RegiteredUserNotification(owner.UserName, owner.Email, owner.PhoneNumber);

                        var currentUser = await UserManager.FindByNameAsync(owner.UserName);

                        await UserManager.AddToRoleAsync(currentUser.Id, "Owner");

                        // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                        // Send an email with this link
                        string code = await UserManager.GenerateEmailConfirmationTokenAsync(owner.Id);

                        if (Request.Url != null)
                        {
                            var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = owner.Id, code }, Request.Url.Scheme);
                            await EmailNotifications.NoReplyMailService.SendHtmlEmailAsync(owner.Email, "Потвърдете акаунтът си в sProperties", "За да потвърдите регистрацията си натиснете <a href=\"" + callbackUrl + "\">ТУК</a>");
                        }

                        return(RedirectToAction("Login", "Account", new { confirm = "email" }));
                    }
                    AddErrorsToModelState(result);
                }
                else
                {
                    ModelState.AddModelError("RegisterCode", "Invalid Register Code");
                    return(View());
                }
            }

            return(View());
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        sec = new SecondaryEntitiesManager();
        de = new DynamicElements();
        serv = new ServicesManager();
        em = new EmailNotifications();
        rtq = new RTQManager();

        if (!IsPostBack)
        {/*
            if (Request.Form["MethodName"] == "GetL")
            {
                getList();
                return;
            }*/

            //generateRooms();
        }
    }
Exemplo n.º 28
0
        public async Task <EmailNotifications> GetEmailNotificationsForUserAsync(string userId)
        {
            var emailNotifications = from emailNotification in db.EmailNotifications
                                     where emailNotification.ApplicationUserId == userId
                                     select emailNotification;

            var result = await emailNotifications.FirstOrDefaultAsync();

            if (result == null)
            {
                result = new EmailNotifications()
                {
                    ApplicationUserId            = userId,
                    SendGiftNotifications        = false,
                    SendMessageNotifications     = false,
                    SendNewFollowerNotifications = false,
                    SendTagNotifications         = false
                };
            }

            return(result);
        }
Exemplo n.º 29
0
        //[System.Web.Http.HttpGet]
        //[Route("api/FileApi/GetListToFinancialApproval")]
        //public IHttpActionResult GetListToFinancialApproval()
        //{
        //    //var controller = DependencyResolver.Current.GetService<trnsController>();
        //    //try
        //    //{
        //    //    var list = _userRepository.GetListTosendTriggerFinancalApproval();
        //    //    foreach (var lst in list)
        //    //    {
        //    //        controller.ResendApproverRequest(lst.TravelRequestId.ToString(), lst.HotelRequestId.ToString(), "SOD");
        //    //    }
        //    //    return Json( "success");
        //    //}
        //    //catch (Exception ex)
        //    //{
        //    //    throw ex;
        //    //}
        //    return Json("success");
        //}



        /// <summary>
        /// Send Email Notification to booking requester/user
        /// </summary>
        /// <returns></returns>
        private void sendEmailNotification(object emailData, string emailId, object emailData_Hod, string emailId_Hod)
        {
            try
            {
                if (emailData != null && emailId != null)
                {
                    var emaildata = emailData as EmailNotificationModel;
                    var emailid   = emailId;
                    EmailNotifications.SendBookingRequestNotificationTo_Requester(emaildata, emailid);
                }

                if (emailData_Hod != null && emailId_Hod != null)
                {
                    var emaildataHod = emailData_Hod as EmailNotificationModel;
                    var emailidHod   = emailId_Hod;
                    EmailNotifications.SendBookingRequestNotificationTo_HOD(emaildataHod, emailidHod);
                }
            }
            catch (Exception ex)
            {
                var json = ex.InnerException;
            }
        }
Exemplo n.º 30
0
        /// <summary>

        /// Send Email Notification to booking requester/user
        /// </summary>
        /// <returns></returns>
        public void sendEmailNotification()
        {
            try
            {
                if (TempData["emailData"] != null && TempData["emailId"] != null)
                {
                    var emaildata = TempData["emailData"] as EmailNotificationModel;
                    var emailid   = TempData["emailId"].ToString();
                    EmailNotifications.SendBookingRequestNotificationTo_Requester(emaildata, emailid);
                }

                if (TempData["emailData_Hod"] != null && TempData["emailId_Hod"] != null)
                {
                    var emaildataHod = TempData["emailData_Hod"] as EmailNotificationModel;
                    var emailidHod   = TempData["emailId_Hod"].ToString();
                    EmailNotifications.SendBookingRequestNotificationTo_HOD(emaildataHod, emailidHod);
                }
            }
            catch (Exception ex)
            {
                TempData["fun3"] = ex.InnerException;
            }
        }
Exemplo n.º 31
0
        public IHttpActionResult Get()
        {
            object emailData  = new object();
            string emailId    = string.Empty;
            var    ListToSend = new List <String>();

            try
            {
                var controller = DependencyResolver.Current.GetService <HotelOnlyController>();
                var res        = _userRepository.GetReminderListTosendApproval(1);
                foreach (var lst in res)
                {
                    var hotelList = new List <TravelRequestHotelDetailModels>();
                    var dicList   = new Dictionary <string, object>();
                    dicList = _userRepository.GetSodHotelInfo(Convert.ToInt64(lst));
                    var    bookingInfo        = dicList["bookingInfolist"] as List <TravelRequestMasterModels>;
                    var    hotel_List         = dicList["hotelinfolist"] as List <TravelRequestHotelDetailModels>;
                    var    flightinfo         = dicList["flightInfolist"] as List <FlightDetailModels>;
                    String hodEmailId         = _userRepository.GetHODEmailIdByTravelReqID(lst.TravelRequestId.ToString());
                    var    emailSubject2      = "SOD-SJSC Hotel Booking Request Notification :" + System.DateTime.Now.ToString();
                    var    emailTemplateName2 = "SodHotelBookingRequestFor_HodHotelApproval.html";

                    var emailCredentials2 = controller.EmailCredentialsHotelHod(emailSubject2, emailTemplateName2, hotel_List, bookingInfo, flightinfo, lst.TravelRequestId.ToString(), hodEmailId);
                    // var emailData_hod = emailCredentials2;


                    var templateData = emailCredentials2.TemplateFilePath;
                    var appLink      = string.Empty;
                    var approvaltype = string.Empty;
                    var emailId_hod  = hodEmailId.Split(',')[0].ToString().Trim();
                    if (hodEmailId.Length > 0)
                    {
                        var skey = new StringBuilder();
                        skey.Append(bookingInfo[0].TravelRequestId.ToString() + ",");
                        skey.Append(bookingInfo[0].EmailId.Trim() + ",");
                        skey.Append(bookingInfo[0].SodBookingTypeId.ToString() + ",");
                        skey.Append(bookingInfo[0].BookingFor.Trim() + ",");
                        skey.Append(hodEmailId.ToString().Trim() + ",");
                        skey.Append(0);

                        var uri1 = ConfigurationManager.AppSettings["emailOnlyHotelApprovalPathHod"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=a");
                        var uri2 = ConfigurationManager.AppSettings["emailOnlyHotelApprovalPathHod"].Trim() + "?str=" + CipherURL.Encrypt(skey + "&type=r");

                        approvaltype = "Please help to accord your Acceptance or Rejection.";
                        appLink      = "<table><tr style='font-family:Arial;'><td style='width:110px; height:25px; background-color:#04B431;text-align:center;border-radius:5px'><a name='app' style='color:#fff; text-decoration:none;' href='" + uri1 + "'>Acceptance</a></td> <td>&nbsp;</td> <td style='width:110px; height:25px; background-color:#b33;text-align:center;border-radius:5px'><a name='rej' style='color:#fff; text-decoration:none;' href='" + uri2 + "'>Rejection</a> </td></tr></table>";

                        templateData = templateData.Replace("[approvaltype]", approvaltype);
                        templateData = templateData.Replace("[appLink]", appLink);
                        templateData = templateData.Replace("[hodName]", hodEmailId.Split(',')[1]);
                        templateData = templateData.Replace("[RequesterName]", bookingInfo[0].Title + " " + bookingInfo[0].RequestedEmpName);
                        emailCredentials2.TemplateFilePath = templateData;

                        //var emaildata2 = emailData_hod as EmailNotificationModel;
                        var emailid2 = emailId_hod.ToString();
                        EmailNotifications.SendBookingRequestNotificationTo_Requester(emailCredentials2, emailid2);
                        //SendBookingRequestNotificationTo_Requester_Traveldesk
                    }
                }
                return(Json("su"));
            }
            catch (Exception ex)
            {
                return(Json(ex.InnerException.Message.ToString()));

                throw ex;
            }
            return(Json("su"));
        }