public Assay AddAssayWithUnitOfWork(Sample newSample, SampleDetail newSampleDetail, int user_id, Contract cont, IList <GrainQualityIndex> GrainQualityIndexList, List <string> resultList, AssayStatus status, string AssayBillIndex, OrganizationDepartment org, int gradeID) { Assay newAssay = new Assay(); int billID = _sysBillNoService.GetBillNoID("QUM", "ASN"); newAssay.assay_number = _sysBillNoService.GetBillNo(billID); //newAssay.assay_result = null; //newAssay.bill_owner_org = 1; //newAssay.confirm_time = null; newAssay.confirm_user = user_id; newAssay.create_time = _sPGetSysDateTimeService.GetSysDateTime(); newAssay.grain_grade = gradeID; newAssay.remark = ""; newAssay.sample_number = newSample.sample_number; newAssay.status = (int)status; _unitOfWork.AddAction(newAssay, DataActions.Add); AddAssayBillWithUnitOfWork(newAssay, user_id, newSampleDetail, cont, GrainQualityIndexList, resultList, AssayBillIndex); //newAssay.grain_grade = JudgeGrainGrade(newAssay.AssayBills.First().AssayResults, return(newAssay); }
public Assay UpdAssayWithUnitOfWork(Assay assay, AssayBill assayBill, IList <AssayResult> assayResults, IList <GrainQualityIndex> grainQualityIndexList, List <string> resultList, AssayStatus status) { assay.status = (int)status; _unitOfWork.AddAction(assay, DataActions.Update); ////删除 foreach (AssayResult ar in assayBill.AssayResults) { _unitOfWork.AddAction(ar, DataActions.Delete); } //新增 if (grainQualityIndexList.Count != 0) { AddAssayResultWithUnitOfWork(assayBill, assay.Sample.Enrolment1.Contract, grainQualityIndexList, resultList); } _unitOfWork.Save(); return(assay); }