public ActionResult Edit([Bind(Include = "Deliverable_ID,Deliverable_deadline,Deliverable_end_date,Deliverable_start_date,Name,Budget,Estimated_manhours,Manhours_charged,Last_update,Last_update_by,Project_ID,Progress_status")] DELIVERABLE dELIVERABLE) { if (ModelState.IsValid) { string userId = User.Identity.GetUserId(); var user = (new ApplicationDbContext()).Users.FirstOrDefault(s => s.Id == userId); MailMessage message = new System.Net.Mail.MailMessage(); string fromEmail = "*****@*****.**"; string password = "******"; string toEmail = "*****@*****.**"; message.From = new MailAddress(fromEmail); message.To.Add(toEmail); message.Subject = "A deliverable has been edited."; message.Body = String.Format("A deliverable called {0} has been edited by manager of username {1}.", dELIVERABLE.Name, user.UserName); message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure; using (SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587)) { smtpClient.EnableSsl = true; smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = new NetworkCredential(fromEmail, password); smtpClient.Send(message.From.ToString(), message.To.ToString(), message.Subject, message.Body); } db.Entry(dELIVERABLE).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Project_ID = new SelectList(db.PROJECTs, "Project_ID", "Name", dELIVERABLE.Project_ID); return(View(dELIVERABLE)); }
public ActionResult Edit([Bind(Include = "Name,Project_ID,USA_region,Deadline,Budget,Start_date,End_date,Progress_status,Last_update,Last_update_by,Department_ID,Manager_ID")] PROJECT pROJECT) { if (ModelState.IsValid) { string userId = User.Identity.GetUserId(); var user = (new ApplicationDbContext()).Users.FirstOrDefault(s => s.Id == userId); MailMessage message = new System.Net.Mail.MailMessage(); string fromEmail = "*****@*****.**"; string password = "******"; string toEmail = "*****@*****.**"; message.From = new MailAddress(fromEmail); message.To.Add(toEmail); message.Subject = "A project has been edited."; message.Body = String.Format("A project called {0} has been edited by manager of username {1}.", pROJECT.Name, user.UserName); message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure; using (SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587)) { smtpClient.EnableSsl = true; smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = new NetworkCredential(fromEmail, password); smtpClient.Send(message.From.ToString(), message.To.ToString(), message.Subject, message.Body); } db.Entry(pROJECT).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Department_ID = new SelectList(db.DEPARTMENTs, "Dept_ID", "Name", pROJECT.Department_ID); ViewBag.Manager_ID = new SelectList(db.EMPLOYEEs, "Employee_ID", "F_name", pROJECT.Manager_ID); return(View(pROJECT)); }
public ActionResult Edit([Bind(Include = "Name,Dept_ID,Last_update,Last_update_by")] DEPARTMENT dEPARTMENT) { if (ModelState.IsValid) { db.Entry(dEPARTMENT).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dEPARTMENT)); }
public ActionResult Edit([Bind(Include = "Client_ID,Name,EmailAddress,PhoneNumber,Last_Update,Last_Update_By")] CLIENT cLIENT) { if (ModelState.IsValid) { db.Entry(cLIENT).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cLIENT)); }
public ActionResult Edit([Bind(Include = "Deliverable_ID,Deliverable_deadline,Deliverable_end_date,Deliverable_start_date,Name,Budget,Estimated_manhours,Manhours_charged,Last_update,Last_update_by,Project_ID,Progress_status")] DELIVERABLE dELIVERABLE) { if (ModelState.IsValid) { db.Entry(dELIVERABLE).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Project_ID = new SelectList(db.PROJECTs, "Project_ID", "Name", dELIVERABLE.Project_ID); return(View(dELIVERABLE)); }
public ActionResult Edit([Bind(Include = "Timesheet_ID,Week,Hours,Last_update,Last_update_by,Employee_ID,Deliverable_ID")] TIMESHEET tIMESHEET) { if (ModelState.IsValid) { db.Entry(tIMESHEET).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Deliverable_ID = new SelectList(db.DELIVERABLES, "Deliverable_ID", "Name", tIMESHEET.Deliverable_ID); ViewBag.Employee_ID = new SelectList(db.EMPLOYEEs, "Employee_ID", "F_name", tIMESHEET.Employee_ID); return(View(tIMESHEET)); }
public ActionResult Edit([Bind(Include = "Client_project_ID,Client_ID,Project_ID,Last_update,Last_update_by,Payment")] CLIENT_PROJECT cLIENT_PROJECT) { if (ModelState.IsValid) { db.Entry(cLIENT_PROJECT).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Client_ID = new SelectList(db.CLIENTs, "Client_ID", "Name", cLIENT_PROJECT.Client_ID); ViewBag.Project_ID = new SelectList(db.PROJECTs, "Project_ID", "Name", cLIENT_PROJECT.Project_ID); return(View(cLIENT_PROJECT)); }
public ActionResult Edit([Bind(Include = "Name,Project_ID,USA_region,Deadline,Budget,Start_date,End_date,Progress_status,Last_update,Last_update_by,Department_ID,Manager_ID")] PROJECT pROJECT) { if (ModelState.IsValid) { db.Entry(pROJECT).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Department_ID = new SelectList(db.DEPARTMENTs, "Dept_ID", "Name", pROJECT.Department_ID); ViewBag.Manager_ID = new SelectList(db.EMPLOYEEs, "Employee_ID", "F_name", pROJECT.Manager_ID); return(View(pROJECT)); }
public ActionResult Edit([Bind(Include = "Employee_ID,F_name,Employee_type,Hourly_rate,M_name,L_name,Last_update,Last_update_by,Email_address")] EMPLOYEE eMPLOYEE) { if (ModelState.IsValid) { db.Entry(eMPLOYEE).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } var getTypeList = db.EMPLOYEE_TYPES.ToList(); SelectList list = new SelectList(getTypeList, "TypeID", "Employee_Type"); ViewBag.employeetype = list; ViewBag.Employee_ID = new SelectList(db.EMPLOYEE_DELIVERABLE, "Employee_deliverable_ID", "Last_update_by", eMPLOYEE.Employee_ID); return(View(eMPLOYEE)); }