private string sendMailToUser(HelpSupportModel _helpSupportModel) { string returnMsg = string.Empty; try { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient(MailConstant.smtpserver); if (_helpSupportModel.RequestByMailId != "" && _helpSupportModel.RequestByMailId != null) { mail.From = new MailAddress(_helpSupportModel.RequestByMailId); } else { mail.From = new MailAddress("*****@*****.**"); } mail.To.Add(MailConstant.tomailId); mail.CC.Add(MailConstant.ccMailId); mail.CC.Add(MailConstant.ccMailId2); mail.Subject = MailConstant.visahelpsubject + " " + DateTime.Now + " by " + _helpSupportModel.RequestByUserName; mail.Body = "<p>Hi Touchstone Support,</p><p>Please see the details below regarding the help generated by:</p><p> </p><p>Request By: " + _helpSupportModel.RequestByUserName + " </p><p>Extension Number: " + _helpSupportModel.RequestByExtNo + "</p><p>Role: " + _helpSupportModel.RequestByRoleName + "</p><p>Center:" + _helpSupportModel.RequestByCenterHeadName + "</p><p>Campus:" + _helpSupportModel.RequestByCenterName + "</p><p>Remarks:" + _helpSupportModel.Remarks + "</p><p>Thanks</p>"; mail.IsBodyHtml = true; SmtpServer.Port = MailConstant.portno; SmtpServer.UseDefaultCredentials = false; SmtpServer.Credentials = new System.Net.NetworkCredential(MailConstant.networkcredentialsUserName, MailConstant.networkcredentialsPassword); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); return("1"); } catch (Exception ex) { return(ex.Message); } }
public string VisaHelpDeskSupport(HelpSupportModel _helpSupportModel) { string results = string.Empty; SqlConnection con = new SqlConnection(objCon.ConnectionReturn()); SqlCommand command = new SqlCommand("sp_VisaHelpDeskSupport", con); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@ModuleId", SqlDbType.VarChar).Value = _helpSupportModel.ModuleId; command.Parameters.Add("@RequestByUserId", SqlDbType.VarChar).Value = _helpSupportModel.RequestByUserId; command.Parameters.Add("@RequestByMailId", SqlDbType.VarChar).Value = _helpSupportModel.RequestByMailId; command.Parameters.Add("@RequestByExtNo", SqlDbType.VarChar).Value = _helpSupportModel.RequestByExtNo; command.Parameters.Add("@RequestByRoleId", SqlDbType.VarChar).Value = _helpSupportModel.RequestByRoleId; command.Parameters.Add("@RequestByCenterHeadId", SqlDbType.VarChar).Value = _helpSupportModel.RequestByCenterHeadId; command.Parameters.Add("@RequestByCenterId", SqlDbType.VarChar).Value = _helpSupportModel.RequestByCenterId; command.Parameters.Add("@Remarks", SqlDbType.VarChar).Value = _helpSupportModel.Remarks; command.Parameters.Add("@IsMailSendToUser", SqlDbType.Bit).Value = _helpSupportModel.IsMailSendToUser; command.Parameters.Add("@message", SqlDbType.VarChar, 50).Value = ""; command.Parameters["@message"].Direction = ParameterDirection.Output; con.Open(); command.ExecuteNonQuery(); con.Close(); results = Convert.ToString(command.Parameters["@message"].Value); //if(results) return(results); }
// HELP SUPPORT BIND /// <summary> /// Visa Help support /// </summary> /// <param name="loggedInUserId">Request submit by Id</param> /// <param name="Remarks">Message</param> /// <param name="loggedInUserMailId">Request by mail Id</param> /// <returns></returns> public string PostVisaHelpDeskSupport(string dataParam, HelpSupportModel _helpSupportModel) { string data = string.Empty; string returnData = string.Empty; try { string sendmailResponse = sendMailToUser(_helpSupportModel); if (sendmailResponse == "1") { _helpSupportModel.IsMailSendToUser = true; returnData = new MailSent().VisaHelpDeskSupport(_helpSupportModel); } else { _helpSupportModel.IsMailSendToUser = false; returnData = "-1"; } data = JsonConvert.SerializeObject(returnData); } catch (Exception Ex) { data = JsonConvert.SerializeObject(Ex.Message); } return(data); }