static void Main() { try { string body = "Hello,</br></br></br>Attached herewith the Monthly report (May'17) for review solicitation of OneFineRate."; string subject = string.Format("Monthly report ({0}, {1}) for review solicitation of OneFineRate.", string.Format("{0:MMM}", DateTime.Now), string.Format("{0:yy}", DateTime.Now)); DataSet dt = SqlHelper.ExecuteDataset(ConfigurationManager.AppSettings["ConnectionString"].ToString(), CommandType.StoredProcedure, "[uspTripAdvisorMonthlyReport]"); if (dt.Tables[0] != null && dt.Tables[0].Rows.Count > 0) { string path = AppDomain.CurrentDomain.BaseDirectory + "TripAdvisorMonthlyReport"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } ExportDatasetToExcel(dt); var fileStream = new FileStream(AppDomain.CurrentDomain.BaseDirectory + "TripAdvisorMonthlyReport/MonthlyReport.xlsx", FileMode.Open, FileAccess.Read); var displayName = "TripAdvisorMonthlyReport.xlsx"; var attachment = new Attachment(fileStream, displayName); SqlParameter[] MyParam = new SqlParameter[1]; MyParam[0] = new SqlParameter("@sModule", "TripAdvisor"); DataSet dataset = SqlHelper.ExecuteDataset(ConfigurationManager.AppSettings["ConnectionString"].ToString(), CommandType.StoredProcedure, "[dbo].[GetEmailByModule]", MyParam); if (dataset.Tables[0] != null && dataset.Tables[0].Rows.Count > 0) { MailComponent.SendEmail("*****@*****.**", "", "", subject, body, attachment, null, true); } } } catch (Exception) { throw; } }
//Log4net //static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); static void Main(string[] args) { string sErrorEmail = "[email protected],[email protected]"; try { sErrorEmail = SqlHelper.ExecuteScalar(ConfigurationManager.ConnectionStrings["OFR_DataContext"].ToString(), CommandType.Text, "SELECT TOP 1 sEmail FROM tblEmailSettingsM WHERE sModule = 'TravelGuruSync'").ToString(); } catch (Exception) { } try { //Log4net configuration //BasicConfigurator.Configure(); string staticDumpUrl = ConfigurationManager.AppSettings["StaticTextDumpUrl"].ToString(); string userName = ConfigurationManager.AppSettings["UserName"].ToString(); string password = ConfigurationManager.AppSettings["Password"].ToString(); //For Testing Purpose //System.Threading.Thread.Sleep(1000 * 60 * 3); new DumpDataManager(sErrorEmail).DownloadAndProcessData(sourceUrl: staticDumpUrl, userName: userName, password: password); } catch (Exception ex) { try { MailComponent.SendEmail(sErrorEmail, "", "", "TravelGuru Sync Error", ex.ToString(), null, null, false, null, null); } catch (Exception exMail) { LogExceptionDetails(exMail); } LogExceptionDetails(ex); } }
public ActionResult GetLeftPayment(BiddingHotelsUpgrade objUpgrade) { try { var obj = new BiddingHotelsUpgrade(); if (TempData["BIdUpgradeHotels"] != null) { TempData.Keep(); obj = TempData["BIdUpgradeHotels"] as BiddingHotelsUpgrade; } var prop = obj.lstRoomsData.Where(u => u.iRoomId == objUpgrade.iRoomId).SingleOrDefault(); var obj1 = new eBiddingHotelsUpgradeRoomsList(); obj1 = prop as eBiddingHotelsUpgradeRoomsList; var result = BL_Bidding.UpdateUpgradeBidBookingUnfinished(Convert.ToInt64(objUpgrade.iBookingId), obj.iPropId, objUpgrade.iRoomId, obj1.TotalDifference, obj1.TaxDifference, objUpgrade.sAuthCode); if (result.Status == "Success") { var bookingModel = BL_Booking.GetBooking(Convert.ToInt64(objUpgrade.iBookingId)); string Status = "Thank you " + bookingModel.sTitleOFR + " " + bookingModel.sFirstNameOFR + "! We have recieved your final payment."; Task.Run(() => MailComponent.SendEmail(bookingModel.sEmailOFR, "", "", "Hotel Selected", Status, null, null, false, null, null)); Task.Run(() => clsUtils.sendSMS(bookingModel.sMobileOFR, Status)); Session["Result"] = "Hotel selected successfully!"; return(RedirectToAction("Index")); } } catch (Exception E) { Session["Result"] = "There was an error selecting the hotel. Please try again."; } return(RedirectToAction("Index")); }
public ActionResult UpdateBookingOnUpgrade(BiddingHotelsUpgrade obj) { try { TempData.Peek("BIdUpgradeHotels"); TempData.Peek("BidSearchHotels"); TempData.Peek("BidSearchData"); int bookingId, PropId; PropId = obj.iPropId; bookingId = obj.iBookingId; eBidBookingResult Robj = BL_Bidding.UpdateBidBooking(bookingId, PropId); if (Robj.Status == "Success") { var bookingModel = BL_Booking.GetBooking(bookingId); string Status = "Thank you " + bookingModel.sTitleOFR + " " + bookingModel.sFirstNameOFR + "! We have recieved your final payment."; Task.Run(() => MailComponent.SendEmail(bookingModel.sEmailOFR, "", "", "Hotel Selected", Status, null, null, false, null, null)); Task.Run(() => clsUtils.sendSMS(bookingModel.sMobileOFR, Status)); Session["Result"] = "Hotel selected successfully!"; return(RedirectToAction("Index")); } } catch (Exception E) { Session["Result"] = "There was an error selecting the hotel. Please try again."; } return(RedirectToAction("Index")); }
public Task SendAsync(IdentityMessage message) { // Plug in your email service here to send an email. MailComponent.SendEmail(message.Subject, "", "", "Link to reset your password for " + clsUtils.ApplicationName() + "", message.Body, null, null, true, null, null); return(Task.FromResult(0)); }
//[HttpPost] public ActionResult SendMailAndUpdateTaxAffectedBookings(string selectedBookingIds) { try { if (!string.IsNullOrEmpty(selectedBookingIds)) { var userId = ((BL_Login.UserDetails)Session["UserDetails"]).iUserId; List <string> deliveredBookingIdInEmail = new List <string>(); long[] bookingIdArr = selectedBookingIds.Split(',').Select(long.Parse).ToArray(); var affectedBoolingList = BL_Booking.GetTaxAffectedBookings(bookingIdArr); bool isError = false; foreach (var item in affectedBoolingList) { try { item.sCheckIn = item.dtCheckIn.ToString("dd MMM yyyy"); item.sCheckOut = item.dtCheckOut.ToString("dd MMM yyyy"); var html_Customer = this.RenderViewToString("_TaxChangeBookingAlert", item); //TO DO var ccMail = string.Empty; ccMail = "*****@*****.**"; MailComponent.SendEmail(item.sEmailOFR, ccMail, "", "OneFineRate! Confirmation No:" + item.iBookingId, html_Customer, null, null, true, null, null); deliveredBookingIdInEmail.Add(item.iBookingId.ToString()); } catch (Exception ex) { isError = true; } } var result = BL_Booking.UpdateTaxAffectedBookings(deliveredBookingIdInEmail.ToArray(), userId); if (isError) { return(Json(new { status = false, message = "An error occured occurred while sending email." }, JsonRequestBehavior.AllowGet)); } return(Json(new { status = true, message = "Record updated and email sent to selected record successfully!" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { status = false, message = "Please select at least one booking." }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { status = false, message = "An error occurred while updating the record!" }, JsonRequestBehavior.AllowGet)); } }
protected void Application_Error() { Exception exception = Server.GetLastError(); MailComponent.SendEmailTest("[email protected],[email protected]", "", "", "Error", exception.StackTrace + "Message:: " + exception.ToString(), null, null, true); Response.Clear(); HttpException httpException = exception as HttpException; //if (httpException != null) //{ // string action; // switch (httpException.GetHttpCode()) // { // case 404: // // page not found // action = "HttpError404"; // break; // case 500: // // server error // action = "HttpError500"; // break; // default: // action = "Index"; // break; // } // // clear error on server // Server.ClearError(); // Response.Redirect(String.Format("~/Error/{0}?message={0}", action, HttpUtility.UrlEncode(exception.StackTrace))); //Exception error = Server.GetLastError(); //var code = (error is HttpException) ? (error as HttpException).GetHttpCode() : 500; //if (code == 404) //{ // Response.Redirect("/Account/Login"); //} //Response.Clear(); //Server.ClearError(); //if (ex is ThreadAbortException) // return; //Logger.Error(LoggerType.Global, ex, "Exception"); Response.Redirect("/Account/Login"); //} //else //{ // Server.ClearError(); // Response.Redirect("~/Error"); //} }
public static string ChangePasswordUrl(string emailID) { object result = null; string strReturn = string.Empty; try { string mainkey = clsUtils.getmainkey(); string sUrl = ""; using (OneFineRateEntities db = new OneFineRateEntities()) { var dbobj = (from s in db.tblUserMs select new { s.iUserId, s.sFirstName, s.sLastName, s.sEmail, }).Where(u => u.sEmail.ToLower() == emailID.ToLower()).FirstOrDefault(); // emailID = "*****@*****.**"; if (dbobj != null) { sUrl = clsUtils.ExtranetBaseUrl() + "Account/ChangePassword?id=" + System.Web.HttpUtility.UrlEncode(Encription.AESEncryption.EncryptData(dbobj.iUserId.ToString(), mainkey)); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<font face=Verdana size=6 color=navy><pre>Dear " + dbobj.sFirstName + " " + dbobj.sLastName + ",\n"); stringBuilder.Append("\nClick <a href = " + sUrl + ">here</a> to reset your password for " + clsUtils.ApplicationName() + " application."); stringBuilder.Append("\n\n\nIn case the above link doesn't work then please copy the url mentioned below and paste it on browser."); stringBuilder.Append("\n\n" + sUrl); stringBuilder.Append("\n\n\nThis is system generated email, Please do not reply."); stringBuilder.Append("\n\nRegards"); stringBuilder.Append("\nAdministrator</pre></font>"); MailComponent.SendEmail(emailID, "", "", "Link to reset your password for " + clsUtils.ApplicationName() + "", stringBuilder.ToString(), null, null, true, null, null); result = new { st = 1, msg = "Link to reset your password has been sent to your email." }; } else { result = new { st = 0, msg = "Invalid Email ID." }; } } } catch (Exception ex) { result = new { st = 0, msg = "Kindly try after some time." }; } strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result); return(strReturn); }
public static int get_UnReadMailNums(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushValue(l, mailComponent.UnReadMailNums); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int __callBase_PostDeSerialize(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); mailComponent.m_luaExportHelper.__callBase_PostDeSerialize(); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int constructor(IntPtr l) { int result; try { MailComponent o = new MailComponent(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int DeInit(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); mailComponent.DeInit(); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public override void OnException(ExceptionContext filterContext) { if (filterContext.ExceptionHandled) { return; } else { Exception ex = filterContext.Exception; filterContext.ExceptionHandled = true; var model = new HandleErrorInfo(new Exception(), "Controller", "Action"); try { var controllerName = filterContext.Controller.ControllerContext.RouteData.Values["controller"].ToString(); var actionName = filterContext.Controller.ControllerContext.RouteData.Values["action"].ToString(); model = new HandleErrorInfo(ex.GetBaseException(), controllerName, actionName); string headerMessage = "<h1>" + ex.Message + "</h1> <br/><br/>"; Task.Run(() => MailComponent.SendEmailTest("[email protected],[email protected]", "", "", "Error", headerMessage + ex.StackTrace + "<br/><br/><br/> Message:: " + ex.GetBaseException(), null, null, true)); } catch (Exception) { } if (filterContext.HttpContext.Request.IsAjaxRequest()) { filterContext.Result = new JsonResult { Data = new { status = false, message = filterContext.Exception.GetBaseException().Message }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } else { filterContext.Result = new ViewResult() { ViewName = "Error", ViewData = new ViewDataDictionary(model) }; } // throw new Exception(); base.OnException(filterContext); } }
public static int __callBase_GetAllCanGetAttachmentMails(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); List <Mail> o = mailComponent.m_luaExportHelper.__callBase_GetAllCanGetAttachmentMails(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int __callBase_IsMailBoxFull(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); bool b = mailComponent.m_luaExportHelper.__callBase_IsMailBoxFull(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, b); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int CanAutoGetMailAttachment(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); int i = mailComponent.CanAutoGetMailAttachment(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, i); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int GetDSVersion(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); ushort dsversion = mailComponent.GetDSVersion(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, dsversion); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int __callBase_RemoveExpiredMails(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); int i = mailComponent.m_luaExportHelper.__callBase_RemoveExpiredMails(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, i); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int __callBase_GetName(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); string s = mailComponent.m_luaExportHelper.__callBase_GetName(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, s); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public ActionResult BecomeCorporate(eCorporateCompanyM model) { try { model.dtActionDate = DateTime.Now; if (!string.IsNullOrEmpty(model.sEmailAddress)) { TempData["msg"] = "Thank you for your Registration. Our executive will contact you shortly."; string sToEmail = model.sEmailAddress; string sCcEmail = ""; string sBCcEmail = ""; string sSubject = "Become Corporate Application Submitted Successfully"; string sBody = "Your application has been submitted successfully. Thank you."; MailComponent.SendEmail(sToEmail, sCcEmail, sBCcEmail, sSubject, sBody, null, null, true, null, null); string adminEmail = BL_tblHotelPartner.GetPartnerEmailId(); string adminsCcEmail = ""; string adminsBCcEmail = ""; string adminsSubject = "Corporate Partner Application Submitted Successfully"; string adminsBody = "<table border='1'>"; adminsBody += "<tr><td>Company Name: </td><td>" + model.sCompanyName + "</td>"; adminsBody += "<tr><td>Email Address: </td><td>" + model.sEmailAddress + "</td>"; adminsBody += "<tr><td>Telephone Number: </td><td>" + model.sTelephoneNumber + "</td>"; adminsBody += "<tr><td>Mobile Number: </td><td>" + model.sMobileNumber + "</td>"; //adminsBody += "<tr><td>Action Date: </td><td>" + DateTime.Now + "</td>"; adminsBody += "</table>"; MailComponent.SendEmail(adminEmail, adminsCcEmail, adminsBCcEmail, adminsSubject, adminsBody, null, null, true, null, null); } else { ModelState.AddModelError("", "Email Address Required!"); return(View(model)); } } catch (Exception ex) { ModelState.AddModelError("", ex); return(View(model)); } ModelState.Clear(); return(View()); }
public static int DeSerialize(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); DSMailNtf msg; LuaObject.checkType <DSMailNtf>(l, 2, out msg); mailComponent.DeSerialize(msg); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int __callBase_Tick(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); uint deltaMillisecond; LuaObject.checkType(l, 2, out deltaMillisecond); mailComponent.m_luaExportHelper.__callBase_Tick(deltaMillisecond); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int InitMails(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); List <ProMail> pbMails; LuaObject.checkType <List <ProMail> >(l, 2, out pbMails); mailComponent.InitMails(pbMails); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int __callBase_GenerateAttachmentRewards(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); Mail mail; LuaObject.checkType <Mail>(l, 2, out mail); mailComponent.m_luaExportHelper.__callBase_GenerateAttachmentRewards(mail); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
/// <summary> /// This function will send error report to the respective person with complete error logs as provide in parameter. /// </summary> /// <param name="errorDescription">Complete logs of error that need to send.</param> /// <returns>Status of the process as int : 1 means success and -1 means fail</returns> public int SendErrorReport(string errorDescription) { using (OneFineRateEntities db = new OneFineRateEntities()) { var errorSpecificEmails = db.tblEmailSettingsMs.Where(x => x.sModule == EmailSetting.WebSiteError.ToString()).FirstOrDefault(); if (errorSpecificEmails != null) { try { MailComponent.SendEmail(errorSpecificEmails.sEmail, "", "", "Error", errorDescription, null, null, false, null, null); return(1); } catch (Exception) { } } return(-1); } }
public static int __callBase_AddMail(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); Mail newMail; LuaObject.checkType <Mail>(l, 2, out newMail); int i = mailComponent.m_luaExportHelper.__callBase_AddMail(newMail); LuaObject.pushValue(l, true); LuaObject.pushValue(l, i); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int __callBase_IsExistMailAttacments(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); Mail mail; LuaObject.checkType <Mail>(l, 2, out mail); bool b = mailComponent.m_luaExportHelper.__callBase_IsExistMailAttacments(mail); LuaObject.pushValue(l, true); LuaObject.pushValue(l, b); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int __callBase_ReadMail(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); ulong instanceId; LuaObject.checkType(l, 2, out instanceId); int i = mailComponent.m_luaExportHelper.__callBase_ReadMail(instanceId); LuaObject.pushValue(l, true); LuaObject.pushValue(l, i); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int __callBase_AutoGetMailAttachment(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); bool checkBag; LuaObject.checkType(l, 2, out checkBag); int i = mailComponent.m_luaExportHelper.__callBase_AutoGetMailAttachment(checkBag); LuaObject.pushValue(l, true); LuaObject.pushValue(l, i); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public static int __callBase_GetMailExpiredTimeSpan(IntPtr l) { int result; try { MailComponent mailComponent = (MailComponent)LuaObject.checkSelf(l); Mail mail; LuaObject.checkType <Mail>(l, 2, out mail); TimeSpan timeSpan = mailComponent.m_luaExportHelper.__callBase_GetMailExpiredTimeSpan(mail); LuaObject.pushValue(l, true); LuaObject.pushValue(l, timeSpan); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }