/// <summary> /// 更新 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OKButton_Click(object sender, RoutedEventArgs e) { List <SMT.SaaS.FrameworkUI.Validator.ValidatorBase> validators = Group1.ValidateAll(); if (validators.Count > 0) { //could use the content of the list to show an invalid message summary somehow //MessageBox.Show(validators.Count.ToString() + " invalid validators"); return; } List <T_OA_LICENSEDETAIL> removeArr = new List <T_OA_LICENSEDETAIL>(); for (int i = 0; i < licenseDetail.Count; i++) { if (i < licenseOriginalDetail.Count) { if (licenseDetail[i].ADDRESS != licenseOriginalDetail[i].ADDRESS) { continue; } if (licenseDetail[i].BUSSINESSAREA != licenseOriginalDetail[i].BUSSINESSAREA) { continue; } if (licenseDetail[i].FROMDATE != licenseOriginalDetail[i].FROMDATE) { continue; } if (licenseDetail[i].TODATE != licenseOriginalDetail[i].TODATE) { continue; } if (licenseDetail[i].REGISTERTYPE != licenseOriginalDetail[i].REGISTERTYPE) { continue; } if (licenseDetail[i].REGISTERCHARGE != licenseOriginalDetail[i].REGISTERCHARGE) { continue; } if (licenseDetail[i].REMARK != licenseOriginalDetail[i].REMARK) { continue; } if (licenseDetail[i].LEGALPERSON != licenseOriginalDetail[i].LEGALPERSON) { continue; } if (licenseDetail[i].LICENCENO != licenseOriginalDetail[i].LICENCENO) { continue; } removeArr.Add(licenseDetail[i]); } } if (removeArr.Count > 0) { foreach (var item in removeArr) { licenseDetail.Remove(item); } } licenseOriginalDetail.Clear(); //更新的 foreach (var license in licenseDetail) { T_OA_LICENSEDETAIL licenseDetailTmp = new T_OA_LICENSEDETAIL(); licenseDetailTmp.LICENSEDETAILID = Guid.NewGuid().ToString(); licenseDetailTmp.T_OA_LICENSEMASTER = licenseMaster; licenseDetailTmp.T_OA_LICENSEMASTER.LICENSEMASTERID = licenseMaster.LICENSEMASTERID; //licenseDetailTmp.LICENSEMASTERID = license.LICENSEMASTERID; licenseDetailTmp.REGISTERTYPE = license.REGISTERTYPE; licenseDetailTmp.REGISTERCHARGE = license.REGISTERCHARGE; licenseDetailTmp.ADDRESS = license.ADDRESS; licenseDetailTmp.BUSSINESSAREA = license.BUSSINESSAREA; licenseDetailTmp.FROMDATE = license.FROMDATE; licenseDetailTmp.TODATE = license.TODATE; licenseDetailTmp.LICENCENO = license.LICENCENO; licenseDetailTmp.LEGALPERSON = license.LEGALPERSON; licenseDetailTmp.REMARK = license.REMARK; licenseDetailTmp.CREATECOMPANYID = "smt"; licenseDetailTmp.CREATEDEPARTMENTID = "oa"; licenseDetailTmp.CREATEPOSTID = "soft"; licenseDetailTmp.CREATEDATE = DateTime.Now; licenseDetailTmp.CREATEUSERID = "admin"; licenseDetailTmp.UPDATEDATE = DateTime.Now; licenseDetailTmp.UPDATEUSERID = "admin"; licenseOriginalDetail.Add(licenseDetailTmp); } licenseMaster.UPDATEDATE = DateTime.Now; licenseMaster.UPDATEUSERID = "admin"; client.UpdateLicenseDetailAsync(licenseOriginalDetail, licenseMaster); }