84 lines
3.2 KiB
C#
84 lines
3.2 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Data.Linq;
|
|
using System.Web.Security;
|
|
using System.Web.UI.WebControls;
|
|
using Model;
|
|
using BLL;
|
|
using System.Collections.Generic;
|
|
|
|
namespace BLL
|
|
{
|
|
public class WbsDetailHistoryService
|
|
{
|
|
/// <summary>
|
|
/// 根据Id获取一个WBS版本历史明细信息
|
|
/// </summary>
|
|
/// <param name="wbsDetailHistoryId">WBS版本历史明细Id</param>
|
|
public static Model.WbsDetailHistory GetWbsDetailHistoryByWbsDetailHistoryId(string wbsDetailHistoryId)
|
|
{
|
|
return Funs.DB.WbsDetailHistory.FirstOrDefault(e => e.WbsDetailHistoryId == wbsDetailHistoryId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据toWbs获取对应WBS版本历史明细信息
|
|
/// </summary>
|
|
/// <param name="toWbs">对应wbsId</param>
|
|
public static List<Model.WbsDetailHistory> GetWbsDetailHistorysByToWbs(string toWbs)
|
|
{
|
|
return (from x in Funs.DB.WbsDetailHistory where x.ToWbs == toWbs orderby Convert.ToInt32(x.VersionNum.Substring(1, x.VersionNum.Length - 3)), x.Months select x).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加WBS版本历史明细
|
|
/// </summary>
|
|
/// <param name="user">WBS版本历史明细</param>
|
|
public static void AddWbsDetailHistory(Model.WbsDetailHistory wbsDetailHistory)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.WbsDetailHistory newWbsDetailHistory = new Model.WbsDetailHistory();
|
|
newWbsDetailHistory.WbsDetailHistoryId = wbsDetailHistory.WbsDetailHistoryId;
|
|
newWbsDetailHistory.ToWbs = wbsDetailHistory.ToWbs;
|
|
newWbsDetailHistory.ToFlag = wbsDetailHistory.ToFlag;
|
|
newWbsDetailHistory.Way = wbsDetailHistory.Way;
|
|
newWbsDetailHistory.Months = wbsDetailHistory.Months;
|
|
newWbsDetailHistory.PlanValue = wbsDetailHistory.PlanValue;
|
|
newWbsDetailHistory.PlanValueRate = wbsDetailHistory.PlanValueRate;
|
|
newWbsDetailHistory.VersionNum = wbsDetailHistory.VersionNum;
|
|
|
|
db.WbsDetailHistory.InsertOnSubmit(newWbsDetailHistory);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据Id删除WBS版本历史明细信息
|
|
/// </summary>
|
|
/// <param name="userId"></param>
|
|
public static void DeleteWbsDetailHistory(string wbsDetailHistoryId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.WbsDetailHistory ins = db.WbsDetailHistory.First(e => e.WbsDetailHistoryId == wbsDetailHistoryId);
|
|
db.WbsDetailHistory.DeleteOnSubmit(ins);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据toWbs删除WBS版本历史明细信息
|
|
/// </summary>
|
|
/// <param name="userId"></param>
|
|
public static void DeleteWbsDetailHistoryByToWbs(string toWbs)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
var details = from x in db.WbsDetailHistory where x.ToWbs == toWbs select x;
|
|
if (details.Count() > 0)
|
|
{
|
|
db.WbsDetailHistory.DeleteAllOnSubmit(details);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
}
|