20230531 脚本、版本日志整理
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using WIA;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class ExpenseDetailService
|
||||
{
|
||||
|
||||
|
||||
public static List<Model.CostGoods_ExpenseDetail> GetExpenseDetailsByExpenseId(string expenseId)
|
||||
{
|
||||
return (from x in Funs.DB.CostGoods_ExpenseDetail where x.ExpenseId == expenseId select x).ToList();
|
||||
@@ -17,40 +18,52 @@ namespace BLL
|
||||
/// 增加费用明细信息
|
||||
/// </summary>
|
||||
/// <param name="pauseNotice">费用明细实体</param>
|
||||
public static void AddCostDetail(string expenseId )
|
||||
{
|
||||
public static void AddCostDetail(string expenseId)
|
||||
{
|
||||
DeleteCostDetailByExpenseId(expenseId);
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var getItems = from x in db.Base_CostTypeItem
|
||||
join y in db.Base_CostType on x.CostTypeId equals y.CostTypeId
|
||||
select new
|
||||
{
|
||||
SupCostTypeId = y.CostTypeId,
|
||||
SupCostTypeName = y.CostTypeName,
|
||||
SupSortIndex = y.CostTypeCode,
|
||||
CostType = x.CostTypeId,
|
||||
CostTypeName=x.CostTypeItemName,
|
||||
SortIndex=x.SortIndex,
|
||||
CostMoney=0,
|
||||
};
|
||||
foreach (var item in getItems)
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
Model.CostGoods_ExpenseDetail newExpenseDetail = new Model.CostGoods_ExpenseDetail
|
||||
var getItems = from x in db.Base_CostTypeItem
|
||||
join y in db.Base_CostType on x.CostTypeId equals y.CostTypeId
|
||||
select new
|
||||
{
|
||||
ExpenseId=expenseId,
|
||||
SupCostTypeId = y.CostTypeId,
|
||||
SupCostTypeName = y.CostTypeName,
|
||||
SupSortIndex = y.CostTypeCode,
|
||||
CostType = x.CostTypeItemId,
|
||||
CostTypeName = x.CostTypeItemName,
|
||||
SortIndex = x.SortIndex,
|
||||
CostMoney = 0,
|
||||
};
|
||||
foreach (var item in getItems)
|
||||
{
|
||||
ExpenseDetailId = SQLHelper.GetNewID(),
|
||||
ExpenseId = expenseId,
|
||||
SupCostTypeId=item.SupCostTypeId,
|
||||
SupCostTypeName=item.SupCostTypeName,
|
||||
SupSortIndex=item.SupSortIndex,
|
||||
Model.CostGoods_ExpenseDetail newExpenseDetail = new Model.CostGoods_ExpenseDetail
|
||||
{
|
||||
ExpenseDetailId = SQLHelper.GetNewID(),
|
||||
ExpenseId = expenseId,
|
||||
SupCostTypeId = item.SupCostTypeId,
|
||||
SupCostTypeName = item.SupCostTypeName,
|
||||
SupSortIndex = item.SupSortIndex,
|
||||
CostType = item.CostType,
|
||||
CostTypeName = item.CostTypeName,
|
||||
SortIndex = item.SortIndex,
|
||||
CostMoney = item.CostMoney,
|
||||
};
|
||||
db.CostGoods_ExpenseDetail.InsertOnSubmit(newExpenseDetail);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CostType = item.CostType,
|
||||
CostTypeName = item.CostTypeName,
|
||||
SortIndex=item.SortIndex,
|
||||
CostMoney = item.CostMoney,
|
||||
};
|
||||
db.CostGoods_ExpenseDetail.InsertOnSubmit(newExpenseDetail);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
public static void UpdateExpenseDetail(Model.CostGoods_ExpenseDetail newItem)
|
||||
{
|
||||
var getData = Funs.DB.CostGoods_ExpenseDetail.FirstOrDefault(x => x.ExpenseDetailId == newItem.ExpenseDetailId);
|
||||
if (getData != null)
|
||||
{
|
||||
getData.CostMoney = newItem.CostMoney;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,12 +73,14 @@ namespace BLL
|
||||
/// <param name="expenseId">编号</param>
|
||||
public static void DeleteCostDetailByExpenseId(string expenseId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = from x in db.CostGoods_ExpenseDetail where x.ExpenseId == expenseId select x;
|
||||
if (q.Count() > 0)
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
db.CostGoods_ExpenseDetail.DeleteAllOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
var q = from x in db.CostGoods_ExpenseDetail where x.ExpenseId == expenseId select x;
|
||||
if (q.Count() > 0)
|
||||
{
|
||||
db.CostGoods_ExpenseDetail.DeleteAllOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user