public ActionResult CreateOrder(User_Order_House order) { var lastOrder = db.User_Order_House.OrderByDescending(o => o.Id).FirstOrDefault(); if (lastOrder != null) { order.Id = lastOrder.Id + 1; } else { order.Id = 1; } order.Real = db.Reals.Where(r => r.ID == order.RealID).FirstOrDefault(); order.GIUser = db.GIUsers.Where(u => u.Id == order.UserID).FirstOrDefault(); db.User_Order_House.Add(order); try { db.SaveChanges(); } catch (Exception) { throw; } return RedirectToAction("Search"); }
public void sendEmail(Firm firm, User_Order_House order, DateTime time) { GMailer.GmailUsername = "******"; GMailer.GmailPassword = "******"; GMailer mailer = new GMailer(); mailer.ToEmail = firm.Email; mailer.Subject = "Referral Contract from Sky Limit Property LLC"; mailer.Body = String.Format( "<div style='background-color:#FBF8EF;padding:30px;border-style:solid;border-width:1px;border-color:black;max-width:800px;margin-left:auto;margin-right:auto;'>" + "<h2 style='text-align:center;'>R E F E R R A L -- C O N T R A C T</h1>" + "<p style='text-align:right;'>Referring Date: {0}</p>" + "<p>Referring (Source) Broker/Agent NAME: Yanlong Xu</p>" + "<p>COMPANY: Sky Limit Property LLC</p>" + "<p>BUSINESS ADDRESS: 101 World Trade Center</p>" + "<p>BUSINESS CITY: Jersey City</p>" + "<div style='display:table;'><div style='display:table-row;'><div style='display:table-cell;width:400px;'>" + "STATE/REGION/PROVINCE: NJ" + "</div><div style='display:table-cell;width:400px;'>" + "POSTAL CODE: 07059" + "</div></div></div>" + "<p>COMPANY COUNTRY: United States of America</p>" + "<p>E-MAIL ADDRESS: [email protected]</p>" + "<p>WEB SITE: www.skylimitproperty.com</p>" + "<div style='display:table;'><div style='display:table-row;'><div style='display:table-cell;width:400px;'>" + "FAX:" + "</div><div style='display:table-cell;width:400px;'>" + "PHONE:" + "</div></div></div>" + "<hr />" + "<p><b>Receiving Broker/Agent</b></p>" + "<p>COMPANY: {1}</p>" + "<p>BUSINESS ADDRESS: {2}</p>" + "<p>BUSINESS CITY: {3}</p>" + "<div style='display:table;'><div style='display:table-row;'><div style='display:table-cell;width:400px;'>" + "STATE/REGION/PROVINCE: {4}" + "</div><div style='display:table-cell;width:400px;'>" + "POSTAL CODE: {5}" + "</div></div></div>" + "<p>COMPANY COUNTRY: {6}</p>" + "<p>E-MAIL ADDRESS: {7}</p>" + "<p>WEB SITE: {8}</p>" + "<div style='display:table;'><div style='display:table-row;'><div style='display:table-cell;width:400px;'>" + "FAX: {9}" + "</div><div style='display:table-cell;width:400px;'>" + "PHONE: {10}" + "</div></div></div>" + "<hr />" + "<p><b>Client Information:</b></p>" + "<p>The client’s intention:: {13}</p>" + "<p>Does this client own other real property Yes/No in the state of NJ?: {14}</p>" + "<p>NAME: {15}</p>" + "<p>ADDRESS: {16}</p>" + "<p>CITY: {17}</p>" + "<p>STATE/REGION/PROVINCE: {11}</p>" + "<p>POSTAL CODE: {12}</p>" + "<p>E-MAIL ADDRESS: {18}</p>" + "<p>PHONE : {19}</p>" + "<hr />" + "<p>In the event Receiving Broker/Agent receives a commission or other payment for services rendered in connection with a real estate transaction consummated involving the Referred Client within 20 business days this Referral Contract is entered into (both parties have signed), Referring Broker/Agent will be entitled to a referral fee*, and Receiving Broker/Agent agrees to pay said referral fee, in the amount of: or o ___1.00%___percent of the o sale price, or o lease commission that Receiving Broker/Agent receives in connection with the foregoing. The parties hereby agree that the referral fee shall be fully paid by the Receiving Broker/Agent no later than 22 business days after the transaction is completed.</p>" + "<p>*Referral fees may be subject to withholding tax or other forms of taxes in the country in which the transaction takes place. Referring agents should be aware of state, provincial, or local laws in their respective markets with regards to paying referrals.</p>" + "<p>This contract will expire on _two years after the date (date). If both parties want to cooperate after the expiration date, they will have to execute a new referral contract.</p>" + "</div>", time.ToString(), firm.Name, firm.Address, firm.City, firm.State, firm.PostalCode, firm.Country, firm.Email, firm.Website, firm.Fax, firm.Phone, order.Real.USAState.StateNameEng, order.Real.Zipcode, order.Intention, (order.GIUser.HouseProperties.Where(h => h.address.Contains("NJ")).FirstOrDefault() != null), order.Fullname, order.Real.Address, order.Real.County1.Name, order.Email, order.Phone); mailer.IsHtml = true; mailer.Send(); mailer.ToEmail = "*****@*****.**";// mailer.Subject = "Copy of the Contract with " + firm.Name + " Agent"; //mailer.Send(); }