demo20230512/Service/OtherCompoundService.cs
2023-05-12 10:20:28 +08:00

50 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Weee.DAL;
using Weee.Models;
using Weee.Models.Paramemter;
using Weee.ViewModels.Lca;
namespace Weee.Service
{
public class OtherCompoundService
{
private readonly WeeeDataContext db;
private readonly WeeeSheetDataService service;
private readonly WeeeParameterDataService parameterservice;
//private readonly UserManager<User> manager;
public OtherCompoundService(WeeeDataContext db
, WeeeSheetDataService d
, WeeeParameterDataService s) //: base(d)
{
this.db = db;
service = d;
parameterservice = s;
//manager = m;
}
public LcaOtherCompoundViewModel GetOrgByLcaId(string _LCAID)
{
int LCAID;
if (!int.TryParse(_LCAID, out LCAID))
return new LcaOtherCompoundViewModel();
var organizationInfo = db.OrganizationLCAs.FirstOrDefault(o => o.ID == LCAID);
if (organizationInfo != null)
{
var result = //service.GetSheet<OrganizationLCAFabSurveyForm_OtherCompounds>(LCAID);
db.OrganizationOtherCompound.Where(x => x.LCAID == LCAID);
LcaOtherCompoundViewModel ret2 = new LcaOtherCompoundViewModel
{
OtherCompounds = result.ToList(),
Options = //parameterservice.GetNonYearlyParameterOptions(Categories.OtherCompound),
parameterservice.GetARnGWPoptions(GWPparameterType.Others, LCAID),
//SheetHeader = service.GetSheetHeader(LCAID, Categories.OtherCompound)
SheetHeader = new SheetHeader()
};
return ret2;
}
return new LcaOtherCompoundViewModel();
}
}
}