Beispiel #1
0
        public ActionResult MailSetting(MailSetting model, string txtpassword)
        {
            var record = MailManager.GetMailSettings();

            if (record == null)
            {
                ViewBag.nullsetting    = true;
                model.Password         = txtpassword;
                ViewBag.ProcessMessage = MailManager.AddSetting(model);
                return(View(model));
            }
            else
            {
                if (!string.IsNullOrEmpty(txtpassword))
                {
                    model.Password = txtpassword;
                }

                ViewBag.nullsetting    = false;
                model.MailSettingId    = record.MailSettingId;
                ViewBag.ProcessMessage = MailManager.EditSetting(model);
            }
            ////            record.TypeId = Convert.ToInt32(EnumInstituionalTypes.Misyon);
            //ViewBag.ProcessMessage = MailManager.AddMailUsers(model);
            //ModelState.Clear();
            return(View());
        }
Beispiel #2
0
        public string SendMail(string dialogName, string contactSurnameDialog, string contactNameFriend, string contactSurFriend, string contactEmailDialog, string contactEmailFriend, string contactMessagefriend, string ilanadi, string ilanUrl)
        {
            //try
            //{
            var mset  = MailManager.GetMailSettings();
            var msend = MailManager.GetMailUsersList(0);

            using (var client = new SmtpClient(mset.ServerHost, mset.Port))
            {
                client.EnableSsl   = mset.Security;  //burası düzeltilecek
                client.Credentials = new NetworkCredential(mset.ServerMail, mset.Password);
                var mail = new MailMessage();
                mail.From = new MailAddress(contactEmailDialog);
                mail.To.Add(contactEmailFriend);
                if (lang == "tr")
                {
                    mail.Subject = "Venueİstanbul İlan Tavsiyesi";
                    string maiilContent = "İLAN ADI: " + ilanadi;
                    maiilContent += "<br/> İLAN LİNKİ :" + ilanUrl;
                    maiilContent += "<br/><br/>" + contactMessagefriend;
                    mail.Body     = maiilContent;
                }
                else
                {
                    mail.Subject = "Venueİstanbul Advice Annoucement ";
                    string maiilContent = "Annoucement Name: " + ilanadi;
                    maiilContent += "<br/> Annoucement Url :" + ilanUrl;
                    maiilContent += "<br/><br/>" + contactMessagefriend;
                    mail.Body     = maiilContent;
                }
                mail.IsBodyHtml = true;



                if (mail.To.Count > 0)
                {
                    client.Send(mail);
                }
            }
            TempData["sent"] = "true";
            if (lang == "tr")
            {
                return("Mail başarıyla Gönderildi");
            }
            else
            {
                return("Mail has sendt succesfully");
            }
            //}
            //catch (Exception ex)
            //{
            //    if (lang == "tr") return "Hata Oluştu";
            //    else return "An error has been occured";
            //}
        }
Beispiel #3
0
        public ActionResult Index(HttpPostedFileBase uploadfile, string positionname, int positionId)
        {
            Random random       = new Random();
            int    rand         = random.Next(1000, 99999999);
            string targetFolder = Server.MapPath("~/Content/images/userfiles/humanresources");
            string targetPath   = Path.Combine(targetFolder, rand + "_" + uploadfile.FileName);

            uploadfile.SaveAs(targetPath);

            HumanResourceCv hrcv = new HumanResourceCv();

            hrcv.FileUrl = "/Content/images/userfiles/humanresources/" + rand + "_" + uploadfile.FileName;
            hrcv.HumanResourcePositionId = positionId;
            HumanResourceManager.AddHumanResourceCv(hrcv);

            var mset  = MailManager.GetMailSettings();
            var msend = MailManager.GetMailUsersList(0);

            using (var client = new SmtpClient(mset.ServerHost, mset.Port))
            {
                client.EnableSsl = mset.Security;//true;//burası düzeltilecek
                //client.DeliveryMethod = SmtpDeliveryMethod.Network;
                client.UseDefaultCredentials = false;
                client.Credentials           = new NetworkCredential(mset.ServerMail, mset.Password);

                var mail = new MailMessage();
                mail.From = new MailAddress(mset.ServerMail, "Zeynel Yayla");

                mail.Attachments.Add(new Attachment(@targetFolder + "/" + rand + "_" + uploadfile.FileName));

                foreach (var item in msend)
                {
                    mail.To.Add(item.MailAddress);
                }
                mail.Subject    = "Yeni CV";
                mail.IsBodyHtml = true;
                mail.Body       = "<p> Merhaba \"Zeynel Yayla\" üzerinden " + positionname + " pozisyonu için yeni bir CV gönderildi. <br> CV'yi mail ekinde bulabilirsiniz..</p>";
                //ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
                if (mail.To.Count > 0)
                {
                    client.Send(mail);
                }
            }
            TempData["sent"] = "true";

            var model = HumanResourceManager.GetHumanResourcePositionList();

            return(View(model));
        }
