Ejemplo n.º 1
0
        public JsonResult SaveSupervisorOnShift(int?productionLineId, int?shiftId, int?workOrderId, DateTime?productionDate, string supervisor)
        {
            SupervisorOnShiftModel model = new SupervisorOnShiftModel();

            using (TPO.Services.Production.SupervisorOnShiftService service = new Services.Production.SupervisorOnShiftService())
            {
                var dto = service.GetByPlantLineShiftDate(productionLineId.Value, shiftId.Value, workOrderId.Value, productionDate.Value);
                dto.ModifiedBy     = CurrentUser;
                dto.LastModified   = DateTime.Now;
                dto.SupervisorName = supervisor;
                if (dto.ID == 0)
                {
                    dto.LineID         = productionLineId.Value;
                    dto.ShiftID        = shiftId.Value;
                    dto.ProductionDate = productionDate.Value;
                    dto.EnteredBy      = CurrentUser;
                    dto.DateEntered    = DateTime.Now;

                    dto.ID = service.Add(dto);
                }
                else
                {
                    service.Update(dto);
                }

                // refresh and pass it back
                dto = service.Get(dto.ID);
                AutoMapper.Mapper.Map(dto, model);
            }

            return(Json(model, JsonRequestBehavior.DenyGet));
        }
        public JsonResult FetchSupervisorOnShift(int?productionLineId, int?shiftId, DateTime?productionDate)
        {
            SupervisorOnShiftModel model = new SupervisorOnShiftModel();

            if (productionLineId.HasValue && shiftId.HasValue && productionDate.HasValue)
            {
                using (TPO.Services.Production.SupervisorOnShiftService service = new Services.Production.SupervisorOnShiftService())
                {
                    var dto = service.GetByPlantLineShiftDate(CurrentPlantId, productionLineId.Value, shiftId.Value, productionDate.Value);
                    model = AutoMapper.Mapper.Map <SupervisorOnShiftDto, SupervisorOnShiftModel>(dto);
                }
                if (model == null)
                {
                    model = new SupervisorOnShiftModel();
                }
            }
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public JsonResult FetchSupervisorOnShift(int?productionLineId, int?shiftId, int?workOrderId, DateTime?productionDate)
        {
            SupervisorOnShiftModel model = new SupervisorOnShiftModel();

            if (productionLineId.HasValue && shiftId.HasValue && workOrderId.HasValue && productionDate.HasValue)
            {
                using (TPO.Services.Production.SupervisorOnShiftService service = new Services.Production.SupervisorOnShiftService())
                {
                    var dto = service.GetByPlantLineShiftDate(productionLineId.Value, shiftId.Value, workOrderId.Value, productionDate.Value);
                    if (dto != null)
                    {
                        model = AutoMapper.Mapper.Map <SupervisorOnShiftDto, SupervisorOnShiftModel>(dto);
                    }
                }
            }

            if (model.Id == 0)
            {
                model.ResponseMessage = new Core.ResponseMessage();
                model.ResponseMessage.ActionMessage = "NoData";
            }

            return(Json(model, JsonRequestBehavior.AllowGet));
        }