private void ImportByOrdID() { using (MetaDataServiceClient _mdc = new MetaDataServiceClient()) { //将所有顶级的指标的父指向当前的指标ID List <MD_GuideLine> _topLevelGuideLine = GetTopLevelGuideLines(); foreach (MD_GuideLine _gl in _topLevelGuideLine) { _gl.FatherID = this.CurrentGuideLine.ID; } decimal _count = Convert.ToDecimal(SelectedGuideLines.Count); decimal i = 0; foreach (MD_GuideLine _gl in this.SelectedGuideLines) { if (_mdc.IsExistGuideLineID(_gl.ID)) { _mdc.SaveGuideLine(_gl); } else { _mdc.SaveNewGuideLine(_gl); } decimal _progress = i / _count * 100; i++; this.backgroundWorker1.ReportProgress(Convert.ToInt32(_progress)); } } }
private void ImportByNewID() { using (MetaDataServiceClient _mdc = new MetaDataServiceClient()) { //将所有顶级的指标的父指向当前的指标ID,并修改指标ID List <MD_GuideLine> _topLevelGuideLine = GetTopLevelGuideLines(); decimal _count = Convert.ToDecimal(_topLevelGuideLine.Count); decimal i = 0; foreach (MD_GuideLine _gl in _topLevelGuideLine) { _gl.FatherID = this.CurrentGuideLine.ID; _gl.ID = _mdc.GetNewID(); ChangeChildrenID(_gl); decimal _progress = i / _count * 50; i++; this.backgroundWorker1.ReportProgress(Convert.ToInt32(_progress)); } _count = Convert.ToDecimal(SelectedGuideLines.Count); i = 0; foreach (MD_GuideLine _gl in this.SelectedGuideLines) { if (_mdc.IsExistGuideLineID(_gl.ID)) { XtraMessageBox.Show(string.Format("新建的ID:{0}已经存在,请管理员检查序列产生器!!!", _gl.ID), "系统提示"); break; } else { _mdc.SaveNewGuideLine(_gl); } decimal _progress = i / _count * 50 + 50; i++; this.backgroundWorker1.ReportProgress(Convert.ToInt32(_progress)); } } }