public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbl_pmsTxTaskEstimation tbl_pmsTxTaskEstimation = db.tbl_pmsTxTaskEstimation.Find(id); if (tbl_pmsTxTaskEstimation == null) { return(HttpNotFound()); } return(View(tbl_pmsTxTaskEstimation)); }
public ActionResult Delete(string estimation_ID) { if (estimation_ID == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbl_pmsTxTaskEstimation tbl_pmsTxTaskEstimation = db.tbl_pmsTxTaskEstimation.Find(estimation_ID); if (tbl_pmsTxTaskEstimation == null) { return(HttpNotFound()); } return(View(tbl_pmsTxTaskEstimation)); }
//public ActionResult Details(string id) //{ // if (id == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // tbl_pmsTxTaskEstimation tbl_pmsTxTaskEstimation = _context.tbl_pmsTxTaskEstimation.Find(id); // if (tbl_pmsTxTaskEstimation == null) // { // return HttpNotFound(); // } // return View(tbl_pmsTxTaskEstimation); //} //public ActionResult Create(string task_ID) //{ // cls_HelpMethods.UserDetail(); // cls_HelpMethods.CompanyDetail(); // ViewBag.task_ID = task_ID; // ViewBag.subTask_ID = new SelectList(_context.tbl_genMasSubTask.Where(p => p.isActive == true), "subTask_ID", "subTaskName"); // return View(); //} //public ActionResult Edit(string estimation_ID) //{ // if (estimation_ID == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // tbl_pmsTxTaskEstimation tbl_pmsTxTaskEstimation = _context.tbl_pmsTxTaskEstimation.Where(p => p.estimation_ID == estimation_ID).FirstOrDefault(); // if (tbl_pmsTxTaskEstimation == null) // { // return HttpNotFound(); // } // ViewBag.isApprove = tbl_pmsTxTaskEstimation.isApproved; // ViewBag.isCancel = tbl_pmsTxTaskEstimation.isCancelled; // //var List = _context.tbl_pmsTxTask.Where(p => p.assignedUser_ID == sUser_ID); // ViewBag.estimation_ID = tbl_pmsTxTaskEstimation.estimation_ID; // ViewBag.task_ID = new SelectList(_context.tbl_pmsTxTask.Where(p => p.isCancelled == false), "task_ID", "taskReference", tbl_pmsTxTaskEstimation.task_ID); // ViewBag.subTask_ID = new SelectList(_context.tbl_genMasSubTask.Where(p => p.isActive == true), "subTask_ID", "subTaskName"); // return View(); //} //public ActionResult Delete(string estimation_ID) //{ // if (estimation_ID == null) // { // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); // } // tbl_pmsTxTaskEstimation tbl_pmsTxTaskEstimation = _context.tbl_pmsTxTaskEstimation.Find(estimation_ID); // if (tbl_pmsTxTaskEstimation == null) // { // return HttpNotFound(); // } // return View(tbl_pmsTxTaskEstimation); //} #endregion #region Transaction public async Task <tbl_pmsTxTaskEstimation> SaveTaskEstimation(TaskEstimation oTaskEstimation) { string Message = ""; try { tbl_pmsTxTaskEstimation oEstimation = new tbl_pmsTxTaskEstimation(oTaskEstimation.estimation_ID, oTaskEstimation.estimationDate, oTaskEstimation.task_ID, oTaskEstimation.totalEstimatedHours, oTaskEstimation.remarks, false, false, sUser_ID, sUser_ID, sUser_ID, sUser_ID, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, sCompany_ID, sCompanyBranch_ID); await _context.tbl_pmsTxTaskEstimation.AddAsync(oEstimation); await _context.SaveChangesAsync(); return(oEstimation); } catch (Exception ex) { Message = ex.Message + "\n\n" + ex.Data; } return(null); }
public ActionResult Edit2(string estimation_ID) { if (estimation_ID == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tbl_pmsTxTaskEstimation tbl_pmsTxTaskEstimation = db.tbl_pmsTxTaskEstimation.Where(p => p.estimation_ID == estimation_ID).FirstOrDefault(); if (tbl_pmsTxTaskEstimation == null) { return(HttpNotFound()); } ViewBag.isApprove = tbl_pmsTxTaskEstimation.isApproved; ViewBag.isCancel = tbl_pmsTxTaskEstimation.isCancelled; //var List = db.tbl_pmsTxTask.Where(p => p.assignedUser_ID == sUser_ID); ViewBag.estimation_ID = tbl_pmsTxTaskEstimation.estimation_ID; ViewBag.task_ID = new SelectList(db.tbl_pmsTxTask.Where(p => p.isCancelled == false), "task_ID", "taskReference", tbl_pmsTxTaskEstimation.task_ID); ViewBag.subTask_ID = new SelectList(db.tbl_genMasSubTask.Where(p => p.isActive == true), "subTask_ID", "subTaskName"); return(View()); }
public JsonResult SaveTaskEstimation(TaskEstimation oTaskEstimation) { bool status = false; string EstimationID = "", Message = ""; try { if (ModelState.IsValid) { if (sUser_ID != null && sCompany_ID != null && sCompanyBranch_ID != null) { var Task = db.tbl_pmsTxTaskEstimation.FirstOrDefault(p => p.task_ID == oTaskEstimation.task_ID); if (Task == null) { oTaskEstimation.estimation_ID = tbl_AutoCode.AutoCode((int)enumFormNames.TaskEstimation); if (oTaskEstimation.estimation_ID != null) { tbl_pmsTxTaskEstimation oEstimation = new tbl_pmsTxTaskEstimation(oTaskEstimation.estimation_ID, oTaskEstimation.estimationDate, oTaskEstimation.task_ID, oTaskEstimation.totalEstimatedHours, oTaskEstimation.remarks, false, false, sUser_ID, sUser_ID, sUser_ID, sUser_ID, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, sCompany_ID, sCompanyBranch_ID); db.tbl_pmsTxTaskEstimation.Add(oEstimation); db.SaveChanges(); foreach (var oDetail in oTaskEstimation.TaskEstimationDetails) { //tbl_pmsTxTaskEstimation_Detail oEstimationDetail = new tbl_pmsTxTaskEstimation_Detail(oDetail.line_No, oDetail.estimation_ID, oDetail.subTask_ID, oDetail.estimatedHours); oDetail.estimation_ID = oTaskEstimation.estimation_ID; } db.tbl_pmsTxTaskEstimation_Detail.AddRange(oTaskEstimation.TaskEstimationDetails); db.SaveChanges(); EstimationID = oTaskEstimation.estimation_ID; status = true; Message = "Task Estimation Saved Successfully"; } else { Message = "Task Estimation ID is Empty...!"; status = false; } } else { Message = "Already Create Estimation for This Task"; status = false; } } else { string sHeader = "Your Session is Expired"; Message = sHeader.ToUpper() + ", \nPlease Reload This Page...!"; status = false; } } else { Message = "Model State Invalid...!"; status = false; } } catch (Exception ex) { Message = ex.Message + "\n\n" + ex.Data; status = false; } return(new JsonResult { Data = new { status = status, EstimationID = EstimationID, Message = Message } }); }