2023-08-31
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FineUIPro;
|
||||
@@ -33,7 +34,10 @@ namespace BLL
|
||||
(string.IsNullOrEmpty(table.ACWP_OutputValue) ||
|
||||
x.ACWP_OutputValue.Contains(table.ACWP_OutputValue)) &&
|
||||
(string.IsNullOrEmpty(table.ACWP_Percentage) ||
|
||||
x.ACWP_Percentage.Contains(table.ACWP_Percentage))
|
||||
x.ACWP_Percentage.Contains(table.ACWP_Percentage)) &&
|
||||
(string.IsNullOrEmpty(table.Date) ||
|
||||
x.Date.Contains(table.Date))
|
||||
orderby x.Date
|
||||
select x
|
||||
;
|
||||
|
||||
@@ -63,7 +67,8 @@ namespace BLL
|
||||
x.BCWS_Percentage,
|
||||
x.ACWP_Quantity,
|
||||
x.ACWP_OutputValue,
|
||||
x.ACWP_Percentage
|
||||
x.ACWP_Percentage,
|
||||
x.Date
|
||||
};
|
||||
}
|
||||
|
||||
@@ -75,7 +80,52 @@ namespace BLL
|
||||
x.ContractTrackProgressId == ContractTrackProgressId);
|
||||
}
|
||||
|
||||
public static void CreateTemplateByContractTrackId(string ContractTrackId)
|
||||
{
|
||||
var model = PhtglContractTrackService.GetPHTGL_ContractTrackById(ContractTrackId);
|
||||
if (model == null) return;
|
||||
var contractNum=model.ContractNum;
|
||||
var contractmode = ContractService.GetContractByContractNum(contractNum);
|
||||
if (contractmode.ContractStartDate != null && contractmode.ContractEndDate != null)
|
||||
{
|
||||
var startDate = (DateTime)contractmode.ContractStartDate;
|
||||
var endDate = (DateTime)contractmode.ContractEndDate;
|
||||
List<DateTime> months = GetMonthsBetween(startDate, endDate);
|
||||
|
||||
foreach (DateTime month in months)
|
||||
{
|
||||
var querymodel = new Model.PHTGL_ContractTrackProgress
|
||||
{
|
||||
ContractTrackId = ContractTrackId,
|
||||
Date= month.ToString("yyyy-MM")
|
||||
};
|
||||
if (!GetPHTGL_ContractTrackProgressByModle(querymodel).Any())
|
||||
{
|
||||
var newmodel = new Model.PHTGL_ContractTrackProgress();
|
||||
newmodel.ContractTrackProgressId = SQLHelper.GetNewID(typeof(Model.PHTGL_ContractTrackProgress));
|
||||
newmodel.ContractTrackId = ContractTrackId;
|
||||
newmodel.Date = month.ToString("yyyy-MM");
|
||||
AddPHTGL_ContractTrackProgress(newmodel);
|
||||
}
|
||||
//Console.WriteLine(month.ToString("yyyy-MM"));
|
||||
}
|
||||
}
|
||||
}
|
||||
public static List<DateTime> GetMonthsBetween(DateTime startDate, DateTime endDate)
|
||||
{
|
||||
List<DateTime> months = new List<DateTime>();
|
||||
|
||||
DateTime currentMonth = new DateTime(startDate.Year, startDate.Month, 1);
|
||||
DateTime lastMonth = new DateTime(endDate.Year, endDate.Month, 1);
|
||||
|
||||
while (currentMonth <= lastMonth)
|
||||
{
|
||||
months.Add(currentMonth);
|
||||
currentMonth = currentMonth.AddMonths(1);
|
||||
}
|
||||
|
||||
return months;
|
||||
}
|
||||
public static void AddPHTGL_ContractTrackProgress(PHTGL_ContractTrackProgress newtable)
|
||||
{
|
||||
var table = new PHTGL_ContractTrackProgress
|
||||
@@ -87,7 +137,9 @@ namespace BLL
|
||||
BCWS_Percentage = newtable.BCWS_Percentage,
|
||||
ACWP_Quantity = newtable.ACWP_Quantity,
|
||||
ACWP_OutputValue = newtable.ACWP_OutputValue,
|
||||
ACWP_Percentage = newtable.ACWP_Percentage
|
||||
ACWP_Percentage = newtable.ACWP_Percentage,
|
||||
Date = newtable.Date
|
||||
|
||||
};
|
||||
Funs.DB.PHTGL_ContractTrackProgress.InsertOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
@@ -108,6 +160,7 @@ namespace BLL
|
||||
table.ACWP_Quantity = newtable.ACWP_Quantity;
|
||||
table.ACWP_OutputValue = newtable.ACWP_OutputValue;
|
||||
table.ACWP_Percentage = newtable.ACWP_Percentage;
|
||||
table.Date =newtable.Date;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user