public int Create(int DocumentID, int?DocumentDetailID, int?TeamID, int?EmployeeID) { int result = 1; WareDocumentStaffDetail sr = WareDocumentStaffDetail.CreateWareDocumentStaffDetail(1, DocumentID); sr.DocumenDetailID = DocumentDetailID; sr.TeamID = TeamID; sr.EmployeeID = EmployeeID; context.AddToWareDocumentStaffDetails(sr); return(result); }
public void SaveDocumentWithEmployees(WareDocument Document, StaffEmployee Employee, int?TeamID, string Mode) { //перевіряємо чи даний працівник закріплений за документом WareDocumentStaffDetail exists = (from a in context.WareDocumentStaffDetails where a.EmployeeID == Employee.ID & a.DocumentID == Document.ID select a).FirstOrDefault(); if (exists == null) { WareDocumentStaffDetail d = new WareDocumentStaffDetail(); d.StaffEmployee = Employee; d.TeamID = TeamID; Document.WareDocumentStaffDetails.Add(d); context.AddToWareDocumentStaffDetails(d); } //if (Mode == "new") // context.AddToWareDocuments(Document); }