public 評量比例() { List <WeightProportion> wpList = tool._A.Select <WeightProportion>(); if (wpList.Count > 0) { _wp = wpList[0]; } else { return; } if (_wp != null) { if (!string.IsNullOrEmpty(_wp.Proportion)) { int Columnindex = 0; XmlElement xml = DSXmlHelper.LoadXml(_wp.Proportion); foreach (XmlElement xml2 in xml.SelectNodes("Item")) { //記錄位置 ColumnDic.Add(xml2.GetAttribute("Name"), Columnindex); //記錄比例 ProportionDic.Add(xml2.GetAttribute("Name"), int.Parse(xml2.GetAttribute("Proportion"))); Columnindex++; } } } }
/// <summary> /// 取得比例原則 /// </summary> public void SetWeightProportion() { List <WeightProportion> wpList = tool._A.Select <WeightProportion>(); if (wpList.Count >= 1) { _wp = wpList[0]; } }
private void GradingProjectConfig_Load(object sender, EventArgs e) { dataGridViewX1.Rows.Clear(); List <WeightProportion> list = _AccessHelper.Select <WeightProportion>(); if (list.Count == 0) { #region 預設 //當沒有設定任何比例時,提供預設樣式 this.Text = "社團成績評量項目(尚未設定)"; wp = new WeightProportion(); DataGridViewRow row; row = SetRow(PA_Name, ""); rowIndex.Add(PA_Name, row.Index); row = SetRow(AR_Name, ""); rowIndex.Add(AR_Name, row.Index); row = SetRow(AAS_Name, ""); rowIndex.Add(AAS_Name, row.Index); row = SetRow(FAR_Name, ""); rowIndex.Add(FAR_Name, row.Index); #endregion } else { wp = list[0]; if (string.IsNullOrEmpty(wp.Proportion)) { #region 預設 //當沒有設定任何比例時,提供預設樣式 this.Text = "社團成績評量項目(尚未設定)"; wp = new WeightProportion(); DataGridViewRow row; row = SetRow(PA_Name, ""); rowIndex.Add(PA_Name, row.Index); row = SetRow(AR_Name, ""); rowIndex.Add(AR_Name, row.Index); row = SetRow(AAS_Name, ""); rowIndex.Add(AAS_Name, row.Index); row = SetRow(FAR_Name, ""); rowIndex.Add(FAR_Name, row.Index); #endregion } else { dataGridViewX1.Tag = wp; XmlElement xml = DSXmlHelper.LoadXml(wp.Proportion); foreach (XmlElement each in xml.SelectNodes("Item")) { DataGridViewRow row = SetRow(each.GetAttribute("Name"), each.GetAttribute("Proportion")); rowIndex.Add(each.GetAttribute("Name"), row.Index); } } } }