//尾差处理 private void ManageTailDifference(ref TailDifferenceViewModel tailDifferenceViewModel) { tailDifferenceViewModel.AnnualPriceDifference = njc.ToString(); if (catagorySet.pcc_jk.costValue != 0) { catagorySet.pcc_jk.costValue += njc; tailDifferenceViewModel.ItemWithTailDifference = catagorySet.pcc_jk.catagoryName; tailDifferenceViewModel.TailDifference = catagorySet.pcc_weicha.costValue.ToString(); catagorySet.pcc_jk.costValue += catagorySet.pcc_weicha.costValue; } else if (catagorySet.pcc_dl.costValue != 0) { catagorySet.pcc_dl.costValue += njc; tailDifferenceViewModel.ItemWithTailDifference = catagorySet.pcc_dl.catagoryName; tailDifferenceViewModel.TailDifference = catagorySet.pcc_weicha.costValue.ToString(); catagorySet.pcc_dl.costValue += catagorySet.pcc_weicha.costValue; } else if (catagorySet.pcc_pd_az.costValue != 0) { catagorySet.pcc_pd_az.costValue += njc; tailDifferenceViewModel.ItemWithTailDifference = catagorySet.pcc_pd_az.catagoryName; tailDifferenceViewModel.TailDifference = catagorySet.pcc_weicha.costValue.ToString(); catagorySet.pcc_pd_az.costValue += catagorySet.pcc_weicha.costValue; } else if (catagorySet.pcc_pd_sb.costValue != 0) { catagorySet.pcc_pd_sb.costValue += njc; tailDifferenceViewModel.ItemWithTailDifference = catagorySet.pcc_pd_sb.catagoryName; tailDifferenceViewModel.TailDifference = catagorySet.pcc_weicha.costValue.ToString(); catagorySet.pcc_pd_sb.costValue += catagorySet.pcc_weicha.costValue; } else if (catagorySet.pcc_pd_jz.costValue != 0) { catagorySet.pcc_pd_jz.costValue += njc; tailDifferenceViewModel.ItemWithTailDifference = catagorySet.pcc_pd_jz.catagoryName; tailDifferenceViewModel.TailDifference = catagorySet.pcc_weicha.costValue.ToString(); catagorySet.pcc_pd_jz.costValue += catagorySet.pcc_weicha.costValue; } else if (catagorySet.pcc_tx_az.costValue != 0) { catagorySet.pcc_tx_az.costValue += njc; tailDifferenceViewModel.ItemWithTailDifference = catagorySet.pcc_tx_az.catagoryName; tailDifferenceViewModel.TailDifference = catagorySet.pcc_weicha.costValue.ToString(); catagorySet.pcc_tx_az.costValue += catagorySet.pcc_weicha.costValue; } else if (catagorySet.pcc_tx_sb.costValue != 0) { catagorySet.pcc_tx_sb.costValue += njc; tailDifferenceViewModel.ItemWithTailDifference = catagorySet.pcc_tx_sb.catagoryName; tailDifferenceViewModel.TailDifference = catagorySet.pcc_weicha.costValue.ToString(); catagorySet.pcc_tx_sb.costValue += catagorySet.pcc_weicha.costValue; } else { catagorySet.pcc_tx_jz.costValue += njc; tailDifferenceViewModel.ItemWithTailDifference = catagorySet.pcc_tx_jz.catagoryName; tailDifferenceViewModel.TailDifference = catagorySet.pcc_weicha.costValue.ToString(); catagorySet.pcc_tx_jz.costValue += catagorySet.pcc_weicha.costValue; } }
//从文件获取数据 private void GetData(ref ProjectEstimateSetViewModel projectEstimateSetViewModel, ref TailDifferenceViewModel tdvm) { string datafile = _datapath + DataFileName; DataSet ds = XmlOperate.GetDataSet(datafile); DataTable dt = ds.Tables[0]; DataTable dt2 = ds.Tables[1]; projectEstimateSetViewModel = new ProjectEstimateSetViewModel(dt); tdvm = new TailDifferenceViewModel(); tdvm.TailDifference = dt2.DefaultView[0]["TailDifference"].ToString(); tdvm.ItemWithTailDifference = dt2.DefaultView[0]["ItemWithTailDifference"].ToString(); tdvm.CompositeTaxRate = dt2.DefaultView[0]["CompositeTaxRate"].ToString(); tdvm.AnnualPriceDifference = dt2.DefaultView[0]["AnnualPriceDifference"].ToString(); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (isadd) { DataFileName = "mould"; this.button_import.IsEnabled = true; this.Item_projectname.IsReadOnly = false; this.combo_item_projectname.IsEnabled = true; } else { this.Item_projectname.IsReadOnly = true; this.combo_item_projectname.IsEnabled = false; this.button_import.IsEnabled = false; } tdvm = new TailDifferenceViewModel(); GetData(ref projectEstimateSetViewModel, ref tdvm); //Bind the DataGrid this.DataContext = tdvm; DG1.DataContext = projectEstimateSetViewModel.EstimateViewModels; }