private void sendMailTo(Employee emp,int forum_id) { #region mail object SmtpClient client = new SmtpClient(); client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "tagmedia1234"); client.Port = 587; client.Host = "smtp.gmail.com"; client.EnableSsl = true; MailAddress maFrom = new MailAddress("*****@*****.**", "Sender's Name"), maTo = new MailAddress(emp.Email.ToString(), "Recipient's Name"); MailMessage mmsg = new MailMessage(maFrom.Address, maTo.Address); mmsg.Body = "<html><body>" + "<h1>שלום, " + emp.FirstName.ToString() + " !</h1>" + "<h2>הודעה חדשה בפורום</h2>" + " <a href='" + Request.Url.Host+ "/Forums/" + forum_id + "'>לחץ כאן על הקישור לכניסה לפורום</a>" + "</body></html>"; mmsg.IsBodyHtml = true; mmsg.Subject = "הודעה חדשה בפורום"; client.Send(mmsg); #endregion }
public static MvcHtmlString EmployeeImageSmall(this HtmlHelper helper, Employee item) { var url = new UrlHelper(helper.ViewContext.RequestContext); var path = HttpContext.Current.Server.MapPath("~/public/userfiles/employees/" + item.Id + ".jpg"); if (File.Exists(path)) { return MvcHtmlString.Create( string.Format("<a href='{3}' class='employee-photo'><img title='{1}' src='{2}' /></a>", url.Content("~/public/images/pix.gif"), item.FullName, url.Content("~/public/userfiles/employees/" + item.Id + ".jpg"), url.Action("Card", "Employees", new { item.Id }) ) ); } else { return MvcHtmlString.Create( string.Format("<a href='{3}' class='employee-photo'><img title='{1}' style='background-size: 100%;background-image: url({2})' src='{0}' /></a>", url.Content("~/public/images/pix.gif"), item.FullName, url.Content("~/public/images/picture_bg.jpg"), url.Action("Card", "Employees", new { item.Id }) ) ); } }
protected override bool AuthorizeCore(HttpContextBase httpContext) { if (!httpContext.Request.IsAuthenticated) return false; var employee = Employee.Current; #if DEBUG employee = null; #endif employee = null; if (employee == null && !String.IsNullOrWhiteSpace(Employee.GetUsername)) { using (var session = NHibernateHelper.OpenSession()) { using (var t = session.BeginTransaction()) { employee = session.QueryOver<Employee>() .Where(x => x.Username == Employee.GetUsername) .Take(1) .SingleOrDefault(); if (employee == null) { employee = new Employee { Username = Employee.GetUsername, FirstName = Employee.GetUsername, LastName = "Name", BDay = DateTime.Parse("1/1/1999"), Id = new Random().Next(99999999), IsActive = true }; session.Save(employee); t.Commit(); } httpContext.Session["employee"] = employee; } } return true; } return true; }
public static string PictureUrl(this UrlHelper helper, Employee employee) { if (string.IsNullOrEmpty(employee.Picture)) return ""; return helper.Content("~/public/userfiles/employees/" + employee.Picture); }
public EmailResult Message(Employee employee) { Subject = "קיבלת הודעה אישית בפורטל"; To.Add(employee.Email); return Email("Message", employee); }
public EmailResult Forum(Employee employee) { Subject = "קיבלת הודעה אישית בפורטל"; To.Add(employee.Email); return Email("Forum", employee); }
// // GET: /Mailers/ public EmailResult Bday(Employee manager, Employee employee) { ViewBag.Employee = employee; Subject = "היום יום הולדת ל" + employee.FullName; To.Add(manager.Email); return Email("Bday", manager); }
public string UpdateManagers(Dictionary<string,string> user_manager) { Employee temp = new Employee(); try { foreach (var listitem in user_manager) { if (!string.IsNullOrEmpty(listitem.Key) && !string.IsNullOrEmpty(listitem.Value.Trim())) { var item = GetSession.Get<Employee>(Convert.ToInt64(listitem.Key)); var item2 = GetSession.Get<Employee>(Convert.ToInt64(listitem.Value)); if (item !=null) { item.Manager = item2; GetSession.Update(item); } } } return "yes"; } catch (Exception) { return "no"; } }
public static TreeNode GetNode(Employee item, IEnumerable<Employee> items) { TreeNode node = new TreeNode() { ThumbImageUrl = "/public/userfiles/employees/1.jpg", Title = item.FullName, Caption = item.JobTitleName, Action = "Card", Controller = "Employees", Id = item.Id }; IEnumerable<Employee> employees = items .Where(x => x.Manager != null && x.Manager.Id == item.Id).ToArray(); foreach (Employee employee in employees) { node.AddChild(GetNode(employee, items)); } return node; }
public static bool IsOwner(this ViewContext context, Employee employee) { return employee != null && Portal.Entities.Employee.GetUsername == employee.Username; }