public string InitPP(Orders.NewUser order) { NewInvoice x = new NewInvoice(); x.id = null; x.number = GetNextOrderNumber(DateTime.Now.Year); x.fileName = null; x.orderNumber = order.id; x.dateAndTime = DateTime.Now.ToString("dd.MM.yyyy, HH:mm"); x.year = DateTime.Now.Year; x.firstName = order.firstName; x.lastName = order.lastName; x.companyName = order.companyName; x.address = order.address; x.postalCode = order.postalCode; x.city = order.city; x.country = order.country; x.pin = order.pin; x.note = null; x.items = GetItems(order); x.total = 0; x.isPaid = false; x.paidAmount = 0; x.paidDate = null; x.restToPaid = 0; string json = JsonConvert.SerializeObject(x, Formatting.None); return(json); }
private List <Item> GetItems(Orders.NewUser order) { Item x = new Item(); x.title = string.Format("{0} {1}", order.application, order.version); x.qty = Convert.ToInt32(order.licenceNumber); x.unitPrice = order.price; List <Item> xx = new List <Item>(); xx.Add(x); return(xx); }
public bool SendOrder(Orders.NewUser user, string lang) { bool sent = false; //*****************Send mail to me**************** string messageSubject = "Nova narudžba"; string messageBody = string.Format( @" <h3>Nova Narudžba:</h3> <p>Ime i prezime: {0} {1},</p> <p>Tvrtka: {2}</p> <p>Ulica i broj: {3}</p> <p>Poštanski broj: {4}</p> <p>Grad: {5}</p> <p>Država: {6}</p> <p>OIB: {7}</p> <p>Email: {8}</p> <p>Verzija: {9} {10}</p> <p>Licenca: {11} ({12})</p>" , user.firstName , user.lastName , user.companyName , user.address , user.postalCode , user.city , user.country , user.pin , user.email , user.application , user.version , user.licenceNumber , GetLicenceDuration(user.licence)); bool sentToMe = SendMail(myEmail, messageSubject, messageBody, lang, null, true); //************************************************** //************ Send mail to customer**************** messageSubject = (user.application == "Program Prehrane 5.0" ? user.application : t.Tran("nutrition program web", lang)) + " - " + t.Tran("payment details", lang); messageBody = PaymentDetails(user, lang); bool sentToCustomer = SendMail(user.email, messageSubject, messageBody, lang, null, false); //************************************************** if (sentToMe == false || sentToCustomer == false) { sent = false; } else { sent = true; } return(sent); }
private string PaymentDetails(Orders.NewUser user, string lang) { switch (lang) { case "en": return (string.Format( @" <p>{0},</p> <p>{1} <b>{2} {3}</b>.</p> <p>{4}: <a href=""mailto:[email protected]"">[email protected]</a></p> <br /> <b>{5}:</b> <hr/> <p>IBAN: HR84 2340 0091 1603 4249 6</p> <p>SWIFT CODE: PBZGHR2X</p> <p>{6}: Privredna banka Zagreb d.d., Račkoga 6, 10000 Zagreb, {7}</p> <p>{8}: IG PROG, vl. Igor Gasparovic</p> <p>{9}: Ludvetov breg 5, 51000 Rijeka, {7}</p> <p>{10}: {2} {3}</p> <p>{11}: <b>{12} {13}</b></p> <hr/> <a href=""https://www.nutriprog.com/paypal.html""><img alt=""PayPal"" src=""https://www.nutriprog.com/assets/img/paypal.jpg""></a> <hr/> <br /> <br /> <p>{14}</p> <br />" , t.Tran("dear", lang) , t.Tran("thank you for your interest in", lang) , user.application , user.version , t.Tran("your account will be active within 24 hours of your payment receipt or after you send us a payment confirmation to email", lang) , t.Tran("payment details", lang) , t.Tran("bank", lang) , t.Tran("croatia", lang) , t.Tran("recipient", lang) , "Address" , t.Tran("payment description", lang) , t.Tran("amount", lang) , Math.Round(user.price / usd, 2) , "$" , t.Tran("best regards", lang))); default: return (string.Format( @" <p>Poštovani/a,</p> <p>Zahvaljujemo na Vašem interesu za <b>{0} {1}</b>.</p> <p>{6}.</p> <br /> <b>Podaci za uplatu:</b> <hr/> <p>IBAN: HR84 2340 0091 1603 4249 6</p> <p>Banka: Privredna banka Zagreb d.d., Račkoga 6, 10000 Zagreb, Hrvatska</p> <p>Primatelj: IG PROG, vl. Igor Gašparović</p> <p>Adresa: Ludvetov breg 5, 51000 Rijeka, Hrvatska</p> <p>Opis plaćanja: {0} {1}</p> <p>Iznos: <b>{2} kn</b></p> <p>Model: {5}</p> <p>{3}</p> <hr/> <br /> {7} <p>Srdačan pozdrav</p> <br />" , user.application , user.version , user.price , string.IsNullOrWhiteSpace(user.pin) ? "" : string.Format("Poziv na broj: {0}", user.pin) , Math.Round(user.priceEur, 2) , string.IsNullOrWhiteSpace(user.pin) ? "HR99" : "HR00" , user.application == "Program Prehrane 5.0" ? "Nakon primitka Vaše uplate ili nakon što nam pošaljete potvrdu o uplati, aktivacijski kod šaljemo na Vašu E-mail adresu" : "Aplikacija će biti aktivna nakon primitka Vaše uplate ili nakon što nam pošaljete potvrdu o uplati" , !user.country.ToLower().StartsWith("hr") && !user.country.ToLower().StartsWith("cr") ? string.Format(@" <b>Podaci za uplatu izvan Hrvatske:</b> <hr/> <p>IBAN: HR84 2340 0091 1603 4249 6</p> <p>SWIFT CODE: PBZGHR2X</p> <p>Iznos: <b>{0} €</b></p> <a href=""https://www.programprehrane.com/paypal.html""><img alt=""PayPal"" src=""https://www.programprehrane.com/assets/img/paypal.jpg""></a> <hr/> <br />", Math.Round(user.priceEur, 2)) : "")); } }