微调

parent 2cfc4b6b
...@@ -293,40 +293,29 @@ public void Clear(int allotId) ...@@ -293,40 +293,29 @@ public void Clear(int allotId)
/// <param name="iD"></param> /// <param name="iD"></param>
public void Copy(per_allot allot) public void Copy(per_allot allot)
{ {
var list = perforPerAllotRepository.GetEntities(t => t.HospitalId == allot.HospitalId).OrderByDescending(t => t.Year).ThenBy(t => t.Month).ToList(); var list = perforPerAllotRepository.GetEntities(t => t.HospitalId == allot.HospitalId)
.OrderBy(t => t.Year).ThenBy(t => t.Month).ToList();
int allotId = 0; int allotId = 0;
for (int i = 0; i < list.Count; i++) for (int i = 0; i < list.Count; i++)
{ {
if (list[i].ID == allot.ID && (i - 1) >= 0) if (list[i].ID == allot.ID && (i - 1) >= 0)
allotId = list[i - 1].ID; allotId = list[i - 1].ID;
} }
if (allotId > 0) var director = _directorRepository.GetEntities(t => t.AllotID == allotId) ?? _directorRepository.GetEntities(t => t.AllotID == -1);
{ var newDirectors = director.Select(t => new cof_director { AllotID = allot.ID, JobTitle = t.JobTitle, TypeName = t.TypeName, Value = t.Value });
var director = _directorRepository.GetEntities(t => t.AllotID == allotId); _directorRepository.AddRange(newDirectors.ToArray());
if (director != null)
{ var durgprop = _drugpropRepository.GetEntities(t => t.AllotID == allotId) ?? _drugpropRepository.GetEntities(t => t.AllotID == -1);
var addData = director.Select(t => new cof_director { AllotID = allot.ID, JobTitle = t.JobTitle, TypeName = t.TypeName, Value = t.Value }); var newDurgprops = durgprop.Select(t => new cof_drugprop { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = t.Value });
_directorRepository.AddRange(addData.ToArray()); _drugpropRepository.AddRange(newDurgprops.ToArray());
}
var durgprop = _drugpropRepository.GetEntities(t => t.AllotID == allotId); var income = _incomeRepository.GetEntities(t => t.AllotID == allotId) ?? _incomeRepository.GetEntities(t => t.AllotID == -1);
if (durgprop != null) var newIncomes = income.Select(t => new cof_income { AllotID = allot.ID, SheetNameKeyword = t.SheetNameKeyword, UnitName = t.UnitName, Value = t.Value });
{ _incomeRepository.AddRange(newIncomes.ToArray());
var addData = durgprop.Select(t => new cof_drugprop { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = t.Value });
_drugpropRepository.AddRange(addData.ToArray()); var workyear = _workyearRepository.GetEntities(t => t.AllotID == allotId) ?? _workyearRepository.GetEntities(t => t.AllotID == -1);
} var newWorkyears = workyear.Select(t => new cof_workyear { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = t.Value });
var income = _incomeRepository.GetEntities(t => t.AllotID == allotId); _workyearRepository.AddRange(newWorkyears.ToArray());
if (income != null)
{
var addData = income.Select(t => new cof_income { AllotID = allot.ID, SheetNameKeyword = t.SheetNameKeyword, UnitName = t.UnitName, Value = t.Value });
_incomeRepository.AddRange(addData.ToArray());
}
var workyear = _workyearRepository.GetEntities(t => t.AllotID == allotId);
if (workyear != null)
{
var addData = workyear.Select(t => new cof_workyear { AllotID = allot.ID, MaxRange = t.MaxRange, MinRange = t.MinRange, Value = t.Value });
_workyearRepository.AddRange(addData.ToArray());
}
}
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment