SampleService.cs 3.19 KB
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Serialization;
using WebApp;
using WebMvc.Areas.WebService;
using WebRepository;

namespace WebMvc.Areas.WebService
{
	public class SampleService : ISampleService
	{
        private IUnitWork _unitWork;
        public IRepository<WebRepository.Task> _app;
        public IRepository<Container> _appc;
        public IRepository<Inventory> _appi;
        public IRepository<Location> _appl;
        public IRepository<ReceiptDetail> _apprd;
        public IRepository<ReceiptHeader> _apprh;
        public IRepository<ShipmentHeader> _apph;
        public IRepository<ShipmentDetail> _appsd;
        public IRepository<TaskDetail> _apptd;
        public IRepository<InventoryTransaction> _appit;
        private BaseDBContext _context;
        private IAuth _auth;

        public SampleService(IUnitWork unitWork, IAuth auth, IRepository<Inventory> inventory, IRepository<InventoryTransaction> inventoryTransaction, IRepository<Container> Icontainer, IRepository<ReceiptHeader> receiptHeader, IRepository<ReceiptDetail> receiptDetail, IRepository<WebRepository.Task> repository, IRepository<Location> repositoryl, IRepository<ShipmentHeader> repositoryh, IRepository<TaskDetail> repositorytd, IRepository<ShipmentDetail> repositorysd, BaseDBContext context)
        {
            _unitWork = unitWork;
            _app = repository;
            _appl = repositoryl;
            _apph = repositoryh;
            _appsd = repositorysd;
            _apptd = repositorytd;
            _apprd = receiptDetail;
            _apprh = receiptHeader;
            _appc = Icontainer;
            _appi = inventory;
            _appit = inventoryTransaction;
            _context = context;
            _auth = auth;
            LoginInfo loginInfo = new LoginInfo
            {
                Account = "NouYaWeb"
            };
            SetLoginInfo(loginInfo);
        }

        public void SetLoginInfo(LoginInfo loginInfo)
        {
            _app._loginInfo = loginInfo;
            _appl._loginInfo = loginInfo;
            _apph._loginInfo = loginInfo;
            _appsd._loginInfo = loginInfo;
            _apptd._loginInfo = loginInfo;
            _appc._loginInfo = loginInfo;
            _apprd._loginInfo = loginInfo;
            _apprh._loginInfo = loginInfo;
            _appi._loginInfo = loginInfo;
            _appit._loginInfo = loginInfo;
        }
        public string Ping(string Request, string msg)
		{
            
            return "Hello Word!!";
        }

        public ReceiptResponse ReceiptService(MaterialsInformation[] materials,string msg)
        {
            ReceiptResponse receiptResponse = new ReceiptResponse();
            try
            {
                receiptResponse.Code = 200;
                receiptResponse.materials = materials;
                receiptResponse.Message = "success";
            }
            catch (Exception ex)
            {
                receiptResponse.Code = 300;
                receiptResponse.Message = ex.Message;
            }
            return receiptResponse;
        }
    }
}