Beispiel #4
0
        public ActionResult MailSetting()
        {
            var model = MailManager.GetMailSettings();

            if (model != null)
            {
                ViewBag.nullsetting = true;
                return(View(model));
            }
            else
            {
                ViewBag.nullsetting = false;
                return(View());
            }
        }
Beispiel #5
0
        public ActionResult SendCV(HttpPostedFileBase attachedfile)
        {
            try
            {
                var mset  = MailManager.GetMailSettings();
                var msend = MailManager.GetMailUsersList(0);

                using (var client = new SmtpClient(mset.ServerHost, mset.Port))
                {
                    client.EnableSsl   = mset.Security;//burası düzeltilecek
                    client.Credentials = new NetworkCredential(mset.ServerMail, mset.Password);
                    var mail = new MailMessage();
                    mail.From = new MailAddress(mset.ServerMail);
                    foreach (var item in msend)
                    {
                        mail.To.Add(item.MailAddress);
                    }
                    mail.Subject    = "Yeni CV İletisi";
                    mail.IsBodyHtml = true;
                    mail.Body       = "Yeni bir iş başvurusu bulunmaktadır. Gönderen kişinin cv'si ektedir.";
                    if (attachedfile != null && attachedfile.ContentLength > 0)
                    {
                        var attachment = new Attachment(attachedfile.InputStream, attachedfile.FileName);
                        mail.Attachments.Add(attachment);
                    }
                    if (mail.To.Count > 0)
                    {
                        client.Send(mail);
                    }
                }
                TempData["sent"] = "true";
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                TempData["sent"] = "false";
            }

            return(RedirectToAction("Index"));
        }
Beispiel #6
0
        public ActionResult Index(string namesurname, string email, string phone, string city, string subject, string body, string captcha, string departman)
        {
            try
            {
                if (Session["Captcha"] == null || Session["Captcha"].ToString() != captcha)
                {
                    TempData["captchaError"] = "Güvenlik doğrulmasını yanlış girdiniz, lütfen tekrar deneyiniz.";
                    return(RedirectToAction("Index"));
                }
                if (namesurname == String.Empty || email == String.Empty || subject == String.Empty || body == String.Empty)
                {
                    TempData["required"] = "true";
                    return(RedirectToAction("Index"));
                }

                //DB kaydet
                ContactHome contact = new ContactHome()
                {
                    FullName = namesurname, Email = email, City = city, Subject = subject, Body = body, Phone = phone
                };
                ContactManager.AddContactHome(contact);

                var mset  = MailManager.GetMailSettings();
                var msend = MailManager.GetMailUsersList(0);

                using (var client = new SmtpClient(mset.ServerHost, mset.Port))
                {
                    client.EnableSsl = mset.Security;//true;//burası düzeltilecek
                    //client.DeliveryMethod = SmtpDeliveryMethod.Network;
                    client.UseDefaultCredentials = false;
                    client.Credentials           = new NetworkCredential(mset.ServerMail, mset.Password);

                    var mail = new MailMessage();
                    mail.From = new MailAddress(mset.ServerMail, "Aston");
                    //mail.Attachments.Add(new Attachment(@"C:\Sonuc.pptx"));
                    foreach (var item in msend)
                    {
                        mail.To.Add(item.MailAddress);
                    }
                    mail.Subject    = subject;
                    mail.IsBodyHtml = true;
                    mail.Body       = "<h3>Gönderen:" + namesurname + " - " + email + "</h3>" +
                                      "<b>Tel: </b>" + phone +
                                      "<br><b>Şehir: </b>" + city +
                                      "<br><b>Departman: </b>" + departman +
                                      "<br><h3>Mesaj:</h3><p>" + body + "</p>";
                    //ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
                    if (mail.To.Count > 0)
                    {
                        client.Send(mail);
                    }
                }
                TempData["sent"] = "true";
            }
            catch (Exception ex)
            {
                string message =
                    "Exception type " + ex.GetType() + Environment.NewLine +
                    "Exception message: " + ex.Message + Environment.NewLine +
                    "Stack trace: " + ex.StackTrace + Environment.NewLine;
                if (ex.InnerException != null)
                {
                    message += "---BEGIN InnerException--- " + Environment.NewLine +
                               "Exception type " + ex.InnerException.GetType() + Environment.NewLine +
                               "Exception message: " + ex.InnerException.Message + Environment.NewLine +
                               "Stack trace: " + ex.InnerException.StackTrace + Environment.NewLine +
                               "---END Inner Exception";
                }
                TempData["exception"] = message;
                TempData["sent"]      = "false";
            }

            ViewData["contact"] = ContactManager.GetContact("tr");
            return(View());
        }
