Exemplo n.º 1
0
        public ActionResult Edit(DispatchNoteViewModel model, string button)
        {
            try
            {
                DispatchNote dispatchNote = Mapper.Map <DispatchNote>(model);
                dispatchNote.Status = "Open";

                if (button.Equals("Print"))
                {
                    dispatchNote.IsPrinted = true;
                }

                Client clienFromDb = _clientService.GetClientById(Convert.ToInt32(model.Client));

                dispatchNote.Client = clienFromDb.CompanyName + " - " + clienFromDb.OperationType;
                dispatchNote.VehicleLicensePlateNumber = _vehicleService.GetVehicleDetailById(Convert.ToInt32(model.VehicleLicensePlateNumber)).VehicleNumber;

                _dispatchNoteService.UpdateDispatchNote(dispatchNote);
                ModelState.Clear();
                ViewData["Success"] = "Successfully Updated.";
                return(RedirectToAction("Open"));
            }
            catch (Exception e)
            {
                return(View());
            }
        }
Exemplo n.º 2
0
        public ActionResult ViewDispatch(DispatchNoteViewModel model, string button)
        {
            try
            {
                DispatchNote dispatchNote = Mapper.Map <DispatchNote>(model);

                if (button.Equals("Close"))
                {
                    dispatchNote.Status = "Closed";
                }
                else
                {
                    dispatchNote.IsDispatchNoteReceived = false;
                    dispatchNote.IsGoodsDelivered       = false;
                    dispatchNote.Remarks = null;
                    dispatchNote.Status  = "Cancelled";
                }

                _dispatchNoteService.UpdateDispatchNoteStatus(dispatchNote);
                ModelState.Clear();
                ViewData["Success"] = "Successfully Updated.";
                return(RedirectToAction("Open"));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
Exemplo n.º 3
0
        // GET: Dispatch/Create
        public ActionResult Create()
        {
            DispatchNoteViewModel model = new DispatchNoteViewModel();

            model.QuantityType         = CustomDataHelper.DataHelper.GetQuentity();
            model.Client_OperationType = GetClients();
            model.DriverName_Grade     = GetDrivers();
            model.HelperName           = GetHelpers();
            model.VehiclePlateNumber   = GetVehicles();
            return(View(model));
        }
Exemplo n.º 4
0
 public ActionResult ViewDispatch(int id)
 {
     try
     {
         Domain.DispatchNote.DispatchNote dispatch = _dispatchNoteService.GetDispatchNoteById(id);
         DispatchNoteViewModel            model    = Mapper.Map <DispatchNoteViewModel>(dispatch);
         model.QuantityType         = CustomDataHelper.DataHelper.GetQuentity();
         model.Client_OperationType = GetClients();
         model.DriverName_Grade     = GetDrivers();
         model.HelperName           = GetHelpers();
         model.VehiclePlateNumber   = GetVehicles();
         return(View(model));
     }
     catch
     {
         return(View());
     }
 }
Exemplo n.º 5
0
 // GET: Dispatch/Edit/5
 public ActionResult Edit(int id)
 {
     try
     {
         Domain.DispatchNote.DispatchNote dispatch = _dispatchNoteService.GetDispatchNoteById(id);
         DispatchNoteViewModel            model    = Mapper.Map <DispatchNoteViewModel>(dispatch);
         model.Client                    = GetClients().Where(c => c.Text == model.Client).Select(c => c.Value).FirstOrDefault();
         model.QuantityType              = CustomDataHelper.DataHelper.GetQuentity();
         model.Client_OperationType      = GetClients();
         model.DriverName_Grade          = GetDrivers();
         model.HelperName                = GetHelpers();
         model.VehiclePlateNumber        = GetVehicles();
         model.VehicleLicensePlateNumber = GetVehicles().Where(v => v.Text == model.VehicleLicensePlateNumber).Select(c => c.Value).FirstOrDefault();
         return(View(model));
     }
     catch
     {
         return(View());
     }
 }