private void BindProjTeam(TB_PROJECT proj) { this.panel1.Children.Clear(); this.panel2.Children.Clear(); string leader = proj.TEAMLEDER; string[] members = proj.TEAMMEMBER.Split('|'); if (!string.IsNullOrEmpty(leader)) { ucRatio2 uc = new ucRatio2(leader, proj.Id); this.panel1.Children.Add(uc); } if (members.Length > 0) { for (int i = 0; i < members.Length; i++) { if (!string.IsNullOrEmpty(members[i])) { ucRatio2 uc = new ucRatio2(members[i], proj.Id); this.panel2.Children.Add(uc); } } } }
private void btnSubmit_Click(object sender, RoutedEventArgs e) { List <TB_RATIO> list = new List <TB_RATIO>(); decimal total = 0; //项目负责人 for (int i = 0; i < panel1.Children.Count; i++) { ucRatio2 uc = panel1.Children[i] as ucRatio2; string usercode = uc.labName.Content.ToString(); string ratio = uc.txtRatio.Text; decimal d = 0; decimal.TryParse(ratio, out d); TB_RATIO ro = new TB_RATIO(); ro.USERCODE = usercode; ro.RATIO = d; ro.PROJECTID = (txtProj.Tag as TB_PROJECT).Id; ro.STATUS = 1; list.Add(ro); total += d; } //项目成员 for (int i = 0; i < panel2.Children.Count; i++) { ucRatio2 uc = panel2.Children[i] as ucRatio2; string usercode = uc.labName.Content.ToString(); string ratio = uc.txtRatio.Text; decimal d = 0; decimal.TryParse(ratio, out d); TB_RATIO ro = new TB_RATIO(); ro.USERCODE = usercode; ro.RATIO = d; ro.PROJECTID = (txtProj.Tag as TB_PROJECT).Id; ro.STATUS = 1; list.Add(ro); total += d; } bool flag = RatioBusiness.delete((txtProj.Tag as TB_PROJECT).Id); if (flag) { for (int i = 0; i < list.Count; i++) { list[i].Save(); } MessageHelper.ShowMessage("保存成功!"); this.Close(); } else { MessageHelper.ShowMessage("保存失败!"); } }