protected void btnSubmit_OnClick(object sender, EventArgs e) { string userPassword = string.Empty; string userEmail = string.Empty; MembershipUser user = Membership.GetUser(txtUserName.Text); try { //lblPassword.Text = Membership.Provider.GetPassword(txtUserName.Text, txtAnswer.Text); userPassword = Membership.Provider.GetPassword(txtUserName.Text, txtAnswer.Text); userEmail = user.Email.ToString(); lblPassword.Text = userEmail.ToString(); string body = ""; body += "<h2>AbiMatu Password Recovery</h2>"; body += "User Name :<b>" + txtUserName.Text + "</b><br/>"; body += "Password : <b>" + userPassword + "</b><br/>"; Sendmail.sendEmail("*****@*****.**", "", userEmail.ToString(), "", "Password From AbiMatu", body, "*****@*****.**", "mavs123456"); panForgetPassword.Visible = false; panPassword.Visible = true; panError.Visible = false; } catch (Exception ex) { lblError.Text = ex.Message; panError.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["Notification"] != null) { lblmsg.Text = "Notification"; } if (Request.QueryString["orderSuccessfull"] != null || Request.QueryString["ID"] != null) { lblmsg.Text = "Your order is successfull"; Login paidUser = LoginManager.GetLoginByID(int.Parse(Request.QueryString["ID"])); try { string body = "A subscriber have paid " + paidUser.ExtraField10 + @", <br/>Name:" + paidUser.FirstName + " " + paidUser.LastName + @",<br/> email: " + paidUser.Email + @" and contact:" + paidUser.CellPhone + @""; Sendmail.sendEmail("*****@*****.**", "Caregivermax: Payment", "*****@*****.**", "*****@*****.**", "Caregivermax: Payment", body); body = "Thank you for your subscription. Once the payment is cleared, a technical support from Care Giver Max will call you and setup your business. Again, we appreciate your business and look forward to work with you."; Sendmail.sendEmail("*****@*****.**", "Caregivermax: Payment", paidUser.Email, "*****@*****.**", "Caregivermax: Payment", body); } catch (Exception ex) { } } if (Request.QueryString["orderCencel"] != null) { lblmsg.Text = "Your have cancelled the order"; } } }
public void SendTo(List <string> to) { foreach (string receipient in to) { Sendmail.Send(receipient, "Z3 Alerts", ReportTextHTML, null, _images, true); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string sql = @" SELECT Mem_Member.Name,Mem_Member.Mobile,Mem_Member.Email,Conv_Registration.Conv_RegistrationID FROM Conv_Registration INNER JOIN Mem_Member ON Conv_Registration.Mem_MemberID =Mem_Member.Mem_MemberID where Conv_Registration.TrxID<>'' "; DataSet ds = DatabaseManager.ExecSQL(sql); //bool isStart = false; foreach (DataRow dr in ds.Tables[0].Rows) { //SMS /* * if (dr["Mobile"].ToString().Trim() != "") * { * try * { * string SMS = "Thanks for bKash payment to IEB. Your registration for Convention 55 is Confirmed.Please print your registration form (or money receipt) and bring it in Convention. www.iebbd.org/print.aspx?id=" + dr["Conv_RegistrationID"].ToString(); * MyWebRequest myRequest = new MyWebRequest("https://cbsms.grameenphone.com/send_sms_api/send_sms_from_api.php?user_name=IEBadmin&password=IEBadmin123&subscriber_no=" + dr["Mobile"].ToString().Trim().Substring(1, 10) + "&mask=IEB&sms=" + SMS); * //MyWebRequest myRequest = new MyWebRequest("https://cbsms.grameenphone.com/send_sms_api/send_sms_from_api.php?user_name=IEBadmin&password=IEBadmin123&subscriber_no=1818619647&mask=IEB&sms=" + SMS); * XmlDocument doc = new XmlDocument(); * * doc.LoadXml(myRequest.GetResponse()); * } * catch (Exception ex) * { } * * } */ //Mail if (dr["Email"].ToString().Trim() != "") { try { //string mialMessage = "Dear " + dr["Name"].ToString() + ",<br/><br/>Thanks for bKash payment.Your registration for Convention 55 is Confirmed.<br/><a href='www.iebbd.org/print.aspx?id=" +dr["Conv_RegistrationID"].ToString() + "'>Click here to print your registration form(or money receipt) which you need to bring in Convention</a><hr/>This is system generated payment confirmation mail.<hr/>With regards<br/>IT Section, IEB<br/>01766674142"; Sendmail.sendEmail(dr["Email"].ToString().Trim(), "[Correction] IEB 55th Convention Registration form(i.e. Money receipt)", MoneyReceiptGeneration.ConventionConfirmation(int.Parse(dr["Conv_RegistrationID"].ToString()))); } catch (Exception ex) { } } } } }
static void Main(string[] args) { try { Configuration c = new Configuration("config.xml"); Sendmail.Send(c.developers, "Build failed at Windows (x86/x64)", "The build failed; please check the attached logfile for errors.", c.build_log); } catch (Exception ex) { Console.Out.WriteLine("Exception: " + ex.Message); } }
//Actual location where email is sent. Currently no parameters because they are based on the day. Should move to it's own helper folder at some point. public void SendEmail() { List <string> ProcessedNotificationEmails = ConfigurationManager.AppSettings["EmailNotificationList"].Split(';').ToList(); List <string> ProcessedWinningEmails = ConfigurationManager.AppSettings["EmailWinnerList"].Split(';').ToList(); string WinningEmailText = ConfigurationManager.AppSettings["EmailWinnerList"].ToString(); string NotificationEmailText = ConfigurationManager.AppSettings["EmailWinnerList"].ToString(); try { Sendmail.SendMail($"Fuel Purchasing Fuel Price for Today", "Today's Fuel Price", NotificationEmailText, "AS1", to: ProcessedNotificationEmails); Sendmail.SendMail($"Fuel Purchasing Winner for Today", "Winning Fuel Bid", WinningEmailText, "AS1", to: ProcessedWinningEmails); } catch (Exception e) { throw; } }
public ActionResult Contacts(Sendmail Model) { string Text = "<html> <head> </head>" + " <body style= \" font-size:12px; font-family: Arial\">" + "Nom :" + Model.Name + "<br>" + "Télèphone :" + Model.Phone + "<br>" + "Email :" + Model.Email + "<br>" + "Question :" + Model.Message + "</body></html>"; string smtpAddress = "smtp.gmail.com"; int portNumber = 587; bool enableSSL = true; string emailFrom = "*****@*****.**"; string password = "******"; string emailTo = Model.Email; string subject = "Hello"; string body = Text; using (MailMessage mail = new MailMessage()) { mail.From = new MailAddress(emailFrom); mail.To.Add(emailTo); mail.Subject = subject; mail.Body = body; mail.IsBodyHtml = true; using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber)) { smtp.Credentials = new NetworkCredential(emailFrom, password); smtp.EnableSsl = enableSSL; smtp.Send(mail); return(RedirectToAction("Index")); } } }
/// <summary> /// Forgot pssword buttion clcik /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_submit_Click(object sender, EventArgs e) { try { if (IsValid) { // Validate the user's email address var manager = Context.GetOwinContext().GetUserManager <ApplicationUserManager>(); ApplicationUser user = manager.FindByName(txtemail.Value); if (user == null || !manager.IsEmailConfirmed(user.Id)) { FailureText.Text = "The user either does not exist or is not confirmed."; ErrorMessage.Visible = true; return; } // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771 // Send email with the code and the redirect to reset password page string code = manager.GeneratePasswordResetToken(user.Id); string callbackUrl = IdentityHelper.GetResetPasswordRedirectUrl(code, Request, user.Id); //Here we can send Email thorugh SendGridMessage() service but its a paid version. // manager.SendEmail(user.Id, "Reset Password", "Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>."); MailMessage message = new MailMessage(); var Mailaddress = new MailAddressCollection(); Mailaddress.Add(user.Email); message.Subject = "ForGot Password"; // message.Body = "<img src='http://evolutyz.com/wp-content/themes/evolutyz/images/logo-evolutyz.png' width='150' height='90' alt='' />" + " <br /> Hi " + user.Email+ " <br /> Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>."; // var mes= "<table width = '/600px/' align ='/center/' cellpadding ='5px' border ='0' cellspacing='0' style ='border:1px solid #dcdcdc;margin-top:20px;border-radius:3px;vertical-align:middle;display:block;font-family:helvetica;font-size:16px;font-style:normal'><tbody><tr><td><p><img alt = '' src = 'http://evolutyz.com/wp-content/themes/evolutyz/images/logo-evolutyz.png' style = 'width:80%;height:100px;margin-bottom:30px' class='CToWUd'></p></td><td style = 'text-align:right;padding:10px 5px;padding-left: 450px;color:#808080;font-family:helvetica;font-size:10px;line-height:125%' ><h1><span class='il'>Evolutyz</span>Crop</h1></td></tr><tr><td style='padding-left: 80px;' ><div style = 'text-align:justify'> Hi <a href = 'mailto:" + user.Email + "' target= '_blank' > " + user.Email + " </a></div><div style = 'text-align:justify'></div></td></tr><tr><td>Please reset your password by clicking below link<div><a style = 'margin-top:10px;text-decoration:none;color:#ffffff;padding:10px 16px;font-weight:bold;margin-right:10px;text-align:center;display:inline-block;background-color:#666666' href='" + callbackUrl + "' target='_blank' >Reset</a></div></td></tr><tr><td><div style = 'text-align:justify' ></div><div><p> Thanks & Regards,</p></div><div><span class='il'>Evolutyz</span>Team</div></td></tr></tbody></table>"; var mes = @"<body><div style='width:100%;height:100%;margin:10px auto;padding:0;background-color:#ffffff;font-family:Arial,Tahoma,Verdana,sans-serif;font-weight:299px;font-size:13px;text-align:center' bgcolor='#ffffff'><table width='100%' cellspacing='0' cellpadding='0' style='max-width:600px'><tbody><tr><td width='10' bgcolor='#027cd5' style='width:10px;background-color:wheat'> </td><td valign='middle' align='left' height='50' bgcolor='white' style='background-color:wheat;padding:0;margin:0'><a style='text-decoration:none;outline:none;color:#ffffff;font-size:13px' href='http://evolutyz.com/' target='_blank'><img border='0' height='30' src='http://evolutyz.com/wp-content/themes/evolutyz/images/logo-evolutyz.png' alt='Evolutyz.com' style='border:none'></a></td></tr></tbody></table><table width='100%' cellspacing='0' cellpadding='0' style='max-width:600px;border-left:solid 1px #e6e6e6;border-right:solid 1px #e6e6e6'> <tbody><tr> <td align='left' valign='top' style='color:#2c2c2c;display:block;font-weight:300;margin:0 auto;clear:both;border-bottom:1px solid #e6e6e6;background-color:#f9f9f9;padding:20px' bgcolor='#F9F9F9'> <p style='padding:0;margin:0;font-size:16px;font-size:13px'> Hi " + user.UserName + " </p><br><p style='padding:0;margin:0;color:#565656;font-size:13px'>Greetings!</p><br> <p style='padding:0;margin:0;color:#565656;line-height:10px;font-size:13px'> You are just a step away from accessing your Evolutyz account</p><br><p style='padding:0;margin:0;color:#565656;line-height:18px;font-size:13px'>Please reset your password by clicking below link</p><br><a style='margin-top:10px;text-decoration:none;color:#ffffff;padding:10px 16px;font-weight:bold;margin-right:10px;text-align:center;display:inline-block;background-color:#666666' href='" + callbackUrl + "'>Reset</a><br><p style='padding:0;margin:0;color:#565656;line-height:20px;font-size:13px'>Expires in:<strong>15 minutes only</strong></p><br><p style='padding:0;margin:0;color:#565656;line-height:20px;font-size:13px'>Thanks & Regards,<br>Team Evolutyz</p><br><p style='text-align:center;padding:0;margin:0' align='center'></p><br></td></tr></tbody></table></div></body>"; message.Body = mes.ToString(); // message.Body = @"<table width = " '/ 600px /' " align = 'center' cellpadding = '5px' border = '0' cellspacing = '0' style = 'border:1px solid #dcdcdc;margin-top:20px;border-radius:3px;vertical-align:middle;display:block;font-family:helvetica;font-size:16px;font-style:normal' > <tbody> < tr >< td >< p >< img alt = '' src = 'http://evolutyz.com/wp-content/themes/evolutyz/images/logo-evolutyz.png' style = 'width:80%;height:100px;margin-bottom:30px' class='CToWUd'></p></td><td style = 'text-align:right;padding:10px 5px;color:#808080;font-family:helvetica;font-size:10px;line-height:125%' >< h1 >< span class='il'>Evolutyz</span> Crop</h1></td></tr><tr><td><h2 style = 'display:block;font-family:helvetica;font-size:20px;font-style:normal;font-weight:bold;line-height:100%;letter-spacing:normal;margin-top:0px;margin-right:0px;margin-left:0px;color:#404040!important;text-align:left' > Hi " + user.UserName + ",</h2></td></tr><tr><td><div style = 'text-align:justify' > Hi : <a href = 'mailto:" + user.Email + "' target= '_blank' > " + user.Email + " </a></div><div style = 'text-align:justify' ></ div ></ td ></ tr >< tr >< td > Please reset your password by clicking below link<div><a style = 'margin-top:10px;text-decoration:none;color:#ffffff;padding:10px 16px;font-weight:bold;margin-right:10px;text-align:center;display:inline-block;background-color:#666666' href='" + callbackUrl + "' target='_blank' >Reset</a> </div> </td></tr> <tr><td><div style = 'text-align:justify' > </ div > < div > < p > Thanks & amp; Regards,</p> </div> <div><span class='il'>Evolutyz</span> Team</div> </td> </tr> </tbody> </table>"; // SetGifloader Page.ClientScript.RegisterStartupScript(this.GetType(), "SetGifloader", "SetGifloader()", true); Sendmail.SendEmailByMailMessage(message, user.Email); Page.ClientScript.RegisterStartupScript(this.GetType(), "Offgifloader", "Offgifloader()", true); Forgetpasswordform.Visible = false; DisplayEmail.Visible = true; } } catch (Exception ex) { } }
public static void MerchantTwo() { Connection connection = new Connection(); Sendmail sendmail = new Sendmail(); Transactions excelTransactions = new Transactions(); Refunds excelRefunds = new Refunds(); string excel = "Merchant Two.xlsx"; var workBook = new XLWorkbook(); MailMessage message = new MailMessage(); message.To.Add(new MailAddress($"*****@*****.**")); message.To.Add(new MailAddress($"*****@*****.**")); try { SqlDataReader sqlTransactions = connection.SqlConnection("EXEC dbo.stp_Report @merchantId='C6915847-6627-4CA0-AA02-7A0C4BA274D3', @relatorio='Transactions';"); excelTransactions.ExcelTransactions(sqlTransactions, workBook); connection.ConnectionClose(); SqlDataReader sqlRefunds = connection.SqlConnection("EXEC dbo.stp_Report @merchantId='C6915847-6627-4CA0-AA02-7A0C4BA274D3', @relatorio='Refunds';"); excelRefunds.ExcelRefunds(sqlRefunds, workBook); connection.ConnectionClose(); workBook.SaveAs(excel); Attachment attachment = new Attachment(excel, "application/vnd.ms-excel"); sendmail.Email(attachment, message, "Relatório MerchantTwo", "Olá,\n\nSegue em anexo relatório.\n\nAtenciosamente,"); } catch (Exception e) { Guid guid = Guid.NewGuid(); SaveLog.Logs(guid, "MerchantTwo", e); sendmail.Email(message, "Falha ao enviar relatório", $"Atenção!\n\nOcorreu uma falha ao enviar o relatório da loja MerchantTwo, para detalhes utilize o CurrentId: {guid} para consultar os logs."); } }
private static void EmailNormal(Dictionary <string, object> valueList, DTO.LIST_TASKInfo infTask) { ReportGenerator rgAtt = null; ReportGenerator rgCnt = null; if (infTask.AttQD_ID != "") { QueryBuilder.SQLBuilder sqlBuiderA = QueryBuilder.SQLBuilder.LoadSQLBuilderFromDataBase(infTask.AttQD_ID, _db, ""); rgAtt = new ReportGenerator(sqlBuiderA, infTask.AttQD_ID, "", _repConnect, _tempPath, _reptPath, __documentDirectory); } else { DataSet ds = new DataSet(); rgAtt = new ReportGenerator(ds, infTask.AttTmp, _db, _reptPath, _tempPath, _reptPath, __documentDirectory); } if (infTask.CntQD_ID != "") { QueryBuilder.SQLBuilder sqlBuiderC = QueryBuilder.SQLBuilder.LoadSQLBuilderFromDataBase(infTask.CntQD_ID, _db, ""); rgCnt = new ReportGenerator(sqlBuiderC, infTask.CntQD_ID, "", _repConnect, _tempPath, _reptPath, __documentDirectory); } else { DataSet ds = new DataSet(); rgCnt = new ReportGenerator(ds, infTask.CntTmp, _db, _repConnect, _tempPath, _reptPath, __documentDirectory); } rgAtt.ValueList = valueList; rgCnt.ValueList = valueList; ExcelFile xls = rgAtt.CreateReport(); rgAtt.UserID = _userID; rgCnt.Close(); bool flagRun = false; string[] arrVRange = infTask.ValidRange.Split(';'); if (arrVRange.Length >= 1) { for (int i = 1; i <= xls.SheetCount; i++) { TXlsNamedRange range = xls.GetNamedRange(arrVRange[0], 0); if (range != null) { xls.ActiveSheet = range.SheetIndex; object flag = xls.GetCellValue(range.Top, range.Left); if (flag != null && !String.IsNullOrEmpty(flag.ToString().Trim()) && flag.ToString().Trim() != "0") { flagRun = true; break; } } } } string title = infTask.Description; if (flagRun) { try { using (TextWriter wt = rgCnt.ExportHTML(_reptPath)) { ExcelFile xls1 = rgCnt.XlsFile; if (arrVRange.Length >= 2) { for (int i = 1; i <= xls1.SheetCount; i++) { TXlsNamedRange range = xls1.GetNamedRange(arrVRange[1], 0); if (range != null) { xls1.ActiveSheet = range.SheetIndex; object flag = xls1.GetCellValue(range.Top, range.Left); if (flag != null && !String.IsNullOrEmpty(flag.ToString())) { title = flag.ToString(); break; } } } } string content = wt.ToString(); string filename = rgAtt.ExportExcelToFile(_reptPath, infTask.Description + ".xls"); Sendmail sendMail = new Sendmail(infTask.UserID, infTask.Password, infTask.Server, infTask.Protocol, Convert.ToInt32(infTask.Port)); string[] emails = infTask.Emails.Split(','); Dictionary <string, string> arrayMail = new Dictionary <string, string>(); for (int i = 0; i < emails.Length; i++) { Match name = Regex.Match(emails[i], "\".+\""); Match mail = Regex.Match(emails[i], "<.+>"); arrayMail.Add(mail.Value.Substring(1, mail.Value.Length - 2), name.Value.Substring(1, name.Value.Length - 2)); } sErr = sendMail.SendMail(title, content, arrayMail, filename, true, true); } } catch (Exception ex) { sErr = ex.Message; } } }
protected void btnConfirm_Click(object sender, EventArgs e) { if (txtSerialNo.Text.Trim() == "") { showAlartMessage("PLease enter the serial no"); return; } sqlInjectionChecking(); trConfirmation.Visible = true; btnConfirm.Visible = false; string html = @" <div style='border:1px solid black;background-color:#FDFBE6;font-family:Arial;font-size:12px;padding:10px;width:408px;'> <table border='0' cellspacing='0' cellpadding='2' > <tr> <td colspan='5' style='background-color:white;'> <img src='http://iebbd.org/images/Convention/55/formHeader.png' width='400px'/> </td> </tr> <tr> <td style='border:1px solid black;'>Engr.</td> <td colspan='4' style='border:1px solid black;'>" + lblName.Text.Replace("ENGR. ", "") + @"</td> </tr> <tr> <td style='border:1px solid black;'>Membership No.</td> <td colspan='4' style='border:1px solid black;'>" + lblMembershipNo.Text + @"</td> </tr> <tr> <td style='border:1px solid black;'>Center</td> <td colspan='4' style='border:1px solid black;'>" + lblCenter.Text + @"</td> </tr> <tr> <td style='border:1px solid black;'>Telephone No.</td> <td colspan='4' style='border:1px solid black;'>" + txtTelephoneNo.Text + @" </td> </tr> <tr> <td style='border:1px solid black;'>Mobile</td> <td colspan='4' style='border:1px solid black;'>" + txtMobileN0.Text + @" </td> </tr> <tr> <td style='border:1px solid black;'>Email Address</td> <td colspan='4' style='border:1px solid black;'>" + txtEmail.Text + @" </td> </tr> <tr> <td colspan='5' style='height:10px;'> </td> </tr> <tr> <td style='border:1px solid black;'>Registration</td> <td style='border:1px solid black;background-color:#FFD24A;'>Compulsory</td> <td style='border:1px solid black;text-align:right;' colspan='3'>Tk. 1000</td> </tr> <tr> <td colspan='5' style='height:10px;'> </td> </tr> <tr> <td style='border:1px solid black;' rowspan='3'>Lunch</td> <td style='border:1px solid black;background-color:#FFD24A;'>03 May'14</td> <td style='border:1px solid black;text-align:center;'>" + txtQty1.Text + @" </td> <td style='border:1px solid black;width:70px;'><b style='color: #FF0000;'>x</b> Tk. 130=</td> <td style='border:1px solid black;text-align:right;'>" + txtAmount1.Text + @" </td> </tr> <tr> <td style='border:1px solid black;background-color:#FFD24A;'>04 May'14</td> <td style='border:1px solid black;' colspan='3'>Lunch Will be provided by IEB</td> </tr> <tr> <td style='border:1px solid black;background-color:#FFD24A;'>05 May'14</td> <td style='border:1px solid black;text-align:center;'>" + txtQty2.Text + @" </td> <td style='border:1px solid black;'><b style='color: #FF0000;'>x</b> Tk. 130 =</td> <td style='border:1px solid black;text-align:right;'>" + txtAmount2.Text + @" </td> </tr> <tr> <td colspan='5' style='height:10px;'> </td> </tr> <tr> <td style='border:1px solid black;' rowspan='2'><b style='color: #FF0000;'>*</b>Dinner</td> <td style='border:1px solid black;background-color:#FFD24A;'>Single</td> <td style='border:1px solid black;text-align:center;'> " + (CheckBox1.Checked ? "<img src='http://iebbd.org/images/Convention/check_mark.png' alt='tick_Mark'/>" : "") + @"</td> <td style='border:1px solid black;'>Tk. 500 =</td> <td style='border:1px solid black;text-align:right;'>" + txtAmount3.Text + @" </td> </tr> <tr> <td style='border:1px solid black;background-color:#FFD24A;'>Couple</td> <td style='border:1px solid black;text-align:center;'> " + (CheckBox2.Checked ? "<img src='http://iebbd.org/images/Convention/check_mark.png' alt='tick_Mark'/>" : "") + @"</td> <td style='border:1px solid black;'>Tk. 800 =</td> <td style='border:1px solid black;text-align:right;'>" + txtAmount4.Text + @" </td> </tr> <tr> <td colspan='5' style='height:10px;'><b style='color: #FF0000;'>*</b>Only for Members & Spouse</td> </tr> <tr> <td colspan='5' style='height:10px;'> </td> </tr> <tr> <td style='border:1px solid black;' rowspan='2'>Optional Items</td> <td style='border:1px solid black;background-color:#FFD24A;'>Ladies Bag</td> <td style='border:1px solid black;text-align:center;'> " + (CheckBox3.Checked ? "<img src='http://iebbd.org/images/Convention/check_mark.png' alt='tick_Mark'/>" : "") + txtQty3.Text + @"</td> <td style='border:1px solid black;'>Tk. 1200 =</td> <td style='border:1px solid black;text-align:right;'>" + txtAmount5.Text + @" </td> </tr> <tr> <td style='border:1px solid black;background-color:#FFD24A;'>IEB Tie</td> <td style='border:1px solid black;text-align:center;'> " + (CheckBox4.Checked ? "<img src='http://iebbd.org/images/Convention/check_mark.png' alt='tick_Mark'/>" : "") + txtQty4.Text + @"</td> <td style='border:1px solid black;'>Tk. 500 =</td> <td style='border:1px solid black;text-align:right;'>" + txtAmount6.Text + @" </td> </tr> <tr> <td colspan='5' style='height:10px;'> </td> </tr> <tr> <td style='border:1px solid black; text-align:right;' colspan='4'>Total Payable(to IEB) =</td> <td style='border:1px solid black;' text-align:right;>" + lblTotal.Text + @" </td> </tr> <tr> <td colspan='5' style='height:10px;'> </td> </tr> <tr> <td colspan='5' style='height:10px;'> </td> </tr> <tr> <td style='border:1px solid black; text-align:left;' colspan='3'>Serial No</td> <td style='border:1px solid black;' colspan='2'>'" + txtSerialNo.Text + @"'</td> </tr> </table> </div> "; string htmlConfirmation = @" <div style='border:1px solid black;background-color:#FDFBE6;font-family:Arial;font-size:12px;padding:10px;width:408px;'> <table border='0' cellspacing='0' cellpadding='2' > <tr> <td colspan='5' style='background-color:white;'> <img src='http://iebbd.org/images/Convention/55/formHeader.png' width='400px'/> <br/>Money Receipt </td> </tr> <tr> <td style='border:1px solid black;'>Engr.</td> <td colspan='4' style='border:1px solid black;'>" + lblName.Text.Replace("ENGR. ", "") + @"</td> </tr> <tr> <td style='border:1px solid black;'>Membership No.</td> <td colspan='4' style='border:1px solid black;'>" + lblMembershipNo.Text + @"</td> </tr> <tr> <td style='border:1px solid black;'>Center</td> <td colspan='4' style='border:1px solid black;'>" + lblCenter.Text + @"</td> </tr> <tr> <td style='border:1px solid black;'>Telephone No.</td> <td colspan='4' style='border:1px solid black;'>" + txtTelephoneNo.Text + @" </td> </tr> <tr> <td style='border:1px solid black;'>Mobile</td> <td colspan='4' style='border:1px solid black;'>" + txtMobileN0.Text + @" </td> </tr> <tr> <td style='border:1px solid black;'>Email Address</td> <td colspan='4' style='border:1px solid black;'>" + txtEmail.Text + @" </td> </tr> <tr> <td colspan='5' style='height:10px;'> </td> </tr> <tr> <td style='border:1px solid black;'>Registration</td> <td style='border:1px solid black;background-color:#FFD24A;'>Compulsory</td> <td style='border:1px solid black;text-align:right;' colspan='3'>Tk. 1000</td> </tr> <tr> <td colspan='5' style='height:10px;'> </td> </tr> <tr> <td style='border:1px solid black;' rowspan='3'>Lunch</td> <td style='border:1px solid black;background-color:#FFD24A;'>03 May'14</td> <td style='border:1px solid black;text-align:center;'>" + txtQty1.Text + @" </td> <td style='border:1px solid black;width:70px;'><b style='color: #FF0000;'>x</b> Tk. 130=</td> <td style='border:1px solid black;text-align:right;'>" + txtAmount1.Text + @" </td> </tr> <tr> <td style='border:1px solid black;background-color:#FFD24A;'>04 May'14</td> <td style='border:1px solid black;' colspan='3'>Lunch Will be provided by IEB</td> </tr> <tr> <td style='border:1px solid black;background-color:#FFD24A;'>05 May'14</td> <td style='border:1px solid black;text-align:center;'>" + txtQty2.Text + @" </td> <td style='border:1px solid black;'><b style='color: #FF0000;'>x</b> Tk. 130 =</td> <td style='border:1px solid black;text-align:right;'>" + txtAmount2.Text + @" </td> </tr> <tr> <td colspan='5' style='height:10px;'> </td> </tr> <tr> <td style='border:1px solid black;' rowspan='2'><b style='color: #FF0000;'>*</b>Dinner</td> <td style='border:1px solid black;background-color:#FFD24A;'>Single</td> <td style='border:1px solid black;text-align:center;'> " + (CheckBox1.Checked ? "<img src='http://iebbd.org/images/Convention/check_mark.png' alt='tick_Mark'/>" : "") + @"</td> <td style='border:1px solid black;'>Tk. 500 =</td> <td style='border:1px solid black;text-align:right;'>" + txtAmount3.Text + @" </td> </tr> <tr> <td style='border:1px solid black;background-color:#FFD24A;'>Couple</td> <td style='border:1px solid black;text-align:center;'> " + (CheckBox2.Checked ? "<img src='http://iebbd.org/images/Convention/check_mark.png' alt='tick_Mark'/>" : "") + @"</td> <td style='border:1px solid black;'>Tk. 800 =</td> <td style='border:1px solid black;text-align:right;'>" + txtAmount4.Text + @" </td> </tr> <tr> <td colspan='5' style='height:10px;'><b style='color: #FF0000;'>*</b>Only for Members & Spouse</td> </tr> <tr> <td colspan='5' style='height:10px;'> </td> </tr> <tr> <td style='border:1px solid black;' rowspan='2'>Optional Items</td> <td style='border:1px solid black;background-color:#FFD24A;'>Ladies Bag</td> <td style='border:1px solid black;text-align:center;'> " + (CheckBox3.Checked ? "<img src='http://iebbd.org/images/Convention/check_mark.png' alt='tick_Mark'/>" : "") + @"</td> <td style='border:1px solid black;'>Tk. 1200 =</td> <td style='border:1px solid black;text-align:right;'>" + txtAmount5.Text + @" </td> </tr> <tr> <td style='border:1px solid black;background-color:#FFD24A;'>IEB Tie</td> <td style='border:1px solid black;text-align:center;'> " + (CheckBox4.Checked ? "<img src='http://iebbd.org/images/Convention/check_mark.png' alt='tick_Mark'/>" : "") + @"</td> <td style='border:1px solid black;'>Tk. 500 =</td> <td style='border:1px solid black;text-align:right;'>" + txtAmount6.Text + @" </td> </tr> <tr> <td colspan='5' style='height:10px;'> </td> </tr> <tr> <td style='border:1px solid black; text-align:right;' colspan='4'>Total Payable(to IEB) =</td> <td style='border:1px solid black;' text-align:right;>" + lblTotal.Text + @" </td> </tr> <tr> <td colspan='5' style='height:10px;'> </td> </tr> <tr> <td style='border:1px solid black; text-align:left;' colspan='3'>Serial No</td> <td style='border:1px solid black;' colspan='2'>'" + txtSerialNo.Text + @"'</td> </tr> <tr> <td style='border:1px solid black; text-align:left;' colspan='5'>Thanks for your payment through bKash. Your registration is confirmed. </td> </tr> </table> </div> "; if (tblFessDetails.Visible) { html += "<div style='color:red;padding:10px; border:1px solid red;'>" + lblDues.Text + "</div>"; } if (txtEmail.Text != "") { try { //Sendmail.sendEmail(txtEmail.Text, "55th Convention Registration", html); //lblConfirmationEmail.Text = @"<br/><ul style='padding-left:15px;color:black;'><li>The Receipt has sent to your email <b style='color:blue;'>" + txtEmail.Text + "</b>"; } catch (Exception ex) { } } /* * if (txtMobileN0.Text.Trim().Length == 11) * { * try * { * * MyWebRequest myRequest1 = new MyWebRequest("https://cbsms.grameenphone.com/send_sms_api/send_sms_from_api.php?user_name=IEBadmin&password=IEBadmin123&subscriber_no=" + txtMobileN0.Text.Substring(1, 10) + "&mask=IEB&sms=You have to Pay your IEB Convention Fee from (any)personal bKash Account."); * XmlDocument doc1 = new XmlDocument(); * * string successMessage1 = ""; * doc1.LoadXml(myRequest1.GetResponse()); * XmlNodeList nodesUrl1 = doc1.SelectNodes("response"); * if (!doc1.InnerText.ToString().Contains("Failed")) * { * // lblConfirmationEmail.Text += " and a SMS to <b style='color:blue;'>" + txtMobileN0.Text + "</b>"; * } * * MyWebRequest myRequest = new MyWebRequest("https://cbsms.grameenphone.com/send_sms_api/send_sms_from_api.php?user_name=IEBadmin&password=IEBadmin123&subscriber_no=" + txtMobileN0.Text.Substring(1, 10) + "&mask=IEB&sms=You IEB 55th Convention total payable fees :tk." + lbltotalPayable.Text + " [Merchant Acc. No.:01766674142][Reference No.: " + lblBillNo.Text + "][Counter:0]"); * XmlDocument doc = new XmlDocument(); * * string successMessage = ""; * doc.LoadXml(myRequest.GetResponse()); * XmlNodeList nodesUrl = doc.SelectNodes("response"); * if (!doc.InnerText.ToString().Contains("Failed")) * { * lblConfirmationEmail.Text += " and a SMS to <b style='color:blue;'>" + txtMobileN0.Text + "</b>"; * } * * * } * catch (Exception ex) * { * * } * } * */ lblConfirmationEmail.Text += ""; try { string sql = @" INSERT INTO [Conv_Registration_Offline] ([Conv_ConventionID] ,[Mem_MemberID] ,[RegistrationFee] ,[Lunch1No] ,[Lunch1Amount] ,[Lunch2No] ,[Lunch2Amount] ,[Dinner1] ,[Dinner2] ,[LadiesBag] ,[IEBTie] ,[TotalIEBFee] ,[bKashFees] ,[TotalPayable] ,[TrxID] ,[AddedDate] ,[TypeID] ,[StatusID] ,[ExtraField1] ,[ExtraField2] ,[ExtraField3] ,[ExtraField4] ,[ExtraField5]) VALUES (55--<Conv_ConventionID, int,> ," + (hfMem_MemberID.Value == ""?"0":hfMem_MemberID.Value) + @"--<Mem_MemberID, int,> ,1000--<RegistrationFee, int,> ," + (txtQty1.Text.Trim() == "" ? "0" : txtQty1.Text) + @"--<Lunch1No, int,> ," + (txtAmount1.Text.Trim() == "" ? "0" : txtAmount1.Text) + @"--<Lunch1Amount, int,> ," + (txtQty2.Text.Trim() == "" ? "0" : txtQty2.Text) + @"--<Lunch2No, int,> ," + (txtAmount2.Text.Trim() == "" ? "0" : txtAmount2.Text) + @"--<Lunch2Amount, int,> ," + (txtAmount3.Text.Trim() == "" ? "0" : txtAmount3.Text) + @"--<Dinner1, int,> ," + (txtAmount4.Text.Trim() == "" ? "0" : txtAmount4.Text) + @"--<Dinner2, int,> ," + (txtAmount5.Text.Trim() == "" ? "0" : txtAmount5.Text) + @"--<LadiesBag, int,> ," + (txtAmount6.Text.Trim() == "" ? "0" : txtAmount6.Text) + @"--<IEBTie, int,> ," + (lblTotal.Text.Trim() == "" ? "0" : lblTotal.Text) + @"--<TotalIEBFee, int,> ," + (lblbKashFee.Text.Trim() == "" ? "0" : lblbKashFee.Text) + @"--<bKashFees, int,> ," + (lbltotalPayable.Text.Trim() == "" ? "0" : lbltotalPayable.Text.Trim()) + @"--<TotalPayable, int,> ,'" + txtSerialNo.Text + @"'--<TrxID, nvarchar(256),> ,GETDATE()--<AddedDate, datetime,> ,1--<TypeID, int,> ,1--<StatusID, int,> ,'" + html.Replace("'", "''") + @"'--<ExtraField1, nvarchar(max),> ,'" + htmlConfirmation.Replace("'", "''") + @"'--<ExtraField2, nvarchar(max),> ,''--<ExtraField3, nvarchar(max),> ,''--<ExtraField4, nvarchar(max),> ,''--<ExtraField5, nvarchar(max),> ); Select SCOPE_IDENTITY(); "; DataSet ds = DatabaseManager.ExecSQL(sql); //lblPrint.Text = html; //div_Print.Visible = false; //tblCard.Visible = false; //tblInfo.Visible = false; //tblMembershipNo.Visible = false; trConfirmation.Visible = true; //PrintSalesInvoice(); a_print.HRef = "../MembersArea/ConventionPaymentOfflinePrint.aspx?Conv_RegistrationID=710307" + ds.Tables[0].Rows[0][0].ToString() + "034438"; tr_ConfirmationEmail.Visible = true; //Response.Redirect("ConventionPayment.aspx"); } catch (Exception ex) { Sendmail.sendEmail("*****@*****.**", "55th Convention Registration[Error]" + txtMemeberShipNoSearch.Text, ex.Message); Response.Redirect("../Page/CustomErrorPage.aspx"); } }
public bool Getyan(string Email) { Sendmail sendmail = new Sendmail(); return(sendmail.Sendemail(Email)); }
protected void btnAdd_Click(object sender, EventArgs e) { string loginID = "1"; txtLoginName.Text = txtEmail.Text; Login login = new Login(); if (LoginManager.GetLoginByLoginName(txtLoginName.Text) != null) { lblMsg.Text = "Login Name dulplicate<br/>"; lblMsg.ForeColor = System.Drawing.Color.Red; return; } login.LoginName = txtLoginName.Text; if (txtPassword.Text != txtPasswordConfirm.Text) { lblMsg.Text = "Password and Confrim Password Does not match<br/>"; lblMsg.ForeColor = System.Drawing.Color.Red; return; } login.Password = txtPassword.Text; login.Email = txtEmail.Text; login.FirstName = txtFirstName.Text; login.MiddleName = txtMiddleName.Text; login.LastName = txtLastName.Text; login.CellPhone = txtCellPhone.Text; login.HomePhone = txtHomePhone.Text; login.WorkPhone = txtWorkPhone.Text; login.RowStatusID = 2; login.AddedBy = loginID; login.AddedDate = DateTime.Now; login.UpdatedBy = loginID; login.UpdatedDate = DateTime.Now; login.Details = txtDetails.Text; login.ExtraField1 = ""; login.ExtraField2 = "Resident/AdminResidentDisplay.aspx"; login.ExtraField3 = ""; login.ExtraField4 = txtInitial.Text; login.ExtraField5 = ""; login.ExtraField6 = ""; login.ExtraField7 = ""; login.ExtraField8 = ""; login.ExtraField9 = ""; login.ExtraField10 = ""; int resutl = LoginManager.InsertLogin(login); //add as office admin string sql = @"INSERT INTO [Login_LoginRole] ([RoleID] ,[LoginID] ,[RowStatusID] ,[AddedDate] ,[AddedBy] ,[ModifyDate] ,[ModifyBy]) VALUES (6--<RoleID, int,> ," + resutl + @"--<LoginID, int,> ,1--<RowStatusID, int,> ,GETDATE()--<AddedDate, datetime,> ,'1'--<AddedBy, nvarchar(256),> ,GETDATE()--<ModifyDate, datetime,> ,'1'--<ModifyBy, nvarchar(256),> ); update Login_Login set AddedResident=0, RootUser="******" where LoginID=" + resutl; CommonManager.SQLExec(sql); lblMsg.Text = "Added Successfully<br/>"; lblMsg.ForeColor = System.Drawing.Color.Green; //Response.Redirect("AdminLoginDisplay.aspx"); Sendmail.sendEmail(txtEmail.Text, txtFirstName.Text + " " + txtLastName.Text, "*****@*****.**", "*****@*****.**", "New user registered", "A new user registered for Care Giver Solution."); Sendmail.sendEmail("*****@*****.**", "Care Giver Max", txtEmail.Text, "*****@*****.**", "Signup at www.caregivermax.com", "Thank you for your interest and signing up with Care Giver max. We look forward to work with you"); Response.Redirect("m_registration-step2.aspx?LoginID=" + resutl); }
protected void btSend_Click(object sender, EventArgs e) { if (Page.IsValid) { if (txtUsername.Text.Trim() == "") { Lab_message.Text = "Đăng nhập tên người dùng !"; return; } if (txtEmail.Text.Trim() == "") { Lab_message.Text = " Nhập địa chỉ thư điện tử!"; return; } Member member = new Member(); DataRow vDr = member.getUsers_Login(txtUsername.Text.Trim()); if (vDr == null) { Lab_message.Text = "Tên người dùng không tồn tại !"; return; } string vMail = vDr["email"].ToString(); if (vMail != txtEmail.Text.Trim()) { Lab_message.Text = "Email nhập không đúng !"; return; } if (vDr != null) { // Lay Radom Password qua System string vnewpass = System.Guid.NewGuid().ToString(); vnewpass = vnewpass.Replace("-", string.Empty); vnewpass = vnewpass.Substring(0, 6); Sendmail sMail = null; string NewPass = FormsAuthentication.HashPasswordForStoringInConfigFile(vnewpass.Trim(), "MD5"); try { string sMailContact = string.Empty; sMail = new Sendmail(); sMailContact = Globals.MailMaster; sMail.SmtpServer = Globals.MailServer; sMail.SmtpMailFrom = Globals.Gmail; sMail.SmtpUser = Globals.Gmail.Replace("@gmail.com", ""); sMail.SmtpPassword = Globals.GmailPassword;; sMail.SmtpPort = Convert.ToInt32(Globals.MailPort); string sContent = "<font color=#000099>Dùng thông tin sau để đăng nhập vào hệ thống: <B>Administrator</B>." + "<br> Tên người dùng (Username):<font color=red> " + txtUsername.Text.Trim() + "</font>" + "<br> Mật khẩu mới (New password):<font color=red> " + vnewpass + "</font>" + "<br> Sau khi đăng nhập hãy <B>đổi mật khẩu mới</B> để đảm bảo tính bảo mật của hệ thống ." + "<br> Xin chân thành cảm ơn ! </font>"; sMail.SendMail(sMailContact, "Bạn đã thay đổi mật khẩu thành công", sContent, true); Lab_message.Text = "Gửi thành công. Hãy đọc email để lấy thông tin ! "; } catch (Exception ex) { string s = ex.Message.ToString(); Lab_message.Text = "Không gửi được. Xem lại địa chỉ Email ! "; return; } // Update PassNew to database string vID = vDr["ID"].ToString(); member.update_Pass(vID, NewPass.Trim()); txtUsername.Text = ""; txtEmail.Text = ""; } } }
public bool Getvalid(string Email, string code) { Sendmail sendmail = new Sendmail(); return(sendmail.IsValidcode(code)); }
protected void btnSaveInDBForMembershipFee_Click(object sender, EventArgs e) { string sql = ""; foreach (GridViewRow gvr in gvbKash.Rows) { try { TextBox txtCorrctReferenceNo = (TextBox)gvr.FindControl("txtCorrctReferenceNo"); TextBox txtMemberShipNo = (TextBox)gvr.FindControl("txtMemberShipNo"); Label lblTransactionID = (Label)gvr.FindControl("lblTransactionID"); Label lblAmount = (Label)gvr.FindControl("lblAmount"); Label lblTrancsactionTime = (Label)gvr.FindControl("lblTrancsactionTime"); Label lblMobile = (Label)gvr.FindControl("lblMobile"); Label lblEmail = (Label)gvr.FindControl("lblEmail"); CheckBox chkSelect = (CheckBox)gvr.FindControl("chkSelect"); DropDownList rbtnPaidUpto = (DropDownList)gvr.FindControl("rbtnPaidUpto"); if (chkSelect.Checked) { sql = @" INSERT INTO [Mem_Fees] ([Mem_MemberID] ,[Amount] ,[PaidFor] ,[ExtraField] ,[AddedDate] ,[AddedBy] ,[ModifiedBy] ,[ModifiedDate] ,[Comn_RowStatusID] ,[RefferenceNo] ,[Comn_PaymentByID] ,[PaidDate] ,[Mem_FeesYearID]) VALUES ((Select Mem_MemberID from Mem_Member where MemberShipNo ='" + txtMemberShipNo.Text + @"')--<Mem_MemberID, int,> ," + lblAmount.Text + @"--<Amount, decimal(10,2),> ,'" + rbtnPaidUpto.SelectedItem.Text + @"'--<PaidFor, nvarchar(50),> ,'New Database Entry'--<ExtraField, nvarchar(256),> ,GETDATE()--<AddedDate, datetime,> ,1--<AddedBy, int,> ,1--<ModifiedBy, int,> ,GETDATE()--<ModifiedDate, datetime,> ,1--<Comn_RowStatusID, int,> ,'" + lblTransactionID.Text + @"'--<RefferenceNo, nvarchar(50),> ,2--<Comn_PaymentByID, int,> ,'" + DateTime.Parse(lblTrancsactionTime.Text).ToString("yyyy-MM-dd hh:mm tt") + @"'--<PaidDate, datetime,> ," + rbtnPaidUpto.SelectedValue + @"--<Mem_FeesYearID, int,> ); update Acc_bKash_Final set ExtraField1=(Select cast(Mem_MemberID as nvarchar) from Mem_Member where MemberShipNo ='" + txtMemberShipNo.Text + @"') where TransactionID=" + lblTransactionID.Text + @" "; DatabaseManager.ExecSQL(sql); //SMS if (lblMobile.Text.Trim() != "") { try { string SMS = "Thanks for bKash payment of your IEB membership fees paid upto " + rbtnPaidUpto.SelectedItem.Text + ". Your payment amount(" + lblAmount.Text + ") and trxID: " + lblTransactionID.Text; MyWebRequest myRequest = new MyWebRequest("http://cbsms.grameenphone.com/send_sms_api/send_sms_from_api.php?user_name=IEBadmin&password=IEBadmin123&subscriber_no=" + lblMobile.Text.Trim().Substring(1, 10) + "&mask=IEB&sms=" + SMS); XmlDocument doc = new XmlDocument(); doc.LoadXml(myRequest.GetResponse()); } catch (Exception ex) { } } //Mail if (lblEmail.Text.Trim() != "") { try { string mialMessage = "Dear Engr,<br/><br/>Thanks for bKash payment of your membership fees paid upto " + rbtnPaidUpto.SelectedItem.Text + ". Your payment amount(" + lblAmount.Text + ") & trxID: " + lblTransactionID.Text + "<br/>This is system generated payment confirmation mail.<hr/>With regards<br/>IT Section, IEB<br/>01766674142"; Sendmail.sendEmail(lblEmail.Text, "IEB Membership Fees payment confirmation", mialMessage); } catch (Exception ex) { } } } } catch (Exception ex) {} } btnSearch_Click(this, new EventArgs()); }
//public string doEnroll(object sender, DoWorkEventArgs args) //{ // EnrollmentResult enrollmentResults = new EnrollmentResult(); // enrollmentResults.engineUser = _engine.Enroll(20000, out enrollmentResults.engineStatus); // args.Result = enrollmentResults; // if (enrollmentResults.engineStatus == NffvStatus.TemplateCreated) // { // //it took a snap shot // var img = enrollmentResults.engineUser.GetBitmap(); // var base64 = ConvertImageToBAse64(img); // return base64; // //convert the image to base 64 // } // else // { // return "99"; // } //} //public string ConvertImageToBAse64(Bitmap bitmapImage) //{ // MemoryStream ms = new MemoryStream(); // bitmapImage.Save(ms, ImageFormat.Png); // string Base64Image = Convert.ToBase64String(ms.ToArray()); // Fingerprint fp2 = new Fingerprint(); // // // fp2.AsBitmap = new Bitmap(bitmapImage); // Person person = new Person(); // person.Fingerprints.Add(fp2); // // fp2.AsIsoTemplate // Afis.Extract(person); // var imgArray = fp2.Template; // var isoTemplate = fp2.AsIsoTemplate; // var isoImage = Convert.ToBase64String(isoTemplate); // var ImagByteArray = Convert.ToBase64String(imgArray); // ms.Position = 0; // //BinaryWriter a = new BinaryWriter(File.Open("iso19794-2 template from fp_image1.dat", FileMode.Create)); // //foreach (byte element in isoTemplate) // //{ // // a.Write(element); // //} // return ImagByteArray; // //return Base64Image; //} //process payment protected void btnMakePayment_Click(object sender, EventArgs e) { try { if (txtAmount.Text == "") { //Alertdiv.InnerText = "ENTER AN AMOUNT !!!"; //Alertdiv.Visible = true; return; } TeamDaze.BLL.DAL.Sendmail mailTrxn = new Sendmail(); decimal amount = Convert.ToDecimal(txtAmount.Text.ToString()); string mailbody = ""; string subject = ""; //var response = client.Search(); //if (response.ResponseCode == BFSClientReturnErrorCode.HIT_CONFIRMED) if (true) { mailbody = "Dear Customer, This is an alert for the payment you just made on Touch 'N' Pay platform Amount "; mailbody += "Amount:" + amount.ToString() + "Naira <br> If you did not carry out this transaction kindly contact us at [email protected] or 08105931866"; subject = "Touch 'N' Pay Transaction Alert"; mailTrxn.SendMailAlerts("*****@*****.**", mailbody, subject); string UserBVN = ""; TransactionRepository LogTrxn = new TransactionRepository(); UserBVN = ConfigurationManager.AppSettings["TestBVN"].ToString(); string merchantAPI = ""; int UserType = 0; ////get the user's details with the userID //CustomerCreation customerDetails = new CustomerCreation(); //UserBVN = customerDetails.BVN; CustomerRepository customer = new CustomerRepository(); var userDetail = customer.GetCustomer(UserBVN); var det = userDetail.Item2; //check if this is a card or bank user if (ConfigurationManager.AppSettings["TestBVN"].ToString() == "2269644939") { UserType = 2; } else { UserType = 3; } if (UserType == 2) //2 -card user { //call FlutterWave API & Log transactions //mail user on alert FlutterChargeCard chargeCard = new FlutterChargeCard { amount = amount.ToString(), cardtype = det[0].Status.ToString(), chargetoken = det[0].BVN, country = "NG", currency = "NGN", custid = det[0].BVN, merchantid = "testMerchant", narration = "Test trxn" }; //Mock the FlutterWave API call and response //response mock FlutterCardResponse flutterCard = new FlutterCardResponse { status = "success", data = null }; //send sucess mail alert & log Trxn if (flutterCard.status == "success") { //success //100 is the test merchant ID //1 is the status for a successful trxn LogTrxn.LogTrxn(det[0].BVN, det[0].BVN, det[0].PhoneNumber, 100, amount.ToString(), "1"); Alertdiv.InnerText = "Payment Succesful"; Alertdiv.Visible = true; mailbody = "Hi there, This is an alert for the payment you just made on Touch 'N' Pay platform Amount "; mailbody += "Amount:" + amount.ToString() + "Naira <br> If you did not carry out this transaction kindly contact us at [email protected] or 08105931866"; subject = "Touch 'N' Pay Transaction Alert"; mailTrxn.SendMailAlerts(det[0].EmailAddress, mailbody, subject); Response.Redirect("TransactionConfirmation.aspx"); } else { //failed //0 is the status for a successful trxn LogTrxn.LogTrxn(det[0].BVN, det[0].BVN, det[0].PhoneNumber, 100, amount.ToString(), "0"); // SendMail() mailbody = "Hi there, This is an alert for the payment you just made on Touch 'N' Pay platform Amount "; mailbody += "Amount:" + amount.ToString() + "Naira <br> If you did not carry out this transaction kindly contact us at [email protected] or 08105931866"; subject = "Touch 'N' Pay Transaction Alert"; mailTrxn.SendMailAlerts(det[0].EmailAddress, mailbody, subject); Alertdiv.InnerText = "Payment Failed"; Alertdiv.Visible = true; Response.Write("<script language='javascript'>alert('Payment Failed');</script>"); return; } } else if (UserType == 3) { //bank user //call the bank API & //based on the customer's bank code...POST the trxn to their API BankPayoutReq bankPayout = new BankPayoutReq { AcctType = "savings", Amount = amount.ToString(), BVN = det[0].BVN, MerchantID = "",//would always be fixed for any ONE bank..e.g Sterling -101, Polaris- 098 TrxnRef = "Payment:" + UserBVN }; bool CallHostbank = true; //simulation of calling the host bank if (CallHostbank) { //log the trxn LogTrxn.LogTrxn(det[0].BVN, det[0].BVN, det[0].PhoneNumber, 100, amount.ToString(), "1"); Response.Redirect("TransactionConfirmation.aspx"); } else { //ignore this sha } } else { //Alertdiv.InnerText = "I Could Not Get Your details currently, please try again."; //Alertdiv.Visible = true; return; } } else { //Alertdiv.InnerText = "User Does Not Exist On NIBSS Database"; //Alertdiv.Visible = true; return; } } catch (Exception ex) { } }