Ejemplo n.º 1
0
 public ActionResult Edit(int id)
 {
     Context.SalesOrder dbitem = RepoSalesOrder.FindByPK(id);
     if (dbitem.SalesOrderOncallId.HasValue)
     {
         SalesOrderOncall model = new SalesOrderOncall(dbitem);
         ViewBag.kondisi        = "planning";
         ViewBag.name           = model.SONumber;
         ViewBag.area           = RepoSalesOrder.FindArea(dbitem.SalesOrderOncall.IdDaftarHargaItem.Value);
         ViewBag.is_area_pulang = RepoSalesOrder.FindRute(dbitem.SalesOrderOncall.IdDaftarHargaItem.Value).IsAreaPulang == true ? "Yes" : "No";
         ViewBag.TanggalPulang  = model.TanggalMuat.Value.AddDays(RepoSalesOrder.FindRute(dbitem.SalesOrderOncall.IdDaftarHargaItem.Value).WaktuKerja);
         ViewBag.Title          = "Planning Sales Order Oncall " + model.SONumber;
         ViewBag.PostData       = "EditOncall";
         return(View("SalesOrderOncall/FormReadOnly", model));
     }
     else if (dbitem.SalesOrderProsesKonsolidasiId.HasValue)
     {
         SalesOrderProsesKonsolidasi model = new SalesOrderProsesKonsolidasi(dbitem);
         ViewBag.kondisi  = "planning";
         ViewBag.name     = model.SONumber;
         ViewBag.Title    = "Planning Sales Order Proses Konsolidasi " + model.SONumber;
         ViewBag.PostData = "EditProsesKonsolidasi";
         return(View("SalesOrderProsesKonsolidasi/FormReadOnly", model));
     }
     else if (dbitem.SalesOrderPickupId.HasValue)
     {
         SalesOrderPickup model = new SalesOrderPickup(dbitem);
         ViewBag.kondisi  = "planning";
         ViewBag.name     = model.SONumber;
         ViewBag.Title    = "Planning Sales Order Pickup " + model.SONumber;
         ViewBag.PostData = "EditPickup";
         return(View("SalesOrderPickup/FormReadOnly", model));
     }
     else
     {
         return(View(""));
     }
 }
Ejemplo n.º 2
0
 public string CheckArea(int id)
 {
     Context.SalesOrder dbso = RepoSalesOrder.FindAll().Where(d =>
                                                              (d.Status == "save" || d.Status == "draft planning" || d.Status == "draft konfirmasi" || d.Status == "save konfirmasi" || d.Status == "dispatched") && (
                                                                  (d.SalesOrderOncallId.HasValue && d.SalesOrderOncall.IdDataTruck == id) || (d.SalesOrderPickupId.HasValue && d.SalesOrderPickup.IdDataTruck == id) ||
                                                                  (d.SalesOrderProsesKonsolidasiId.HasValue && d.SalesOrderProsesKonsolidasi.IdDataTruck == id) ||
                                                                  (d.SalesOrderKontrakId.HasValue && d.SalesOrderKontrak.SalesOrderKontrakTruck.Any(k => k.DataTruckId == id))
                                                                  )
                                                              ).FirstOrDefault();
     if (dbso.SalesOrderOncallId.HasValue)
     {
         return(new JavaScriptSerializer().Serialize(new { area = RepoSalesOrder.FindArea(dbso.SalesOrderOncall.IdDaftarHargaItem.Value) }));
     }
     return(null);
 }