Beispiel #7
0
        public ActionResult ApplicationForm(Formvalues form)
        {
            try
            {
                string html = System.IO.File.ReadAllText(Server.MapPath("~/HTMLTemplate/CareerTemplate.html"));
                html = html.Replace("[pozisyon]", form.pozisyon);
                html = html.Replace("[ad]", form.ad);
                html = html.Replace("[soyad]", form.soyad);
                html = html.Replace("[dogumYeri]", form.dogumyeri);
                html = html.Replace("[dogumgun]", form.dogumgun);
                html = html.Replace("[dogumay]", form.dogumay);
                html = html.Replace("[dogumyil]", form.dogumyil);

                html = html.Replace("[cinsiyet]", form.cinsiyet);
                html = html.Replace("[tcno]", form.tcno);

                html = html.Replace("[medenidurumu]", form.medenidurumu);
                html = html.Replace("[askerlikdurumu]", form.askerlikdurumu);
                html = html.Replace("[ehliyettipi]", form.ehliyettipi);
                html = html.Replace("[ehliyetyili]", form.ehliyetyili);
                html = html.Replace("[adres]", form.adres);
                html = html.Replace("[eposta]", form.eposta);
                html = html.Replace("[evtel]", form.evtel);
                html = html.Replace("[ceptel]", form.ceptel);
                html = html.Replace("[digertel]", form.digertel);
                //html = html.Replace("[egitimseviye]", form.egitimseviye);

                for (int i = 0; i < 5; i++)
                {
                    html = html.Replace("[okul" + (i + 1) + "]", form.okul[i]);
                    html = html.Replace("[bolum" + (i + 1) + "]", form.bolum[i]);
                    html = html.Replace("[yil" + (i + 1) + "]", form.yil[i]);
                    html = html.Replace("[baslangicyil" + (i + 1) + "]", form.yil[i]);
                }

                for (int i = 0; i < 4; i++)
                {
                    html = html.Replace("[dil" + (i + 1) + "]", form.dil[i]);
                    html = html.Replace("[dilseviye" + (i + 1) + "]", form.dilseviye[i]);
                    html = html.Replace("[dilyer" + (i + 1) + "]", form.dilyer[i]);
                }

                //html = html.Replace("[ingilizceseviye]", form.ingilizceseviye);
                //html = html.Replace("[ingilizceyer]", form.ilgilizceyer);
                //html = html.Replace("[almancaseviye]", form.almancaseviye);
                //html = html.Replace("[almancayer]", form.almancayer);
                //html = html.Replace("[fransizcaseviye]", form.fransizcaseviye);
                //html = html.Replace("[fransizcayer]", form.fransizcayer);
                //html = html.Replace("[sirket]", form.sirket);

                //html = html.Replace("[gorev]", form.gorev);
                //html = html.Replace("[isbaslangictarihi]", form.isbaslangictarihi);
                //html = html.Replace("[isbitistarihi]", form.isbitistarihi);
                //html = html.Replace("[ayrilmanedeni]", form.ayrilmanedeni);

                for (int i = 0; i < 4; i++)
                {
                    html = html.Replace("[isfirma" + (i + 1) + "]", form.isfirma[i]);
                    html = html.Replace("[isgorev" + (i + 1) + "]", form.isgorev[i]);
                    html = html.Replace("[isbaslangic" + (i + 1) + "]", form.isbaslangic[i]);
                    html = html.Replace("[isbitis" + (i + 1) + "]", form.isbitis[i]);
                    html = html.Replace("[isayrilma" + (i + 1) + "]", form.isayrilma[i]);
                }

                for (int i = 0; i < 4; i++)
                {
                    html = html.Replace("[referansad" + (i + 1) + "]", form.referansad[i]);
                    html = html.Replace("[referanskurum" + (i + 1) + "]", form.referanskurum[i]);
                    html = html.Replace("[referanspozisyon" + (i + 1) + "]", form.referanspozisyon[i]);
                    html = html.Replace("[referansistel" + (i + 1) + "]", form.referansistel[i]);
                    html = html.Replace("[referansceptel" + (i + 1) + "]", form.referansceptel[i]);
                    html = html.Replace("[referansemail" + (i + 1) + "]", form.referansemail[i]);
                }

                //html = html.Replace("[referansadi]", form.referansadi);
                //html = html.Replace("[referanskurum]", form.referanskurum);
                //html = html.Replace("[referanstel]", form.referanstel);
                html = html.Replace("[ilavebilgi]", form.ilavebilgi);

                var mset  = MailManager.GetMailSettings();
                var msend = MailManager.GetMailUsersList(0);
//#if RELEASE
                using (var client = new SmtpClient(mset.ServerHost, mset.Port))
                {
                    client.EnableSsl   = mset.Security;
                    client.Credentials = new NetworkCredential(mset.ServerMail, mset.Password);
                    var mail = new MailMessage();
                    mail.From = new MailAddress(mset.ServerMail);
                    foreach (var item in msend)
                    {
                        mail.To.Add(item.MailAddress);
                    }
                    mail.Subject    = "Yeni İş Başvurusu";
                    mail.IsBodyHtml = true;
                    mail.Body       = html;

                    if (mail.To.Count > 0)
                    {
                        client.Send(mail);
                    }
                }
//#endif
                TempData["sent"] = "true";
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                TempData["sent"] = "false";
            }

            return(RedirectToAction("Index"));
        }