public ActionResult SaveProject(projects project) { if (Session["ID"].Equals(2)) { if (project.Id == 0) { var ID = Convert.ToInt32(Session["ID"]); project.pStatus = 0; project.pCustomer = ID; _context.project.Add(project); } else { var projectindb = _context.project.Single(p => p.Id == project.Id); projectindb.pName = project.pName; projectindb.pSalary = project.pSalary; projectindb.pArea = project.pArea; projectindb.pDescription = project.pDescription; } _context.SaveChanges(); return(View()); } else { return(HttpNotFound()); } }
public ActionResult SaveProject(projects project) { if (Session["ID"] != null) { if (Session["type"].Equals(2)) { if (project.Id == 0) { var ID = Convert.ToInt32(Session["ID"]); project.pStatus = 0; project.progress = 0; project.customerId = ID; _context.project.Add(project); } else { var projectindb = _context.project.Single(p => p.Id == project.Id); projectindb.pName = project.pName; projectindb.pSalary = project.pSalary; projectindb.pArea = project.pArea; projectindb.pDescription = project.pDescription; } _context.SaveChanges(); return(RedirectToAction("Index", "Profile")); } else { return(HttpNotFound("Not A Customer")); } } else { return(RedirectToAction("Index", "Home")); } }
private void btnRemoveProject_Click(object sender, RoutedEventArgs e) { try { string project = projectTest[3].TrimStart(' '); MessageBoxResult result = MessageBox.Show($"Вы точно уверены, что хотите удалить проект {projectTest[3].TrimStart(' ')}?", "Delete", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { using (llblanca_lara1Entities db = new llblanca_lara1Entities()) { projects proj = db.projects.Where(p => p.name == project).FirstOrDefault(); var tas = (from t in db.tasks where t.project_id == proj.id select t).ToList(); if (tas != null) { db.tasks.RemoveRange(tas); db.SaveChanges(); } db.projects.Remove(proj); db.SaveChanges(); MessageBox.Show($"Project {projectTest[3].TrimStart(' ')} is delete"); FillingFromDBProjects(db); } } else { return; } } catch (Exception ex) { } }
public ActionResult AddProjectView() { projects project = new projects(); ViewBag.cust = db.users.Where(x => x.userTypeId == 2).ToList(); return(PartialView("AddProject", project)); }
protected void Page_Load(object sender, EventArgs e) { ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); if (ck != null) { string strDocNo = Request.QueryString["docno"]; string strDate = Request.QueryString["datedoc"]; projects pj = new projects(); string strDocNumber = pj.getProjectInfo(ck.pj_id, "pj_doc_number"); if (strDocNumber != string.Empty || strDocNumber.ToLower() != "null") { pj.updateDocNo_DocDate(ck.pj_id, strDocNo, strDate); } string strStatus = pj.getProjectInfo(ck.pj_id, "pj_complete_status"); if (strStatus != "ส่งผลแล้ว") { pj.updateProjectCompleteStatus(ck.pj_id, "ส่งผลแล้ว"); pj.updateReport_Submitted(ck.pj_id, ck.p_id); //gUtilities gt = new gUtilities(); //gt.setFactorImpact(ck.pj_id); //ทำข้อมูลเพื่อแสดงสรุปผลการวิเคราะห์ควาทเสี่ยงภายใน ภายนอก } } }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } projects project = db.projects.Find(id); if (project == null) { return(HttpNotFound()); } if (Request.Cookies.Get("id") != null) { if (project.createrID != null) { if (project.createrID.ToString() != Request.Cookies.Get("id").Value&& ((FormsIdentity)User.Identity).Ticket.UserData != "admin") { return(RedirectToAction("Index", "login")); } } } else { return(RedirectToAction("Index", "login")); } return(View(project)); }
protected void btnEditProject_Click(object sender, EventArgs e) { ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); projects pj = new projects(); string strStatus = pj.getProjectInfo(ck.pj_id, "pj_complete_status"); if (strStatus == "ไม่อยู่ในเกณฑ์การประเมิน/กรอกสมบูรณ์") { linkreport2.Visible = false; linkreport3.Visible = false; btnEditProject.Visible = false; //btnSubmitProject.Visible = false; pnlsubmit.Visible = false; } else if (strStatus != "ส่งผลแล้ว" && strStatus != "ไม่อยู่ในเกณฑ์การประเมิน/กรอกสมบูรณ์") { //ยังไม่ส่งผล และ เป็นโครงการที่ต้องทำการประเมินความเสี่ยง Response.Redirect("project_edit.aspx"); } else { linkreport2.Visible = true; linkreport3.Visible = true; btnEditProject.Visible = true; //btnSubmitProject.Visible = true; pnlsubmit.Visible = true; } }
private void btnStart_Click(object sender, RoutedEventArgs e) { using (llblanca_lara1Entities db = new llblanca_lara1Entities()) { projects project = new projects { client_id = _id, name = txtName.Text, description = txtDescription.Text, created_at = DateTime.Now, status = txtStatus.Text, //project_manager_id = cmbManagers.SelectedIndex + 1 project_manager_id = 9 }; try { db.projects.Add(project); db.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } this.Close(); }
public IHttpActionResult Putprojects(int id, projects projects) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != projects.id) { return(BadRequest()); } entities.Entry(projects).State = EntityState.Modified; try { entities.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!projectsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult AddProject(projects project, string id = "1") { project.customerId = int.Parse(id); project.pStatus = 0; db.project.Add(project); db.SaveChanges(); return(RedirectToAction("Index", "Profile")); }
public void deleteProjects(projects p) { using (PrioritizerUnitOfWork uow = UnitOfWork) { uow.Context.projects.DeleteObject(p); uow.Commit(); } }
public ActionResult DeleteConfirmed(int id) { projects project = db.projects.Find(id); db.projects.Remove(project); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult AddProject() { projects project = new projects(); var projects = db.projects.ToList(); ViewBag.projects = projects; //user = db.UserRole.Where(c => c.Id != 1).ToList(); return(View(project)); }
protected void Page_Load(object sender, EventArgs e) { ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); projects pj = new projects(); dgProject.DataSource = pj.getProject_Not_Require_Approval(ck.p_id); dgProject.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); projects pj = new projects(); dgProject.DataSource = pj.getProjectInfoAll_Real_notSubmitted(ck.p_id); dgProject.DataBind(); }
public ActionResult UpdateProject(projects project) { var projectindb = db.project.Single(p => p.Id == project.Id); projectindb.pName = project.pName; projectindb.pSalary = project.pSalary; projectindb.pArea = project.pArea; projectindb.pDescription = project.pDescription; db.SaveChanges(); return(RedirectToAction("Index", "Profile")); }
public ActionResult Edit([Bind(Include = "Id,proj_name,proj_desc,proj_tools,teamleader_id")] projects projects) { if (ModelState.IsValid) { db.Entry(projects).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.teamleader_id = new SelectList(db.teamleaders, "Id", "std_skills", projects.teamleader_id); return(View(projects)); }
public IHttpActionResult Getprojects(int id) { projects projects = entities.projects.Find(id); if (projects == null) { return(NotFound()); } return(Ok(projects)); }
public IHttpActionResult Postprojects(projects projects) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } entities.projects.Add(projects); entities.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = projects.id }, projects)); }
public ActionResult Edit([Bind(Include = "id,titel,description,customerid,time_,statusid,progressstatus")] projects project) { if (ModelState.IsValid) { db.Entry(project).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } //ViewBag.progressstatus = new SelectList(db.progress, "Id", "name_", projects.progressstatus); //ViewBag.customerid = new SelectList(db.users, "Id", "email", project.customerid); //ViewBag.statusid = new SelectList(db.status, "Id", "name_", project.statusid); return(View(project)); }
// GET: projects/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } projects project = db.projects.Find(id); if (project == null) { return(HttpNotFound()); } return(View(project)); }
public ActionResult Create([Bind(Include = "id,titel,description,customerid,time_,statusid,progressstatus")] projects project) { if (ModelState.IsValid) { db.projects.Add(project); db.SaveChanges(); return(RedirectToAction("Index")); } //ViewBag.progressstatus = new SelectList(db.progress, "Id", "name_", projects.progressstatus); //ViewBag.customerid = new SelectList(db.users, "Id", "firstname", project.customerid); //ViewBag.statusid = new SelectList(db.status, "Id", "name_", project.statusid); return(View(project)); }
public IHttpActionResult Deleteprojects(int id) { projects projects = entities.projects.Find(id); if (projects == null) { return(NotFound()); } entities.projects.Remove(projects); entities.SaveChanges(); return(Ok(projects)); }
public ActionResult Edit([Bind(Include = "projectID,createrID,arrival,installation,rehearsal,start,finish,deinstallation,departure,placeID,worktype,executorID,type,showmanID,managerID,clientID,content,note,receipts_cash,receipts_noncash,expenditure_cash,expenditure_noncash,profit_cash,profit_noncash,profit_total")] projects project) { if (ModelState.IsValid) { db.Entry(project).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.executorID = new SelectList(db.contacts, "personID", "name", project.executorID); ViewBag.clientID = new SelectList(db.contacts, "personID", "name", project.clientID); ViewBag.managerID = new SelectList(db.contacts, "personID", "name", project.managerID); ViewBag.showmanID = new SelectList(db.contacts, "personID", "name", project.showmanID); ViewBag.placeID = new SelectList(db.places, "placeID", "name", project.placeID); return(View(project)); }
public ActionResult cancel(int?id) { //if (id == null){ return HttpNotFound(); } projects project = db.project.Find(id); //if (project == null){return HttpNotFound();} project.pmId = null; project.pStatus = 1; Session["Valid_edit"] = 0; db.SaveChanges(); int ID = Convert.ToInt32(Session["ID"]); var projects = db.project.Where(p => p.pmId == ID).Include(p => p.Customer).Include(p => p.Pm).Include(p => p.Team); return(PartialView("_Control_project", projects.ToList())); }
// GET: projects/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } projects projects = db.projects.Find(id); if (projects == null) { return(HttpNotFound()); } ViewBag.teamleader_id = new SelectList(db.teamleaders, "Id", "std_skills", projects.teamleader_id); return(View(projects)); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["pj_id"] != null) { string strPJ_ID = Request.QueryString["pj_id"]; ManageCookie mgCookie = new ManageCookie(); users ck = mgCookie.ReadCookies(); answer ans = new answer(); mgCookie.UpdateCookies("pj_id", strPJ_ID); mgCookie.UpdateCookies("qset_id", ans.getLatestAnswerQSetID(strPJ_ID)); mgCookie.UpdateCookies("q2_id", ans.getLatestAnswerQ2(ck.pj_id, ck.qset_id)); if (Request.QueryString["fm"] == "submitted") { Response.Redirect("project_summary_submitted.aspx"); } else if (Request.QueryString["fm"] == "simnotsubmitted" || Request.QueryString["fm"] == "realnotsubmitted") { Response.Redirect("project_summary.aspx"); } else if (Request.QueryString["fm"] == "simnotcomplete" || Request.QueryString["fm"] == "realnotcomplete") { projects pj = new projects(); if (pj.redirectToPendingProjectDetails(ck.pj_id).Contains(".aspx")) { Response.Redirect(pj.redirectToPendingProjectDetails(ck.pj_id)); } } else if (Request.QueryString["fm"] == "notReqApproval") { Response.Redirect("project_summary.aspx?fm=notReqApproval"); } else { switch (ck.q2_id) { default: Response.Redirect("project_pickquestion.aspx"); break; } } } }
public ActionResult Edit(int id) { projects projects = db.project.Find(id); if (projects == null) { return(HttpNotFound()); } ViewBag.customerId = new SelectList(db.users, "Id", "firstName", projects.customerId); ViewBag.pmId = new SelectList(db.users, "Id", "firstName", projects.pmId); ViewBag.pTeam = new SelectList(db.team, "Id", "Id", projects.pTeam); /////////////////////////////////////////////////////////// ViewBag.sch = db.schedule.Where(x => x.pId == id && x.Progress == 1).ToList(); /////////////////////////////////////////////////////////// return(PartialView("_EditProj", projects)); }
public ActionResult AddProject(projects idea) { if (ModelState.IsValid) { var zaft = int.Parse(Session["userid"].ToString()); var projects = db.projects.Where(x => x.teamleader_id == zaft).ToList(); if (projects.Count() == 0) { idea.teamleader_id = zaft; db.projects.Add(idea); db.SaveChanges(); return(Json(new { result = 0 })); } } return(RedirectToAction("SelectDept")); }
public ActionResult Index(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var project_equipment = db.project_equipment.Include(pe => pe.projects).Include(pe => pe.equipment).Where(pe => pe.projectID == id).ToList(); if (project_equipment == null) { return(HttpNotFound()); } ViewBag.ID = id; projects pr = db.projects.Find(id); if (pr.executorID != null) { ViewBag.ExecutorName = pr.contacts1.name; ViewBag.ExecutorLastname = pr.contacts1.lastname; } if (pr.placeID != null) { ViewBag.Place = pr.places.name; } if (pr.start != null) { ViewBag.Start = @Convert.ToDateTime(pr.start).ToString("dd.MM.yyyy hh:mm"); } if (Request.Cookies.Get("id") != null) { if (((FormsIdentity)User.Identity).Ticket.UserData == "admin" || pr.createrID == null || pr.createrID.ToString() == Request.Cookies.Get("id").Value) { ViewBag.Hide = "no"; } else { ViewBag.Hide = "yes"; } } else { ViewBag.Hide = "yes"; } return(View(project_equipment)); }