//protected void btnSaveChanges_Click(object sender, EventArgs e) //{ // if (this.IsNotRefresh) // { // int agegroupId = int.Parse(this.hdnSelectedAgeGroupID.Value.Trim()); // if (Page.IsValid) // { // this.ProcessForm(agegroupId, false); // Response.Redirect("/ViewAgeGroups.aspx"); // } // ViewState["IsPageValied"] = (Page.IsValid); // } //} //protected void btnDelete_Click(object sender, EventArgs e) //{ // int agegroupId = int.Parse(this.hdnSelectedAgeGroupID.Value.Trim()); // if (!Page.IsValid) // { // this.ProcessForm(agegroupId, true); // this.PopulateDataGrid(); // } // ViewState["IsPageValied"] = (Page.IsValid); // ViewState["IsPageValied"] = true; // this.validationSummary.Visible = !(Page.IsValid); //} //protected void dataGridAgeGroup_PageIndexChanged(object source, DataGridPageChangedEventArgs e) //{ // // Set page index // this.dataGridAgeGroup.CurrentPageIndex = e.NewPageIndex; // this.PopulateDataGrid(); //} //protected void dataGridAgeGroup_SortCommand(object source, DataGridSortCommandEventArgs e) //{ // string sortDirection = String.Empty; // if (!SortExpression.ToUpper().StartsWith(e.SortExpression) && !SortExpression.ToUpper().Trim().EndsWith("ASC")) // { // sortDirection = " asc"; // } // else // { // sortDirection = (SortExpression.ToUpper().EndsWith("DESC")) ? " asc" : " desc"; // } // this.SortExpression = e.SortExpression + sortDirection; // this.PopulateDataGrid(); // foreach (DataGridColumn col in this.dataGridAgeGroup.Columns) // { // if (col.Visible && col.SortExpression == e.SortExpression) // { // col.HeaderStyle.CssClass = "selected " + ((sortDirection.ToUpper() != " DESC") ? "sortDown" : "sortUp"); // } // else // { // col.HeaderStyle.CssClass = ""; // } // } //} protected void btnSendMail_Click(object sender, EventArgs e) { try { TextBox txtCoordinatorEmail = (TextBox)((LinkButton)(sender)).FindControl("txtCoordinatorEmail"); TextBox txtDistributorEmail = (TextBox)((LinkButton)(sender)).FindControl("txtDistributorEmail"); HiddenField hdnWeekLyID = (HiddenField)((LinkButton)(sender)).FindControl("hdnWeekLyID"); HiddenField hdnSendMail = (HiddenField)((LinkButton)(sender)).FindControl("hdnSendMail"); int distributor = int.Parse(((System.Web.UI.WebControls.WebControl)(sender)).Attributes["did"].ToString()); DateTime WeekendDate = DateTime.Parse(((System.Web.UI.WebControls.WebControl)(sender)).Attributes["wdate"].ToString()); if (!string.IsNullOrEmpty(txtCoordinatorEmail.Text) && !string.IsNullOrEmpty(txtDistributorEmail.Text) && distributor > 0 && WeekendDate != null) { string pdfFilePath = Common.GenerateOdsPdf.GenerateBackOrder(WeekendDate, distributor); string[] pdfPath = new string[] { pdfFilePath }; IndicoEmail.SendMail(this.LoggedCompany.Name, this.LoggedUser.EmailAddress, string.Empty, txtCoordinatorEmail.Text, txtDistributorEmail.Text, "Back Order Report", string.Empty, pdfPath, false, string.Empty); } int count = 0; using (TransactionScope ts = new TransactionScope()) { DistributorSendMailCountBO objSendMail = new DistributorSendMailCountBO(this.ObjContext); if (int.Parse(hdnSendMail.Value.ToString()) > 0) { objSendMail.ID = int.Parse(hdnSendMail.Value.ToString()); objSendMail.GetObject(); count = (int)objSendMail.Count; } objSendMail.Distributor = distributor; objSendMail.WeeklyProductionCapacity = int.Parse(hdnWeekLyID.Value.ToString()); count++; objSendMail.Count = count; this.ObjContext.SaveChanges(); ts.Complete(); } } catch (Exception ex) { IndicoLogging.log.Error("Error occured while sending email to the coordinator and distributor feom ViewBackOrders.aspx page", ex); } this.PopulateDataGrid(); }
private void SendEmail() { try { string reciveremail = this.LoggedCompany.objOwner.EmailAddress; string recivername = this.LoggedCompany.objOwner.GivenName; string hostUrl = IndicoConfiguration.AppConfiguration.SiteHostAddress + "/"; string emailContent = "New Reservation has been placed"; IndicoEmail.SendMailNotificationsToExternalUsers(this.LoggedUser, reciveremail, recivername, "New Reservation has been placed", emailContent); } catch (Exception ex) { IndicoLogging.log.Error("Error occured while send client order email", ex); } }
/// <summary> /// Process the page data. /// </summary> private void ProcessReset() { var lstUser = (from o in (new UserBO()).SearchObjects().AsQueryable().ToList <UserBO>() where o.EmailAddress == this.txtEmailAddress.Text.ToLower().Trim() select o).ToList(); if (lstUser.Count > 0) { UserBO objUser = new UserBO(this.ObjContext); string password = UserBO.GetNewRandomPassword(); using (TransactionScope ts = new TransactionScope()) { objUser.ID = lstUser[0].ID; objUser.GetObject(); objUser.Password = UserBO.GetNewEncryptedPassword(password); this.ObjContext.SaveChanges(); ts.Complete(); } UserBO objAdministrator = new UserBO(); objAdministrator.ID = (int)objUser.objCompany.Owner; objAdministrator.GetObject(); string hostUrl = IndicoConfiguration.AppConfiguration.SiteHostAddress + "/"; string emailContent = "<p>Your password has been changed. Please use the given password to login to your account. <br/>" + password + "</p>" + "<p>To complete your registration, simply click the link below to sign in.<br>" + "<a href=\"http://" + hostUrl + "Welcome.aspx?guid=" + objUser.Guid + "&id=" + objUser.ID + "\">http://" + hostUrl + "Welcome.aspx?guid=" + objUser.Guid + "&id=" + objUser.ID + "</a></p>"; IndicoEmail.SendMailNotifications(objAdministrator, objUser, "Request Password Change", emailContent); Response.Redirect("/Login.aspx"); } else { this.boxWarning.InnerText = "The email address is doesn't exist."; this.boxWarning.Visible = true; IndicoLogging.log.InfoFormat("Login.btnReset_Click() Reset password fail for email address {0} into host {1} with session id {2} from {3}", this.txtEmailAddress.Text.Trim(), Request.Url.Host, Session.SessionID, Request.UserHostAddress); Session.Abandon(); } }
protected void linkResend_Click(object sender, EventArgs e) { int user = int.Parse(((System.Web.UI.WebControls.WebControl)(sender)).Attributes["uid"]); if (user > 0) { UserBO objUser = new UserBO(); objUser.ID = user; objUser.GetObject(); string hostUrl = IndicoConfiguration.AppConfiguration.SiteHostAddress + "/"; string emailContent = "<p>A new user has been created. " + "<p>To complete your registration, simply click the link below.<br>" + "<a href=\"http://" + hostUrl + "Welcome.aspx?guid=" + objUser.Guid + "&id=" + objUser.ID + "\">http://" + hostUrl + "Welcome.aspx?guid=" + objUser.Guid + "&id=" + objUser.ID + "</a></p>"; IndicoEmail.SendMailNotifications(this.LoggedUser, objUser, "New user has been created", emailContent); } }
private void SendEmail() { try { string hosturl = IndicoConfiguration.AppConfiguration.SiteHostAddress + "/"; string emailcontent = String.Format("<p>A new acoount set up for u at <a href =\"http://{0}\">\"http://{0}/</a></p>" + "<p>To complete your registration simply clik the link below to sign in<br>" + "<a href=\"http://{0}Welcome.aspx?id={1}\">http://{0}Welcome.aspx?id={1}</a></p>", hosturl, createdClientId.ToString()); IndicoEmail.SendMailNotificationsToExternalUsers(this.LoggedUser, EmailAddress, FirstName, "Add New Client", emailcontent); //string hostUrl = IndicoConfiguration.AppConfiguration.SiteHostAddress + "/"; //string emailContent = "Welcome"; //IndicoEmail.SendMailNotificationsToExternalUsers(this.LoggedUser, EmailAddress, FirstName, "Add New Client", emailContent); } catch (Exception ex) { IndicoLogging.log.Error("Error occured while send client email", ex); } }
protected void lbResendMail_OnClick(object sender, EventArgs e) { int QuoteID = int.Parse(((System.Web.UI.WebControls.WebControl)(sender)).Attributes["qid"]); if (QuoteID > 0) { QuoteBO objQuote = new QuoteBO(); objQuote.ID = QuoteID; objQuote.GetObject(); try { string mailcc = string.Empty; List <QuoteChangeEmailListBO> lstQuoteChangeEmailListCC = (new QuoteChangeEmailListBO()).SearchObjects().Where(o => o.IsCC == true).ToList(); foreach (QuoteChangeEmailListBO ccList in lstQuoteChangeEmailListCC) { UserBO objUser = new UserBO(); objUser.ID = (int)ccList.User; objUser.GetObject(); mailcc += objUser.EmailAddress + ","; } //mailcc = "*****@*****.**"; //string emailContent = CheckQuotes.CreateQuoteDetailBody(objQuote); //string emailTemp = QuoteEmailTemplate; //string emailTemp = CheckQuotes.CreateQuoteDetailBody(objQuote); string emailTemp = GenerateOdsPdf.CreateQuoteDetail(objQuote); string emailLogoPath = string.Empty; string[] attachment = { GenerateOdsPdf.CreateQuoteDetailAttachments(QuoteID) }; /*if (!string.IsNullOrEmpty(objQuote.JobName)) * { * emailContent += " <tr>" + * "<td width=\"200\" style=\"border-left:0px; border-top:0; font-size:11px; font-family: Arial; background:#CAE8EA no-repeat; color:#000000; border-left:0px solid #ffffff; border-right:0px solid #ffffff; border-bottom:0px solid #ffffff; border-top:0px solid #ffffff; text-align:left; background:#fff \" scope=\"row\">" + "Job Name" + "</td>" + * "<td width=\"480\" style=\"border-right:0px solid #ffffff;font-size:11px; font-family: Arial; border-bottom:0px solid #ffffff; border-top:0px solid #ffffff; background:#fff; color:#000000\">" + objQuote.JobName + "</td>" + * "</tr>"; * } * * if (objQuote.Pattern != null && objQuote.Pattern > 0) * { * emailContent += " <tr>" + * "<td width=\"200\" style=\"border-left:0px; border-top:0; font-size:11px; font-family: Arial; background:#CAE8EA no-repeat; color:#000000; border-left:0px solid #ffffff; border-right:0px solid #ffffff; border-bottom:0px solid #ffffff; border-top:0px solid #ffffff; text-align:left; background:#fff \" scope=\"row\">" + "Item" + "</td>" + * "<td width=\"480\" style=\"border-right:0px solid #ffffff; font-size:11px; font-family: Arial; border-bottom:0px solid #ffffff; border-top:0px solid #ffffff; background:#fff; color:#000000\">" + objQuote.objPattern.Number + " " + objQuote.objPattern.NickName + "</td>" + * "</tr>"; * } * * if ((objQuote.IndimanPrice != null && objQuote.IndimanPrice > 0)) * { * string priceterm = (objQuote.PriceTerm != null && objQuote.PriceTerm > 0) ? objQuote.objPriceTerm.Name : string.Empty; * string currency = (objQuote.Currency != null && objQuote.Currency > 0) ? objQuote.objCurrency.Code : string.Empty; * emailContent += " <tr>" + * "<td width=\"200\" style=\"border-left:0px; border-top:0; font-size:11px; font-family: Arial; background:#CAE8EA no-repeat; color:#000000; border-left:0px solid #ffffff; border-right:0px solid #ffffff; border-bottom:0px solid #ffffff; border-top:0px solid #ffffff; text-align:left; background:#fff \" scope=\"row\">" + "Price" + "</td>" + * "<td width=\"480\" style=\"border-right:0px solid #ffffff; font-size:11px; font-family: Arial; border-bottom:0px solid #ffffff; border-top:0px solid #ffffff; background:#fff; color:#000000\">" + currency + " " + Convert.ToDecimal(objQuote.IndimanPrice).ToString("0.00") + " " + priceterm + "</td>" + * "</tr>"; * } * * if (objQuote.Qty != null) * { * emailContent += " <tr>" + * "<td width=\"200\" style=\"border-left:1px; border-top:0; font-size:11px; font-family: Arial; background:#CAE8EA no-repeat; color:#000000; border-left:0px solid #ffffff; border-right:0px solid #ffffff; border-bottom:0px solid #ffffff; border-top:0px solid #ffffff; text-align:left; background:#fff \" scope=\"row\">" + "Indicated Quantity" + "</td>" + * "<td width=\"480\" style=\"border-right:0px solid #ffffff; font-size:11px; font-family: Arial; border-bottom:0px solid #ffffff; border-top:0px solid #ffffff; background:#fff; color:#000000\">" + objQuote.Qty.ToString() + "</td>" + * "</tr>"; * } * * if (objQuote.DeliveryDate != null) * { * emailContent += " <tr>" + * "<td width=\"200\" style=\"border-left:0px; border-top:0; font-size:11px; font-family: Arial; background:#CAE8EA no-repeat; color:#000000; border-left:0px solid #ffffff; border-right:0px solid #ffffff; border-bottom:0px solid #ffffff; border-top:0px solid #ffffff; text-align:left; background:#fff \" scope=\"row\">" + "Approx. despatch date" + "</td>" + * "<td width=\"480\" style=\"border-right:0px solid #ffffff; font-size:11px; font-family: Arial; border-bottom:0px solid #ffffff; border-top:0px solid #ffffff; background:#fff; color:#000000\">" + Convert.ToDateTime(objQuote.DeliveryDate).ToString("dd MMMM yyyy") + "</td>" + * "</tr>"; * } * * if (objQuote.QuoteExpiryDate != null) * { * emailContent += " <tr>" + * " <td width=\"200\" style=\"border-left:0px; border-top:0; font-size:11px; font-family: Arial; background:#CAE8EA no-repeat; color:#000000; border-left:0px solid #ffffff; border-right:0px solid #ffffff; border-bottom:0px solid #ffffff; border-top:0px solid #ffffff; text-align:left; background:#fff \" scope=\"row\">" + "Expires On" + "</td>" + * " <td width=\"480\" style=\"border-right:0px solid #ffffff; font-size:11px; font-family: Arial; border-bottom:0px solid #ffffff; border-top:0px solid #ffffff; background:#fff; color:#000000\">" + Convert.ToDateTime(objQuote.QuoteExpiryDate).ToString("dd MMMM yyyy") + "</td>" + * " </tr>"; * } * * if (!string.IsNullOrEmpty(objQuote.Notes)) * { * emailContent += " <tr>" + * "<td width=\"200\" style=\"border-left:1px; border-top:0; font-size:11px; font-family: Arial; background:#CAE8EA no-repeat; color:#000000; border-left:0px solid #ffffff; border-right:0px solid #ffffff; border-bottom:0px solid #ffffff; border-top:0px solid #ffffff; text-align:left; background:#fff \" scope=\"row\">" + "Notes" + "</td>" + * "<td width=\"480\" style=\"border-right:0px solid #ffffff; font-size:11px; font-family: Arial; border-bottom:0px solid #ffffff; border-top:0px solid #ffffff; background:#fff; color:#000000\">" + objQuote.Notes + "</td>" + * "</tr>"; * } * * if (objQuote.Distributor != null && objQuote.Distributor > 0) * { * emailContent += " <tr>" + * "<td width=\"200\" style=\"border-left:1px; border-top:0; font-size:11px; font-family: Arial; background:#CAE8EA no-repeat; color:#000000; border-left:0px solid #ffffff; border-right:0px solid #ffffff; border-bottom:0px solid #C1DAD7; border-top:0px solid #ffffff; text-align:left; background:#fff \" scope=\"row\">" + "Distributor" + "</td>" + * "<td width=\"480\" style=\"border-right:0px solid #ffffff; font-size:11px; font-family: Arial; border-bottom:0px solid #ffffff; border-top:0px solid #ffffff; background:#fff; color:#000000\">" + objQuote.objDistributor.Name + "</td>" + * "</tr>"; * } * * * emailTemp = emailTemp.Replace("<$tabledata$>", emailContent); * emailTemp = emailTemp.Replace("<$contactname$>", objQuote.ContactName); * string designation = (!string.IsNullOrEmpty(LoggedUser.Designation)) ? (" | " + LoggedUser.Designation) : string.Empty; * emailTemp = emailTemp.Replace("<$name$>", LoggedUser.GivenName + " " + LoggedUser.FamilyName + "" + designation); * emailTemp = emailTemp.Replace(" <$email$>", LoggedUser.EmailAddress); * emailTemp = emailTemp.Replace(" <$phone$>", LoggedUser.OfficeTelephoneNumber); * emailTemp = emailTemp.Replace("<$Mobile$>", (LoggedUser.MobileTelephoneNumber != null && !string.IsNullOrEmpty(LoggedUser.MobileTelephoneNumber)) ? LoggedUser.MobileTelephoneNumber : string.Empty); * emailTemp = emailTemp.Replace("<$fax$>", LoggedUser.objCompany.Fax); * * EmailLogoBO objEmailLogo = new EmailLogoBO().SearchObjects().SingleOrDefault(); * * if (objEmailLogo != null) * { * emailLogoPath = IndicoConfiguration.AppConfiguration.DataFolderName + "/EmailLogos/" + objEmailLogo.EmailLogoPath; * * if (!File.Exists(Server.MapPath(emailLogoPath))) * { * emailLogoPath = IndicoConfiguration.AppConfiguration.DataFolderName + "/EmailLogos/logo_login.png"; * } * } * else * { * emailLogoPath = IndicoConfiguration.AppConfiguration.DataFolderName + "/EmailLogos/logo_login.png"; * } * * System.Drawing.Image emailImage = System.Drawing.Image.FromFile(Server.MapPath(emailLogoPath)); * SizeF emailLogo = emailImage.PhysicalDimension; * emailImage.Dispose(); * * List<float> lstVLImageDimensions = (new ImageProcess()).GetResizedImageDimensionForHeight(Convert.ToInt32(Math.Abs(emailLogo.Width)), Convert.ToInt32(Math.Abs(emailLogo.Height)), 110); * * emailLogoPath = "http://" + IndicoConfiguration.AppConfiguration.SiteHostAddress + "/" + emailLogoPath; * emailTemp = emailTemp.Replace("<$logoimage$>", "<img src=\"" + emailLogoPath + "\" height=\"" + lstVLImageDimensions[0].ToString() + "\" width=\"" + lstVLImageDimensions[1].ToString() + "\"/>"); * */ if (!string.IsNullOrEmpty(mailcc)) { //GenerateOdsPdf.GenerateQuoteDetail(QuoteID); mailcc += LoggedUser.EmailAddress + ","; IndicoEmail.SendMail(LoggedUser.GivenName + " " + LoggedUser.FamilyName, LoggedUser.EmailAddress, objQuote.ContactName, objQuote.ClientEmail, mailcc, "Quote: QT" + " - " + QuoteID, null, attachment, false, emailTemp); } } catch (Exception ex) { IndicoLogging.log.Error("Errour occured while send resend quote mail from ViewQuotes.aspx page", ex); } } }