Ejemplo n.º 1
0
 public ActionResult Create(int?Id, int?isProjectBased)  //SaleOrderItemId is received here
 {
     try
     {
         FillEmployee();
         JobCardRepository   repo   = new JobCardRepository();
         SaleOrderRepository soRepo = new SaleOrderRepository();
         isProjectBased = soRepo.IsProjectOrVehicle(Id ?? 0);
         JobCard model = repo.GetJobCardDetails(Id ?? 0, isProjectBased ?? 0);
         model.JobCardNo = DatabaseCommonRepository.GetNextDocNo(
             model.isService == 1 ?
             (isProjectBased ?? 0) == 1 ? 40 : 34 :
             (isProjectBased ?? 0) == 1 ? 39 : 16,
             OrganizationId);
         model.isProjectBased = isProjectBased ?? 0;
         model.JobCardTasks   = new List <JobCardTask>();
         model.JobCardTasks.Add(new JobCardTask()
         {
             TaskDate = DateTime.Now
         });
         model.JobCardDate  = DateTime.Now;
         model.RequiredDate = DateTime.Now;
         FillBay(model.isService);
         //FillAllTasks();
         FillTasks(model.isProjectBased);
         //if (model.isService == 1)
         //    FillTaks(model.WorkDescriptionId);
         //else
         //    FillFreezerAndBoxTasks(Id);
         //FillTaks(model.WorkDescriptionId);
         //FillFreezerUnit();
         //FillBox();
         //FillVehicleRegNo();
         return(View(model));
     }
     catch (Exception ex)
     {
         string ErrorMessage = ex.Message.ToString();
         if (ex.InnerException != null)
         {
             if (ex.InnerException.Message != null)
             {
                 ErrorMessage = ErrorMessage + ex.InnerException.Message.ToString();
             }
         }
         ViewData["Error"] = ErrorMessage;
         return(View("ShowError"));
     }
 }