public void DependentUpdateManScheme(int DependentupdID, string EmployeeID, string Name, string Surname, string IDCardNo, string ContactNo, DateTime BirthDate, DateTime StartDate, DateTime EndDate, string Relation, double Payment)
{
HealthCareSystem.DataClassesDataContext db = new HealthCareSystem.DataClassesDataContext();
var z = (from d in db.Dependents
where d.EmployeeID.Equals(EmployeeID)
join r in db.Relations on d.RelationID equals r.RelationID
select new DependentsX { DependentID = d.DependentID, EmployeeID = d.EmployeeID, Name = d.Name, Surname = d.Surname, IDCardNo = d.IDCardNo, ContactNo = d.ContactNo, BirthDate = d.BirthDate, StartSchemeDate = d.StartDate, EndSchemeDate = d.EndDate, RelationType = r.Type, Payment = d.Payment });
List<DependentsX> oldList = z.ToList();
foreach (DependentsX dep in oldList)
{
dep.DependentID = DependentupdID;
dep.EmployeeID = EmployeeID;
dep.Name = Name;
dep.Surname = Surname;
dep.IDCardNo = IDCardNo;
dep.ContactNo = ContactNo;
dep.BirthDate = BirthDate;
dep.StartSchemeDate = StartDate;
dep.EndSchemeDate = EndDate;
dep.RelationID = Convert.ToInt32(Relation);
dep.Payment = Payment;
db.SubmitChanges();
}
问问题
67 次