demo20230512/WCFService/ProductLCA/WCFMonthlyDataService.svc.cs
2023-05-12 10:20:28 +08:00

121 lines
4.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Web.Mvc;
using Weee.Models;
using Weee.Service;
namespace Weee.WCFService.ProductLCA
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "WCFMonthlyDataServce" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select WCFMonthlyDataServce.svc or WCFMonthlyDataServce.svc.cs at the Solution Explorer and start debugging.
public class WCFMonthlyDataServce : IWCFMonthlyDataServce
{
private readonly WeeeMonthlyDataService service;
public WCFMonthlyDataServce()
{
service = DependencyResolver.Current.GetService<WeeeMonthlyDataService>();
service.DisableProxyAndLazyLoad();
}
public IEnumerable<PowerUsage> SavePowerUsageSheet(IEnumerable<PowerUsage> toBeSave, string authId)
{
service.Initialize(authId);
return service.SaveSheet(toBeSave).Cast<PowerUsage>();
}
public PowerUsage SavePowerUsageSheetItem(PowerUsage toBeSave, string authId)
{
service.Initialize(authId);
return (PowerUsage)service.SaveSheetItem(toBeSave);
}
public void DeletePowerUsageSheet(int lcaId, string authId)
{
service.Initialize(authId);
service.DeleteSheet<PowerUsage>(lcaId);
}
public IEnumerable<PowerUsage> GetPowerUsageSheet(int lcaId, string authId)
{
service.Initialize(authId);
return service.GetSheet<PowerUsage>(lcaId);
}
public IEnumerable<SteamUsage> SaveSteamUsageSheet(IEnumerable<SteamUsage> toBeSave, string authId)
{
service.Initialize(authId);
return service.SaveSheet(toBeSave).Cast<SteamUsage>();
}
public SteamUsage SaveSteamUsageSheetItem(SteamUsage toBeSave, string authId)
{
service.Initialize(authId);
return (SteamUsage)service.SaveSheetItem(toBeSave);
}
public void DeleteSteamUsageSheet(int lcaId, string authId)
{
service.Initialize(authId);
service.DeleteSheet<SteamUsage>(lcaId);
}
public IEnumerable<SteamUsage> GetSteamUsageSheet(int lcaId, string authId)
{
service.Initialize(authId);
return service.GetSheet<SteamUsage>(lcaId);
}
public IEnumerable<WaterUsage> SaveWaterUsageSheet(IEnumerable<WaterUsage> toBeSave, string authId)
{
service.Initialize(authId);
return service.SaveSheet(toBeSave).Cast<WaterUsage>();
}
public WaterUsage SaveWaterUsageSheetItem(WaterUsage toBeSave, string authId)
{
service.Initialize(authId);
return (WaterUsage)service.SaveSheetItem(toBeSave);
}
public void DeleteWaterUsageSheet(int lcaId, string authId)
{
service.Initialize(authId);
service.DeleteSheet<WaterUsage>(lcaId);
}
public IEnumerable<WaterUsage> GetWaterUsageSheet(int lcaId, string authId)
{
service.Initialize(authId);
return service.GetSheet<WaterUsage>(lcaId);
}
public IEnumerable<WorkHour> SaveWorkHourSheet(IEnumerable<WorkHour> toBeSave, string authId)
{
service.Initialize(authId);
return service.SaveSheet(toBeSave).Cast<WorkHour>();
}
public WorkHour SaveWorkHourSheetItem(WorkHour toBeSave, string authId)
{
service.Initialize(authId);
return (WorkHour)service.SaveSheetItem(toBeSave);
}
public void DeleteWorkHourSheet(int lcaId, string authId)
{
service.Initialize(authId);
service.DeleteSheet<WorkHour>(lcaId);
}
public IEnumerable<WorkHour> GetWorkHourSheet(int lcaId, string authId)
{
service.Initialize(authId);
return service.GetSheet<WorkHour>(lcaId);
}
}
}