コード例 #1
0
        public async Task <bool> DeleteServiceRequest(Soorders soorders)
        {
            var result = _soOrderRepository.DeleteAsync(soorders);

            if (result != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        public async Task <bool> InsertServiceRequestModel(Soorders soorders)
        {
            if (soorders.RvendorId != 0)
            {
                soorders.RvendorId   = soorders.RvendorId;
                soorders.RautoVid    = soorders.RvendorId;
                soorders.RvendorName = _serviceContractRepository.Table.Where(l => l.Scid == soorders.RvendorId).FirstOrDefault().Scvendor;
            }

            if (soorders.LogonId != 0)
            {
                soorders.RvendorId   = soorders.LogonId;
                soorders.RvendorName = _logonRepository.Table.Where(l => l.LogonId == soorders.LogonId).FirstOrDefault().UserName;
            }

            var ships = (await _costCenterService.SelectCostCenter((int)_workContext.CurrentCustomer.ClientId,
                                                                   (int)_workContext.CurrentCustomer.UserType,
                                                                   _workContext.CurrentCustomer.LogonId)).Where(s => s.Sid == soorders.Rsid).FirstOrDefault();

            soorders.Rsid      = ships.Sid;
            soorders.OshipId   = ships.ShipID;
            soorders.RshipName = ships.SName;
            soorders.LogonId   = (int)_workContext.CurrentCustomer.LogonId;
            soorders.UserName  = _workContext.CurrentCustomer.UserName;
            soorders.RclientId = (int)_workContext.CurrentCustomer.ClientId;
            soorders.RuserType = (int)_workContext.CurrentCustomer.UserType;
            soorders.Rstatus   = "O";
            soorders.Rdate     = DateTime.Now;

            var result = await _soOrderRepository.InsertAsync(soorders);

            if (result != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        public async Task <Soorders> PrepareUpdateServiceRequestModel(Soorders soorders, ServiceRequestModel model)
        {
            soorders.ProblemSummary = model.ProblemSummary;
            soorders.Rdescription   = model.Rdescription;
            soorders.Rnote          = model.Rnote;
            soorders.Rfor           = model.Rfor;
            soorders.RdateDue       = model.RdateDue;
            soorders.AssetName      = model.AssetName;
            soorders.AssetSerialNo  = model.AssetSerialNo;
            soorders.AssetModel     = model.AssetModel;
            soorders.RpriceLabor    = model.RpriceLabor;
            soorders.RpriceParts    = model.RpriceParts;
            soorders.Rgl            = model.Rgl;

            if (model.RvendorId != 0)
            {
                soorders.RvendorId   = model.RvendorId;
                soorders.RautoVid    = model.RvendorId;
                soorders.RvendorName = _serviceContractRepository.Table.Where(l => l.Scid == model.RvendorId).FirstOrDefault().Scvendor;
            }

            if (model.LogonId != 0)
            {
                soorders.RvendorId   = model.LogonId;
                soorders.RvendorName = _logonRepository.Table.Where(l => l.LogonId == model.LogonId).FirstOrDefault().UserName;
            }

            var ships = (await _costCenterService.SelectCostCenter((int)_workContext.CurrentCustomer.ClientId,
                                                                   (int)_workContext.CurrentCustomer.UserType,
                                                                   _workContext.CurrentCustomer.LogonId)).Where(s => s.Sid == model.Rsid).FirstOrDefault();

            soorders.Rsid      = ships.Sid;
            soorders.OshipId   = ships.ShipID;
            soorders.RshipName = ships.SName;
            soorders.LogonId   = (int)_workContext.CurrentCustomer.LogonId;
            soorders.UserName  = _workContext.CurrentCustomer.UserName;
            soorders           = await _soOrderRepository.UpdateAsync(soorders);

            return(soorders);
        }