public MessageService(IPushNotificationProvider pushNotificationProvider) { PushNotification = pushNotificationProvider; UnitOfWork = new CoreUnitOfWork(); MessageBiz = new MessageBiz(UnitOfWork); NotificationBiz = new NotificationBiz(UnitOfWork); }
public NotificationService() { UnitOfWork = new CoreUnitOfWork(); NotificationBiz = new NotificationBiz(UnitOfWork); UserBiz = new UserBiz(UnitOfWork); ContentBiz = new ContentBiz(UnitOfWork); }
public NotificationController(PhoenixContext _context, IMapper _mapper) { this.context = _context; this.mapper = _mapper; NB = new NotificationBiz(context); UB = new UserBiz(context); }
public CommentService(IPushNotificationProvider pushNotificationProvider) { UnitOfWork = new CoreUnitOfWork(); CommentBiz = new CommentBiz(UnitOfWork); NotificationBiz = new NotificationBiz(UnitOfWork); ContentBiz = new ContentBiz(UnitOfWork); PushNotification = pushNotificationProvider; }
public void SetNotificationAsRead(UserIdentity user, int notificationId) { var notification = NotificationBiz.ReadSingle(n => n.Id == notificationId); if (notification.ReceiverId != user.UserId) { throw new BusinessException(); } notification.IsRead = true; UnitOfWork.SaveChanges(); }
private void ShowNotificationList() { try { NotificationBiz biz = new NotificationBiz(); rptNotification.DataSource = biz.GetNotificationList(HttpContext.Current.User.Identity.Name); rptNotification.DataBind(); } catch { throw; } }
private int SendRequestToSave() { try { _objUser = new UserDetail(); int result = 0; _objUser.Email = txtEmail.Text.Trim(); _objUser.MobileNo = txtMobileNo.Text.Trim(); _objUser.FirstName = txtFirstName.Text.Trim(); _objUser.LastName = txtLastName.Text.Trim(); _objUser.Password = CommonBiz.GetSwcSH1(txtPassword.Text.Trim()); //Password encrypted by SHA1 algorithm _objUser.RoleTypeID = Convert.ToChar(ddlAccountType.SelectedValue); _objUser.Status = false; result = _objUserBiz.Save(_objUser); if (result == 1 && (!string.IsNullOrEmpty(_objUser.Email) || !string.IsNullOrWhiteSpace(_objUser.Email))) { _objMessages = new NotificationMessages(); _objMessages.ClassificationID = 1; _objMessages.NotificationTypeID = 1; string path = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/" + "UserActivationByEmail.aspx?email=" + _objUser.Email;//Request.Url.GetLeftPart(UriPartial.Authority); _objNotificationBiz = new NotificationBiz(); string body = "Hello " + _objUser.FirstName + ","; body += "<br /><br />Please click the following link to activate your account"; body += "<br /> <a href='" + path + "' >Click here to activate your account. </a> <br /><br />Thanks"; _objNotificationBiz.SendEmail(_objMessages, _objUser.Email, body); succesMessage = "Signup Successful"; } else if (result == 2) { succesMessage = "User already Exists!"; } else { succesMessage = "Registration Failed"; } return(result); } catch (Exception exception) { MessageBox(exception.Message); return(0); } }
protected void lbNoticeTitle_Click(object sender, EventArgs e) { try { int index = int.Parse(((LinkButton)sender).CommandArgument); Label lblTicketId = (Label)rptNotification.Items[index].FindControl("lblTicketId"); Label lblNotificationId = (Label)rptNotification.Items[index].FindControl("lblNotificationId"); NotificationBiz biz = new NotificationBiz(); biz.UpdateStatus(decimal.Parse(lblNotificationId.Text.Trim()), "R"); Response.Redirect("~/SLM_SCR_004.aspx?ticketid=" + lblTicketId.Text.Trim(), false); } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; AppUtil.ClientAlert(Page, message); } }
protected void btnAccept_Click(object sender, EventArgs e) { objUserDetail = (UserDetail)SessionUtility.SessionUtility.AmsSessionContainer.OBJ_USER_CLASS; _objVisitRequest = (VisitRequest)ViewState["objVisitRequest"]; _objVisitRequestBiz = new VisitRequestBiz(); int result = 0; if (chkToViewMessageBox.Checked && !string.IsNullOrEmpty(txtMessageToClient.Text.Trim())) { messageToClient = txtMessageToClient.Text.Trim(); } else { messageToClient = "Dear MR. " + _objVisitRequest.ClientName + ", <br/>Thanks for your interest. You are welcome to visit as your request.<br/> Thanks,<br/>" + objUserDetail.FullName; } _objVisitRequest.MessageToClient = messageToClient; _objVisitRequest.IsAccepted = Request.QueryString["isAccept"] == "1" ? true : false; _objVisitRequest.ResponseDate = DateTime.Today; result = _objVisitRequestBiz.UpdateResposeOnVisitRequest(_objVisitRequest); if (result > 0) { _objMessages = new NotificationMessages(); _objMessages.ClassificationID = 5; _objMessages.NotificationTypeID = 1; //Request.Url.GetLeftPart(UriPartial.Authority); _objNotificationBiz = new NotificationBiz(); string body = messageToClient; _objNotificationBiz.SendEmail(_objMessages, _objVisitRequest.ClientEmail, body); ltrlEmailSmsNotificationA.Text = "<span style=\"color: green; font - size: 10pt \">Operation Successful</span>"; } else { ltrlEmailSmsNotificationA.Text = "<span style=\"color: Red; font - size: 10pt \">Operation Failed</span>"; } }
public void AddComment(CommentRegistrationPM commentRegistrationPM, UserIdentity userIdentity) { Notification notification = null; var comment = commentRegistrationPM.GetComment(); var contentAuthorId = ContentBiz.Read(c => c.Id == comment.ContentId).Select(c => c.AuthorId).Single(); comment.SenderId = userIdentity.UserId; CommentBiz.AddComment(comment); if (userIdentity.UserId != contentAuthorId) { notification = NotificationBiz.Add(NotificationType.WriteComment, userIdentity.UserId, comment.ContentId, contentAuthorId); } UnitOfWork.SaveChanges(); commentRegistrationPM.Id = comment.Id; commentRegistrationPM.CreateDate = comment.CreateDate; if (notification != null) { PushNotification.Send(contentAuthorId, PushNotificationType.NewNotification, NotificationBiz.ProcessNotification(notification).GetNotificationPM()); } }
private void ShowNumberOfNewNotification() { try { NotificationBiz nb = new NotificationBiz(); var nn = nb.GetNewNotification(HttpContext.Current.User.Identity.Name); if (nn != 0) { lblNotification.Text = " " + nn.ToString("#,##0") + " "; lblNotification.Visible = true; } else { lblNotification.Visible = false; } } catch { throw; } }
protected void btnRetiriveLoginInfo_Click(object sender, EventArgs e) { // Page.Validate(); try { _objUserDtl = GetLoginDetail(); if (_objUserDtl == null || _objUserDtl.RoleTypeID.ToString() == string.Empty) { panelLoginErrorMessage.Visible = true; return; } else { _objMessages = new NotificationMessages(); _objMessages.ClassificationID = 1; _objMessages.NotificationTypeID = 1; string path = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/" + "ResetPassword.aspx?email=" + _objUserDtl.Email;//Request.Url.GetLeftPart(UriPartial.Authority); _objNotificationBiz = new NotificationBiz(); string body = "Hello " + _objUserDtl.FirstName + ","; body += "<br /><br />Please goto the following link to reset your password."; body += "<br /> <a href='" + path + "' >Click here to reset your password. </a> <br /><br />If you have any problems or concerns, please contact customer support.</br></br>Thanks"; _objNotificationBiz.SendEmail(_objMessages, _objUserDtl.Email, body); HtmlMeta meta = new HtmlMeta(); meta.HttpEquiv = "Refresh"; meta.Content = "4;url=Signin.aspx"; this.Page.Controls.Add(meta); panelLoginErrorMessage.Visible = false; panelEmailSmsSuccessNotification.Visible = true; } } catch (Exception ex) { MessageBox(ex.Message); } }
protected void btnSendVisitReq_Click(object sender, EventArgs e) { string landloardEmail; int result = 0, VisitReqId; bool isAlreadyRequestedForVisit; _objVisitRequestBiz = new VisitRequestBiz(); if (Request.QueryString["lId"] != null && Request.QueryString["apId"] != null && Request.QueryString["ppId"] != null) { _objVisitRequest = new VisitRequest(); landloardEmail = GetLandloardEmail(Request.QueryString["lId"]); _objVisitRequest.PropertyId = Convert.ToInt32(Request.QueryString["ppId"]); _objVisitRequest.LandlordId = Request.QueryString["lId"].Trim(); _objVisitRequest.ApartmentId = Convert.ToInt32(Request.QueryString["apId"]); _objVisitRequest.ClientEmail = txtClientEmail.Text.Trim(); _objVisitRequest.ClientMobileNo = txtClientMobileNo.Text.Trim(); _objVisitRequest.ClientName = txtClientName.Text.Trim(); _objVisitRequest.MessageToLandlord = txtVisitReqMessage.Text.Trim(); _objVisitRequest.RequestDate = DateTime.Today; isAlreadyRequestedForVisit = _objVisitRequestBiz.GetIsAlreadyRequestedForVisit(_objVisitRequest); if (!isAlreadyRequestedForVisit) { result = _objVisitRequestBiz.SaveVisitRequest(_objVisitRequest, out VisitReqId); if (result > 0) { string PropertyName, apartmentNo; PropertyName = CommonBiz.GetSingleString("ams.Properties", "PropertyName", "PropertyId=" + _objVisitRequest.PropertyId); apartmentNo = CommonBiz.GetSingleString("ams.Apartment", "ApartmentNoOrName", "PropertyId=" + _objVisitRequest.PropertyId + " and ApartmentId=" + _objVisitRequest.ApartmentId); _objMessages = new NotificationMessages(); _objMessages.ClassificationID = 4; _objMessages.NotificationTypeID = 1; string path = Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/" + "UserUI/ResponseVisitRequest.aspx"; //Request.Url.GetLeftPart(UriPartial.Authority); _objNotificationBiz = new NotificationBiz(); objUser = (UserDetail)ViewState["UserDetailVwState"]; string body = "Hello <br/> " + objUser.FullName + ","; body += "<br /><br /> " + _objVisitRequest.ClientName + " wants to visit your apartment " + apartmentNo + " of " + PropertyName + "<br/>"; body += "<span style=\"font-size: 11pt;font-weight: bold\">Messege from Client:</span><br/>" + _objVisitRequest.MessageToLandlord + "<br/>"; body += "<br /> If you want to accept this visit Request please click <a href='" + path + "?isAccept=1&lId=" + _objVisitRequest.LandlordId + "&ReqId=" + VisitReqId + "' > accept </a> <br /><br /> Or To deny click <a href='" + path + "?isAccept=0&lId=" + _objVisitRequest.LandlordId + "&ReqId=" + VisitReqId + "'> deny </a> <br /><br />"; _objNotificationBiz.SendEmail(_objMessages, landloardEmail, body); ltrlEmailSmsNotification.Text = "<span style=\"color: green; font - size: 10pt \">Request Successful</span>"; } else { ltrlEmailSmsNotification.Text = "<span style=\"color: Red; font - size: 10pt \">Request Failed</span>"; } } else { ltrlEmailSmsNotification.Text = "<span style=\"color: Red; font - size: 10pt \">You have already a pending Request. Thanks..</span>"; } } else { MessageBox("Request Failed!"); } }
public IEnumerable <NotificationPM> ReadUserNotifications(int userId, int maxCount) { return(NotificationBiz.ReadUserNotifications(userId, maxCount) .ToList() .Select(notification => NotificationBiz.ProcessNotification(notification).GetNotificationPM())); }