private void SetValue() { _objVisitRequest = new VisitRequest(); _objVisitRequestBiz = new VisitRequestBiz(); _objVisitRequest = _objVisitRequestBiz.GetVisitRequestDetail(Convert.ToInt32(Request.QueryString["ReqId"]), Request.QueryString["lId"].Trim()); if (_objVisitRequest != null) { PropertyName = CommonBiz.GetSingleString("ams.Properties", "PropertyName", "PropertyId=" + _objVisitRequest.PropertyId); apartmentNo = CommonBiz.GetSingleString("ams.Apartment", "ApartmentNoOrName", "PropertyId=" + _objVisitRequest.PropertyId + " and ApartmentId=" + _objVisitRequest.ApartmentId); lblRequrstedBy.Text = string.IsNullOrEmpty(_objVisitRequest.ClientName) ? "Not Defined" : _objVisitRequest.ClientName; lblClientEmail.Text = string.IsNullOrEmpty(_objVisitRequest.ClientEmail) ? "Not Defined" : _objVisitRequest.ClientEmail; lblClientMobileNo.Text = string.IsNullOrEmpty(_objVisitRequest.ClientMobileNo) ? "Not Defined" : _objVisitRequest.ClientMobileNo; lblRequestedFor.Text = string.IsNullOrEmpty(PropertyName) ? "Not Defined" : PropertyName + " (" + apartmentNo + ")"; txtClientMessage.Text = _objVisitRequest.MessageToLandlord; ViewState["objVisitRequest"] = _objVisitRequest; } else { MessageBox("You already respond this Request!"); HtmlMeta meta = new HtmlMeta(); meta.HttpEquiv = "Refresh"; meta.Content = "3;url=WelcomeUI.aspx"; this.Page.Controls.Add(meta); } }
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>"; } }
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!"); } }