public void GetroleDetails(GridView grdvAddrole, HtmlGenericControl Griddiv) { try { ds = oUserDLL.GetroleDetails(); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { grdvAddrole.DataSource = ds; grdvAddrole.DataBind(); } else { grdvAddrole.DataSource = ds; grdvAddrole.DataBind(); } } } catch (Exception ex) { AppConstants OAp = new AppConstants(); String FUNCTION_NAME = "GetOwnershipDetails"; String MODULE_NAME = "Ownership.aspx"; String ERROR_TYPE = "Application"; String ERROR_DESC = ex.Message; string lineNumber = ex.StackTrace.Substring(ex.StackTrace.Length - 7, 7); string url = HttpContext.Current.Request.Url.AbsoluteUri; OAp.InsertException(FUNCTION_NAME, MODULE_NAME, ERROR_TYPE, ERROR_DESC, url, lineNumber); FUNCTION_NAME = ""; MODULE_NAME = ""; ERROR_TYPE = ""; ERROR_DESC = ""; } }
public static int sendMailCrystelReport(string EmailID, string Subject, string Body, MemoryStream File) { MailMessage msg = new MailMessage(); int Status = 0; try { msg.From = new MailAddress(AppConstants.fromMail); if (EmailID != "" || EmailID != string.Empty) { string[] multi = EmailID.Split(','); foreach (string EM in multi) { msg.To.Add(EM); } if (File != null) { msg.Attachments.Add(new Attachment(File, "ApplicationForm.pdf")); } msg.Body = Body; msg.IsBodyHtml = true; msg.Subject = Subject; SmtpClient smt = new SmtpClient(AppConstants.mailHost); smt.Port = AppConstants.mailPort; smt.Credentials = new NetworkCredential(AppConstants.fromMail, AppConstants.defaultPswd); smt.EnableSsl = true; smt.Send(msg); } return(Status = 1); } catch (Exception ex) { AppConstants OAp = new AppConstants(); String FUNCTION_NAME = "sendMailCrystelReport"; String MODULE_NAME = "PaymentReceipt"; String ERROR_TYPE = "Application"; String ERROR_DESC = ex.Message; string lineNumber = ex.StackTrace.Substring(ex.StackTrace.Length - 7, 7); string url = HttpContext.Current.Request.Url.AbsoluteUri; string Error_refno = OAp.InsertException(FUNCTION_NAME, MODULE_NAME, ERROR_TYPE, ERROR_DESC, url, lineNumber); return(Status = 0); } finally { msg.Dispose(); } }
//SOCB SACHIN 16-07-2016 public static int SendMail(string strMailSubject, string strMessage, string strMailTo, string strMailCC) { MailMessage message = null; int intStatusMessage = 0; try { SmtpClient smtp = new SmtpClient(); smtp.Host = AppConstants.mailHost; smtp.Port = AppConstants.mailPort; smtp.Credentials = new NetworkCredential(AppConstants.fromMail, AppConstants.fromMailPwd); message = new MailMessage(); //message.To.Add(new MailAddress(strMailTo)); string[] Multi = strMailTo.Split(','); foreach (string MultiEmailID in Multi) { message.To.Add(new MailAddress(MultiEmailID)); } message.Subject = strMailSubject; message.From = new MailAddress(AppConstants.fromMail); message.IsBodyHtml = true; message.Body = strMessage; smtp.EnableSsl = true; smtp.Send(message); intStatusMessage = 1; return(intStatusMessage); } catch (Exception ex) { message.Dispose(); AppConstants OAp = new AppConstants(); String FUNCTION_NAME = "SendMail"; String MODULE_NAME = "CommonDal"; String ERROR_TYPE = "Application"; String ERROR_DESC = ex.Message; string lineNumber = ex.StackTrace.Substring(ex.StackTrace.Length - 7, 7); string url = HttpContext.Current.Request.Url.AbsoluteUri; OAp.InsertException(FUNCTION_NAME, MODULE_NAME, ERROR_TYPE, ERROR_DESC, url, lineNumber); return(0); } }
public void updaterole(HiddenField hdnRole, TextBox txtrolename, DropDownList ddlRoleType, object sender, HtmlGenericControl MainDiv, HtmlGenericControl Griddiv, string modifiedby) { try { int Role_Recno = Convert.ToInt32(hdnRole.Value); string Role = Convert.ToString(ddlRoleType.SelectedValue); int result = oUserDLL.updaterole(Role_Recno, txtrolename.Text, Role, modifiedby); if (result > 0) { string title = "Message from System"; string msg = "Role Details Updated Successfully"; ScriptManager.RegisterStartupScript(txtrolename, txtrolename.GetType(), "script", "Message('" + title + "','btn-success','" + msg + "');", true); } else if (result == -2) { string title = "Message from System"; string msg = "Role Details must be distinct values "; ScriptManager.RegisterStartupScript(txtrolename, txtrolename.GetType(), "script", "Message('" + title + "','btn-success','" + msg + "');", true); } else { string title = "Message from System"; string msg = "Role Details Not Updated Successfully"; ScriptManager.RegisterStartupScript(txtrolename, txtrolename.GetType(), "script", "Message('" + title + "','btn-danger','" + msg + "');", true); } } catch (Exception ex) { AppConstants OAp = new AppConstants(); String FUNCTION_NAME = "updatecategory"; String MODULE_NAME = "Category"; String ERROR_TYPE = "Application"; String ERROR_DESC = ex.Message; string lineNumber = ex.StackTrace.Substring(ex.StackTrace.Length - 7, 7); string url = HttpContext.Current.Request.Url.AbsoluteUri; OAp.InsertException(FUNCTION_NAME, MODULE_NAME, ERROR_TYPE, ERROR_DESC, url, lineNumber); FUNCTION_NAME = ""; MODULE_NAME = ""; ERROR_TYPE = ""; ERROR_DESC = ""; } }
//EOCB SACHIN 16-07-2016 //SOCB SACHIN 16-07-2016 public static int SendMailWithAttachment(string strMailSubject, string strMessage, string strMailTo, string strMailCC, string strAttachPath) { int intStatusMessage = 0; MailMessage message = null; try { SmtpClient smtp = new SmtpClient(); smtp.EnableSsl = true; smtp.Host = AppConstants.mailHost; smtp.Port = AppConstants.mailPort; smtp.Credentials = new NetworkCredential(AppConstants.fromMail, AppConstants.fromMailPwd); message = new MailMessage(); message.From = new MailAddress(AppConstants.fromMail); //if Multiple recipients string[] Multi = strMailTo.Split(','); foreach (string MultiEmailID in Multi) { if (MultiEmailID != "" && MultiEmailID != string.Empty) { message.To.Add(new MailAddress(MultiEmailID)); } } //if Multiple CC recipients string[] MultiCC = strMailCC.Split(','); foreach (string EmailIDCC in MultiCC) { if (EmailIDCC != "" && EmailIDCC != string.Empty) { message.CC.Add(new MailAddress(strMailCC)); } } //recipients message.Subject = strMailSubject; message.IsBodyHtml = true; message.Body = strMessage; if (strAttachPath != string.Empty) { Attachment attachment = new System.Net.Mail.Attachment(strAttachPath); message.Attachments.Add(attachment); } smtp.Send(message); intStatusMessage = 1; return(intStatusMessage); } catch (Exception ex) { message.Dispose(); AppConstants OAp = new AppConstants(); String FUNCTION_NAME = "SendMailwithAttachment"; String MODULE_NAME = "CommonDal"; String ERROR_TYPE = "Application"; String ERROR_DESC = ex.Message; string lineNumber = ex.StackTrace.Substring(ex.StackTrace.Length - 7, 7); string url = HttpContext.Current.Request.Url.AbsoluteUri; OAp.InsertException(FUNCTION_NAME, MODULE_NAME, ERROR_TYPE, ERROR_DESC, url, lineNumber); return(0); } }