//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(); }
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); } } }