コード例 #1
0
ファイル: RecyclingCenter.cs プロジェクト: AlexFolland/CivOne
 public RecyclingCenter() : base(20, 2)
 {
     Name         = "Recycling Cntr.";
     RequiredTech = new Recycling();
     SetIcon(4, 0, true);
     SetSmallIcon(3, 2);
     Type = Building.RecyclingCenter;
 }
コード例 #2
0
        public ActionResult Create(Recycling recycling)
        {
            if (ModelState.IsValid)
            {
                SendEmail(recycling);
                return(View("GetAQuote"));
            }

            return(View("GetAQuote"));
        }
コード例 #3
0
        public void SendEmail(Recycling obj)
        {
            try
            {
                string      ReadFileName = "";
                MailMessage mail         = new MailMessage();

                // mail.To.Add(obj.Email);
                mail.To.Add("*****@*****.**");

                mail.Bcc.Add("*****@*****.**");
                //mail.Bcc.Add("*****@*****.**");
                mail.From = new MailAddress("*****@*****.**");
                //mail.Subject = obj.Subject;

                mail.Subject = "Recycling - Get a Quote";

                mail.IsBodyHtml = true;
                string PathVal = Server.MapPath("~");

                ReadFileName = PathVal + "/mail/Recycling_GetAQuote.htm";

                string       strMessage = "";
                StreamReader sr1        = new StreamReader(ReadFileName);

                strMessage = sr1.ReadToEnd();

                strMessage = strMessage.Replace("XXXTypeofUnit", obj.Typeofunit);
                strMessage = strMessage.Replace("XXXEstimatedLigthship", obj.EstimatedLigthship);
                strMessage = strMessage.Replace("XXXLocation", obj.Location);
                strMessage = strMessage.Replace("XXXLaidUp", obj.LaidUp);

                strMessage = strMessage.Replace("XXXStatus", obj.Status);
                strMessage = strMessage.Replace("XXXDeliveryLaycan", obj.DeliveryLaycan);
                strMessage = strMessage.Replace("XXXDimensions", obj.Dimensions);
                strMessage = strMessage.Replace("XXXHKC", obj.HKC);

                mail.Body = strMessage;
                sr1.Close();

                SmtpClient emailClient = new SmtpClient();
                emailClient.Credentials = new NetworkCredential("*****@*****.**", "d&m3#BR8");
                emailClient.Port        = 587;
                emailClient.Host        = "smtp.gmail.com";
                emailClient.EnableSsl   = true;
                emailClient.Send(mail);

                ModelState.Clear();
                ViewBag.Message = "Your enquiry has been submitted successfully.";
            }
            catch (Exception ex)
            {
                ViewBag.ErrMessage = "Problem while sending email, Please check details.";
            }
        }
コード例 #4
0
 private void OnRecycling()
 {
     Recycling?.Invoke(this, new EventArgs());
 }