/// <summary> /// Create a new WebsiteOrder object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="websiteId">Initial value of the WebsiteId property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="date">Initial value of the Date property.</param> /// <param name="status">Initial value of the Status property.</param> /// <param name="amount">Initial value of the Amount property.</param> /// <param name="buyingId">Initial value of the BuyingId property.</param> /// <param name="moneyStatus">Initial value of the MoneyStatus property.</param> public static WebsiteOrder CreateWebsiteOrder(global::System.Int32 id, global::System.Int32 websiteId, global::System.String name, global::System.DateTime date, global::System.Int32 status, global::System.Int32 amount, global::System.String buyingId, global::System.Int32 moneyStatus) { WebsiteOrder websiteOrder = new WebsiteOrder(); websiteOrder.Id = id; websiteOrder.WebsiteId = websiteId; websiteOrder.Name = name; websiteOrder.Date = date; websiteOrder.Status = status; websiteOrder.Amount = amount; websiteOrder.BuyingId = buyingId; websiteOrder.MoneyStatus = moneyStatus; return websiteOrder; }
/// <summary> /// Deprecated Method for adding a new object to the WebsiteOrders EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToWebsiteOrders(WebsiteOrder websiteOrder) { base.AddObject("WebsiteOrders", websiteOrder); }
public ActionResult postmessage(string message, string buyingcode, string[] webmaster, string[] moneypacific, string[] customer) { string userlogin = User.Identity.Name; var checkit1 = from c in db.BuyCustomers where c.BuyingId == userlogin select c; var checkit2 = from b in db.Webmasters where b.Username == userlogin select b; var checkit3 = from a in db.MPAdmins where a.Username == userlogin select a; if (!string.IsNullOrEmpty(message)) { Message p = new Message(); HttpPostedFileBase _file = Request.Files["file"]; if (_file.FileName != "") { if (_file.ContentLength > 0) { string filename = _file.FileName.Replace(" ", "_"); string filePath = Path.Combine(HttpContext.Server.MapPath("/Content/File/"), Path.GetFileName(filename)); _file.SaveAs(filePath); p.AttachFile = "/Content/File/" + _file.FileName.Replace(" ", "_"); } } p.Message1 = message; WebsiteOrder weborder = new WebsiteOrder(); Webmaster master = new Webmaster(); if (checkit1.Count() == 1) { p.Sender = 0; // Khach hang post //gui email cho webmaster. weborder = db.WebsiteOrders.Single(w => w.BuyingId == buyingcode); master = db.Webmasters.Single(w=>w.Id == weborder.Website.WebmasterId); //send email to webmaster string emailcontent = "Hi!<br/><br/>"; emailcontent += "The customer sent you the message.<br/><br/>"; emailcontent += "<b>Content:</b>"+message+"<br/><br/>"; emailcontent += "See you on Money Pacific. Com"; if (!string.IsNullOrEmpty(master.NotificationNewMessage)) { try { MPMail.SendMail(ConfigurationManager.AppSettings["MailSender"], master.NotificationNewMessage, "", "", "New Message from Customer", emailcontent); } catch (Exception e) { } } else try { MPMail.SendMail(ConfigurationManager.AppSettings["MailSender"], master.Email, "", "", "New Message from Customer", emailcontent); } catch (Exception e) { } } else if (checkit2.Count() == 1) { p.Sender = 1;// webmaster post } else if (checkit3.Count() == 1)//admin post { p.Sender = 2; } p.DateSend = DateTime.Now; p.UserId = buyingcode; p.IsClose = false; string postTo = ""; if (customer != null) { p.ToCustomer = true; postTo = buyingcode+" "; } else { p.ToCustomer = false; } if (webmaster != null) { p.ToWebmaster = true; postTo += master.Username + " "; } else p.ToWebmaster = false; if (moneypacific != null) { p.ToMPAdmin = true; postTo += "Money Pacific Admin"; } else p.ToMPAdmin = false; db.Messages.AddObject(p); db.SaveChanges(); TransactionLogViewModel.AddLog(userlogin +" has just posted the message to:"+postTo+" on Pacific Manager!", DateTime.Now); } return RedirectToAction("follow", new { id=buyingcode}); }