コード例 #1
0
        public async Task <IActionResult> SOHistDisplayEdit(int SOHistoryID)
        {
            var history = await _workorderService.GetSOHistoryById(SOHistoryID);

            var model = _mapper.Map <WOHistoryModel>(history);

            foreach (var item in (await _workorderService.GetHistoryDetail(history.SohistoryId)))
            {
                model.sohistoryDetails.Add(new SohistoryDetail
                {
                    Date              = item.Date,
                    LogonName         = item.LogonName,
                    NameNote          = item.NameNote,
                    Notes             = item.Notes,
                    SohistoryDetailId = item.SohistoryDetailId,
                    SohistoryId       = item.SohistoryId
                });
            }

            model.AvailableEmployee.Add(new SelectListItem {
                Text = "Employee", Value = "0"
            });
            foreach (var item in _logonRepository.Table.Where(l => l.ClientId == (int)_workContext.CurrentCustomer.ClientId && l.UserType == 12))
            {
                model.AvailableEmployee.Add(new SelectListItem {
                    Text = item.UserName, Value = item.LogonId.ToString()
                });
            }

            model.AvailableServiceContract.Add(new SelectListItem {
                Text = "Provider", Value = "0"
            });
            foreach (var item in _serviceContractRepository.Table.Where(l => l.ClientId == (int)_workContext.CurrentCustomer.ClientId))
            {
                model.AvailableServiceContract.Add(new SelectListItem {
                    Text = item.Scvendor, Value = item.Scid.ToString()
                });
            }

            model.AvailableGL.Add(new SelectListItem {
                Text = "Unallocated", Value = "0"
            });
            foreach (var item in (await _financialManagementService.GetGeneralLedger(
                                      (int)_workContext.CurrentCustomer.ClientId)))
            {
                model.AvailableGL.Add(new SelectListItem {
                    Text = item.Gl1, Value = item.Gl1.ToString()
                });
            }

            foreach (var item in (await _costCenterService.SelectCostCenter((int)_workContext.CurrentCustomer.ClientId,
                                                                            (int)_workContext.CurrentCustomer.UserType,
                                                                            _workContext.CurrentCustomer.LogonId)))
            {
                model.AvailableLocation.Add(new SelectListItem {
                    Text = item.Both, Value = item.Sid.ToString()
                });
            }

            return(View(model));
        }