private void BindSourceData() { try { //提成比率 pts_proj_ratio[] arr = pts_proj_ratioDao.FindAll(); if (arr.Length > 0) { for (int i = 0; i < arr.Length; i++) { ucRatio uc = new ucRatio(arr[i].ID.ToString(), arr[i]); uc.DelSelectRatio += uc_DelSelectRatio; this.panel1.Children.Add(uc); } } //项目成本 PTS_PROJ_COST[] arr2 = PTS_PROJ_COSTDAO.FindAll(); if (arr2.Length > 0) { for (int i = 0; i < arr2.Length; i++) { ucProjCost uc = new ucProjCost(arr2[i].ID.ToString(), arr2[i]); uc.DelSelectCost += uc_DelSelectCost; this.panel2.Children.Add(uc); } } //可分配比例 PTS_OBJECT_TYPE_SRC[] arr3 = PTS_OBJECT_TYPE_SRCDAO.FindAll(new EqExpression("STATUS", 1)); if (arr3.Length > 0) { for (int i = 0; i < arr3.Length; i++) { ucRatio3 uc = new ucRatio3(arr3[i]); uc.DelSelectRatio += uc_DelSelectRatio; this.panel3.Children.Add(uc); } } //if (src != null) //{ // mSrc = src; // this.txtRatio_1.Text = src.RATIO1.ToString(); // this.txtRatio_2.Text = src.RATIO2.ToString(); //} } catch (Exception ex) { MessageHelper.ShowMessage(ex.Message); } }
private void btnAdd3_Click(object sender, RoutedEventArgs e) { try { //新增 ucRatio3 uc = new ucRatio3(System.Guid.NewGuid().ToString()); uc.DelSelectRatio += uc_DelSelectRatio; this.panel3.Children.Add(uc); } catch (Exception ex) { MessageHelper.ShowMessage(ex.Message); } }
void uc_DelSelectRatio(ucRatio3 uc) { try { foreach (UserControl _uc in panel3.Children) { if ((_uc as ucRatio3).ucID == uc.ucID) { panel3.Children.Remove(_uc); break; } } } catch (Exception ex) { MessageHelper.ShowMessage(ex.Message); } }