using System.Collections.Generic;
using System.Linq;
namespace BLL
{
public class ConstructionMonthReportSubCostService
{
public static Model.SGGLDB db = Funs.DB;
///
/// 获取施工月报分包工程施工付款情况模板列表
///
///
///
///
public static List getListData(string ConstructionMonthReportId)
{
return (from x in Funs.DB.ZHGL_ConstructionMonthReportSubCost
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
where x.ConstructionMonthReportId == ConstructionMonthReportId
orderby y.UnitCode
select x).ToList();
}
///
/// 增加施工月报分包工程施工付款情况
///
/// 施工月报分包工程施工付款情况实体
public static void AddConstructionMonthReportSubCost(Model.ZHGL_ConstructionMonthReportSubCost ConstructionMonthReportSubCost)
{
Model.SGGLDB db = Funs.DB;
Model.ZHGL_ConstructionMonthReportSubCost newApprove = new Model.ZHGL_ConstructionMonthReportSubCost();
newApprove.ConstructionMonthReportSubCostId = ConstructionMonthReportSubCost.ConstructionMonthReportSubCostId;
newApprove.ConstructionMonthReportId = ConstructionMonthReportSubCost.ConstructionMonthReportId;
newApprove.UnitId = ConstructionMonthReportSubCost.UnitId;
newApprove.ContractAmount = ConstructionMonthReportSubCost.ContractAmount;
newApprove.ThisNeedPay = ConstructionMonthReportSubCost.ThisNeedPay;
newApprove.ThisRealPay = ConstructionMonthReportSubCost.ThisRealPay;
newApprove.TotalNeedPay = ConstructionMonthReportSubCost.TotalNeedPay;
newApprove.TotalRealPay = ConstructionMonthReportSubCost.TotalRealPay;
newApprove.TotalRealPayRate = ConstructionMonthReportSubCost.TotalRealPayRate;
db.ZHGL_ConstructionMonthReportSubCost.InsertOnSubmit(newApprove);
db.SubmitChanges();
}
///
/// 根据月报id删除对应的所有施工月报分包工程施工付款情况
///
/// 施工月报分包工程施工付款情况编号
public static void DeleteConstructionMonthReportSubCostsByConstructionMonthReportId(string ConstructionMonthReportId)
{
Model.SGGLDB db = Funs.DB;
var q = (from x in db.ZHGL_ConstructionMonthReportSubCost where x.ConstructionMonthReportId == ConstructionMonthReportId select x).ToList();
if (q.Count() > 0)
{
db.ZHGL_ConstructionMonthReportSubCost.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
///
/// 根据月报id获取对应的所有施工月报分包工程施工付款情况
///
/// 施工月报分包工程施工付款情况编号
public static List GetConstructionMonthReportSubCostsByConstructionMonthReportId(string ConstructionMonthReportId)
{
Model.SGGLDB db = Funs.DB;
return (from x in db.ZHGL_ConstructionMonthReportSubCost where x.ConstructionMonthReportId == ConstructionMonthReportId select x).ToList();
}
}
}