public bool RejectSubscriber(int id) { SportsSide.DAL.SUBSCRIBER model = new SportsSide.DAL.SUBSCRIBER(); model = webApi.GetSubscriberFromSubscriberId(id); model.STATUS = "R"; var result = webApi.PutSubscriber(model); TempData["selectedTab"] = 2; //Bilgilendirme Maili string day = ""; switch (model.WEEK_DAY) { case "Monday": day = "Pazartesi"; break; case "Tuesday": day = "Salı"; break; case "Wednesday": day = "Çarşamba"; break; case "Thursday": day = "Perşembe"; break; case "Friday": day = "Cuma"; break; case "Saturday": day = "Cumartesi"; break; case "Sunday": day = "Pazar"; break; } MailMessage mesajim = new MailMessage(); SmtpClient istemci = new SmtpClient(); istemci.Credentials = new System.Net.NetworkCredential("*****@*****.**", "CunMerMus123"); istemci.Port = 587; istemci.Host = "mail.sportsside.net"; istemci.EnableSsl = false; mesajim.IsBodyHtml = true; mesajim.To.Add(model.USERS.USER_MAIL); mesajim.From = new MailAddress("*****@*****.**", "SportsSide"); mesajim.Subject = "Aboneliğiniz Reddedilmiştir"; mesajim.Body = "<table style='background-color: #f6f6f6;width: 100%;'><tr><td></td><td style='display: block !important;max-width: 600px !important;margin: 0 auto !important;clear: both !important;' width='600'><div style='max-width: 600px;margin: 0 auto;display: block;padding: 20px;'><table style='background: #fff;border: 1px solid #e9e9e9;border-radius: 3px;' width='100%' cellpadding='0' cellspacing='0'><tr><td style='background: #d0021b;font-size: 16px;color: #fff;font-weight: 500;padding: 20px;text-align: center;border-radius: 3px 3px 0 0;'>Aboneliğiniz Reddedilmiştir!</td></tr><tr><td style='padding: 20px;'><table width = '100%' cellpadding='0' cellspacing='0'><tr><td style='padding: 0 0 20px; color:#000;'>Merhaba<strong> " + model.USERS.USER_FIRST_NAME + " " + model.USERS.USER_SURNAME + "</strong> ,</td></tr><tr><td style='padding: 0 0 20px; color:#000;'>Aboneliğiniz tesis sahibi tarafından reddedilmiştir.</td></tr><tr><td style='padding: 0 0 20px; color:#000;'><strong>Tesis Adı :</strong> " + model.FACILITY.FACILITY_NAME + " <br><strong>Abonelik Günü :</strong> " + day + " <br><strong>Abonelik Saati :</strong> " + DateTime.Parse(model.S_TIME.ToString()).ToShortTimeString() + " - " + (int.Parse(model.S_TIME.Hours.ToString()) + 1).ToString() + ":00 <br><strong>Oluşturulma Tarihi :</strong> " + model.CREATED_DATE.ToString("dd/MM/yyyy H:mm") + " <br><strong>Tesis Adresi :</strong> " + model.FACILITY.FACILITY_ADDRESS + "<br></td></tr><tr><td style='padding: 0 0 20px;'><a href = 'http://localhost:30471/Member/Index' style='text-decoration: none;color: #FFF;background-color: #348eda;border: solid #348eda;border-width: 10px 20px;line-height: 2;font-weight: bold;text-align: center;cursor: pointer;display: inline-block;border-radius: 5px;text-transform: capitalize;'>Abonelikleri Görüntüle</a></td></tr><tr><td style='padding: 0 0 20px; color:#000;'>SportsSide'ı seçtiğiniz için teşekkür ederiz.</td></tr></table></td></tr></table></td><td></td></tr></table>"; //mesajim.Body = "Merhaba <b>" + user.USER_FIRST_NAME + "</b> " + user.USER_SURNAME + ", rezervasyonunuz tesis sahibine iletilmiştir. Tesis sahibinden geri dönüş aldığımız an size tekrar mail yoluyla bilgilendirme yapılacaktır. Bizi seçtiğiniz için teşekkür ederiz!"; object userState = mesajim; istemci.Send(mesajim); // return(result); }
public bool RejectSubscriber(int id) { SportsSide.DAL.SUBSCRIBER model = new SportsSide.DAL.SUBSCRIBER(); model = webApi.GetSubscriberFromSubscriberId(id); model.STATUS = "R"; var result = webApi.PutSubscriber(model); return(result); }
public ActionResult CreateSubscribe(int id, string day, string hour, string hourText) { string cookieName = FormsAuthentication.FormsCookieName; //Find cookie name HttpCookie authCookie = HttpContext.Request.Cookies[cookieName]; //Get the cookie by it's name FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value); //Decrypt it string UserName = ticket.Name; //You have the UserName! var user = webApi.GetUser(UserName); SportsSide.DAL.SUBSCRIBER model = new SportsSide.DAL.SUBSCRIBER(); model.USER_ID = user.USER_ID; model.FACILITY_ID = id; model.WEEK_DAY = day; TimeSpan ts = new TimeSpan(int.Parse(hour), 0, 0); model.S_TIME = ts; model.STATUS = "P"; model.CREATED_DATE = DateTime.Now; var result = webApi.PostSubscriber(model); //Bilgilendirme Maili switch (day) { case "Monday": day = "Pazartesi"; break; case "Tuesday": day = "Salı"; break; case "Wednesday": day = "Çarşamba"; break; case "Thursday": day = "Perşembe"; break; case "Friday": day = "Cuma"; break; case "Saturday": day = "Cumartesi"; break; case "Sunday": day = "Pazar"; break; } var facility = webApi.GetFacility(id); MailMessage mesajim = new MailMessage(); SmtpClient istemci = new SmtpClient(); istemci.Credentials = new System.Net.NetworkCredential("*****@*****.**", "CunMerMus123"); istemci.Port = 587; istemci.Host = "mail.sportsside.net"; istemci.EnableSsl = false; mesajim.IsBodyHtml = true; mesajim.To.Add(user.USER_MAIL); mesajim.From = new MailAddress("*****@*****.**", "SportsSide"); mesajim.Subject = "Aboneliğiniz İletilmiştir"; mesajim.Body = "<table style='background-color: #f6f6f6;width: 100%;'><tr><td></td><td style='display: block !important;max-width: 600px !important;margin: 0 auto !important;clear: both !important;' width='600'><div style='max-width: 600px;margin: 0 auto;display: block;padding: 20px;'><table style='background: #fff;border: 1px solid #e9e9e9;border-radius: 3px;' width='100%' cellpadding='0' cellspacing='0'><tr><td style='background: #68b90f;font-size: 16px;color: #fff;font-weight: 500;padding: 20px;text-align: center;border-radius: 3px 3px 0 0;'>Aboneliğiniz iletilmiştir!</td></tr><tr><td style='padding: 20px;'><table width = '100%' cellpadding='0' cellspacing='0'><tr><td style='padding: 0 0 20px; color:#000;'>Merhaba<strong> " + user.USER_FIRST_NAME + " " + user.USER_SURNAME + "</strong> ,</td></tr><tr><td style='padding: 0 0 20px; color:#000;'>Aboneliğiniz tesis sahibine iletilmiştir.Tesis sahibinden geri dönüş aldığımız an size tekrar mail yoluyla bilgilendirme yapılacaktır.</td></tr><tr><td style='padding: 0 0 20px; color:#000;'><strong>Tesis Adı :</strong> " + facility.FACILITY_NAME + " <br><strong>Abonelik Günü :</strong> " + day.ToString() + " <br><strong>Abonelik Saati :</strong> " + hourText.ToString() + " <br><strong>Oluşturulma Tarihi :</strong> " + System.DateTime.Now.ToString("dd/MM/yyyy H:mm") + " <br><strong>Tesis Adresi :</strong> " + facility.FACILITY_ADDRESS + "<br></td></tr><tr><td style='padding: 0 0 20px;'><a href = 'http://localhost:30471/Member/Index' style='text-decoration: none;color: #FFF;background-color: #348eda;border: solid #348eda;border-width: 10px 20px;line-height: 2;font-weight: bold;text-align: center;cursor: pointer;display: inline-block;border-radius: 5px;text-transform: capitalize;'>Rezervasyonları Görüntüle</a></td></tr><tr><td style='padding: 0 0 20px; color:#000;'>SportsSide'ı seçtiğiniz için teşekkür ederiz.</td></tr></table></td></tr></table></td><td></td></tr></table>"; //mesajim.Body = "Merhaba <b>" + user.USER_FIRST_NAME + "</b> " + user.USER_SURNAME + ", rezervasyonunuz tesis sahibine iletilmiştir. Tesis sahibinden geri dönüş aldığımız an size tekrar mail yoluyla bilgilendirme yapılacaktır. Bizi seçtiğiniz için teşekkür ederiz!"; object userState = mesajim; istemci.Send(mesajim); // //if (result == false) //{ // TempData["Hata"] = "Bir hata oluştu."; // return RedirectToAction("Index", "Reservation", new { @id = model.Facility.FACILITY_ID }); //} ReservationBigModel bigModel = new ReservationBigModel(); bigModel.isProblem = "N"; #region FillDays List <SelectListItem> weekDays = new List <SelectListItem>(); SelectListItem _dList = new SelectListItem(); _dList = new SelectListItem() { Text = "Pazartesi", Value = "Monday" }; weekDays.Add(_dList); _dList = new SelectListItem() { Text = "Salı", Value = "Tuesday" }; weekDays.Add(_dList); _dList = new SelectListItem() { Text = "Çarşamba", Value = "Wednesday" }; weekDays.Add(_dList); _dList = new SelectListItem() { Text = "Perşembe", Value = "Thursday" }; weekDays.Add(_dList); _dList = new SelectListItem() { Text = "Cuma", Value = "Friday" }; weekDays.Add(_dList); _dList = new SelectListItem() { Text = "Cumartesi", Value = "Saturday" }; weekDays.Add(_dList); _dList = new SelectListItem() { Text = "Pazar", Value = "Sunday" }; weekDays.Add(_dList); #endregion #region FillHours List <SelectListItem> Hours = new List <SelectListItem>(); SelectListItem _hList = new SelectListItem(); for (int i = 0; i < 24; i++) { string Hour = ""; string nextHour = ""; if (i < 10) { Hour = "0" + i.ToString(); nextHour = (i == 9) ? "10" : "0" + (i + 1).ToString(); } else { Hour = i.ToString(); nextHour = (i + 1).ToString(); } _hList = new SelectListItem() { Text = Hour + ":00 - " + nextHour + ":00", Value = i.ToString() }; Hours.Add(_hList); } #endregion ViewBag.Days = new SelectList(weekDays, "Value", "Text"); ViewBag.Hours = new SelectList(Hours, "Value", "Text"); return(PartialView("_PartialSubscribe", bigModel)); }