using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Office.Interop.PowerPoint;
using GeneralLib;
namespace SunVoteARSPPT
{
public partial class PanelScore : UserControl, IPanel
{
TagSet mTagSet = null;
public TagSet TagSet
{
get { return mTagSet; }
set
{
mTagSet = value;
ucResponsePara.TagSet = value;
ucKeypadPara.TagSet = value;
}
}
///
/// 显示分组评分选项,只在葫芦岛天翔定制用。杨斌 2015-08-04
///
private bool ShowJudgeGroup = false;
public PanelScore()
{
InitializeComponent();
Shape sha;
//杨斌 2015-11-24
lblJudgeGroup.Visible =
cboJudgeGroup.Visible =
btnJudgeGroupRate.Visible =
chkShowAvgGroup.Visible =
chkRunTimeShowScore.Visible =
lblShowScoreGroup.Visible =
cboShowScoreGroup.Visible = ShowJudgeGroup;
if (ShowJudgeGroup)
{
chkShowAvg.Top = btnJudgeGroupRate.Bottom + 6;
}
else
{
chkShowAvg.Top = cboJudgeGroup.Top;
}
chkShowTotal.Top = chkShowAvg.Bottom + 6;
//杨斌 2016-04-20
chkRunTimeShowScore.Visible = true;
chkRunTimeShowScore.Top = chkShowTotal.Bottom + 6;
chkShowAvgGroup.Top = chkRunTimeShowScore.Bottom + 6;
chkShowAvgTableGroup.Top = chkShowAvgGroup.Bottom + 6;
cboShowScoreGroup.Top = chkShowAvgTableGroup.Bottom + 6;
lblShowScoreGroup.Top = cboShowScoreGroup.Top + 3;
if (ShowJudgeGroup)
{
//gbxScoreCount.Height = chkShowAvgTableGroup.Bottom + 6;
gbxScoreCount.Height = cboShowScoreGroup.Bottom + 6;
}
else
{
//杨斌 2016-04-20
//gbxScoreCount.Height = chkShowTotal.Bottom + 6;
gbxScoreCount.Height = chkRunTimeShowScore.Bottom + 6;
}
ucResponsePara.Top = gbxScoreCount.Bottom + 6;
ucKeypadPara.Top = ucResponsePara.Bottom + 6;
this.Height = ucKeypadPara.Bottom + 6;
FrmSystemSet.LanguageSetEvent += new FrmSystemSet.LanguageSetEventHander(FrmSystemSet_LanguageSetEvent);
FrmVoteBar.PanelEnabledEvent += new FrmVoteBar.PanelEnabledEventHander(FrmVoteBar_PanelEnabledEvent);
gbxScore.Resize += gbxScore_Resize;
gbxScoreCount.Resize += gbxScoreCount_Resize;
//设置控件大小
//杨斌 2015-04-10
//ucResponsePara.HideVoteRate();
ucResponsePara.ShowSet(true, false);
ucKeypadPara.Top = ucResponsePara.Bottom + 6;
this.Height = ucKeypadPara.Bottom;
GlobalInfo.SysLanguage.SetLanguage(this.Name, this);
//杨斌 2012-06-11
switch (GlobalInfo.OEMLogo)
{
case OEMLogos.oem3eAnalyzer:
//ucKeypadPara.Visible = false;
//if (ucKeypadPara.cboSubmitMode.SelectedIndex != 0)
// ucKeypadPara.cboSubmitMode.SelectedIndex = 0;
//this.Height = ucResponsePara.Bottom;
break;
case OEMLogos.SunVote:
default:
break;
}
//杨斌 2012-06-25
ucKeypadPara.cboOptionMode.SelectedIndex = -1;
ucKeypadPara.cboOptionMode.Enabled = false;
}
void gbxScore_Resize(object sender, EventArgs e)
{
int pos = gbxScore.ClientSize.Width / 2;
int w = pos - 3;
cboMax.Left = pos;
cboMax.Width = w;
cboMin.Left = pos;
cboMin.Width = w;
cboDec.Left = pos;
cboDec.Width = w;
}
void gbxScoreCount_Resize(object sender, EventArgs e)
{
int pos = gbxScoreCount.ClientSize.Width / 2;
int w = pos - 3;
cboJudgeRate.Left = pos;
cboJudgeRate.Width = w;
cboJudgeGroup.Left = pos;
cboJudgeGroup.Width = w;
cboShowScoreGroup.Left = pos;
cboShowScoreGroup.Width = w;
int wp = gbxScoreCount.ClientSize.Width - 3;
nudScoreRemoveMax.Left = wp - nudScoreRemoveMax.Width;
nudScoreRemoveMin.Left = wp - nudScoreRemoveMin.Width;
nudScoreCountDec.Left = wp - nudScoreCountDec.Width;
}
void FrmVoteBar_PanelEnabledEvent(bool enabled)
{
this.Enabled = enabled;
if (this.Enabled)
SetGroupEnable();
}
void FrmSystemSet_LanguageSetEvent()
{
GlobalInfo.SysLanguage.SetLanguage(this.Name, this);
//修改标志 2012-04-17 赵丽 语言切换数据刷新不准确
string Unrestrict = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "Unrestricted", "不限");
cboDec.Text = TagSet.GetValue(TagKey.Score_DecimalFormat).Value.ToString() == ""
? Unrestrict : TagSet.GetValue(TagKey.Score_DecimalFormat).Value.ToString();
cboMin.Text = TagSet.GetValue(TagKey.Score_LowRange).Value.ToString() == ""
? Unrestrict : TagSet.GetValue(TagKey.Score_LowRange).Value.ToString();
cboMax.Text = TagSet.GetValue(TagKey.Score_HighRange).Value.ToString() == ""
? Unrestrict : TagSet.GetValue(TagKey.Score_HighRange).Value.ToString();
LoadRosterCols();//杨斌 2015-07-28
}
///
/// 加载参数面板数据
///
public void LoadData()
{
ucResponsePara.LoadData();
ucKeypadPara.LoadData();
ControlOper.TrySetNumericUpDownValue(nudScoreRemoveMax, TagSet.LoadValue(TagKey.Score_RemoveHighCount, 0).ToInt);
ControlOper.TrySetNumericUpDownValue(nudScoreRemoveMin, TagSet.LoadValue(TagKey.Score_RemoveLowCount, 0).ToInt);
ControlOper.TrySetNumericUpDownValue(nudScoreCountDec, TagSet.LoadValue(TagKey.Score_ResultFormat, 0).ToInt);
//cboMax.SelectedIndex = 0;
//cboMin.SelectedIndex = 0;
//cboDec.SelectedIndex = 0;
string Unrestrict = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "Unrestricted", "不限");
string sMaxValue = TagSet.LoadValue(TagKey.Score_HighRange, "").Value;
string sMinValue = TagSet.LoadValue(TagKey.Score_LowRange, "").Value;
string sDecValue = TagSet.LoadValue(TagKey.Score_DecimalFormat, "").Value;
//sMaxValue = (sMaxValue == "") ? Unrestrict : sMaxValue;
//sMinValue = (sMinValue == "") ? Unrestrict : sMinValue;
cboMax.Text = sMaxValue == "" ? Unrestrict : sMaxValue;
cboMin.Text = sMinValue == "" ? Unrestrict : sMinValue;
cboDec.Text = sDecValue == "" ? Unrestrict : sDecValue;
chkShowAvg.Checked = (TagSet.LoadValue(TagKey.Score_ShowAvg, chkShowAvg.Checked ? 1 : 0).ToInt == 1);
chkShowTotal.Checked = (TagSet.LoadValue(TagKey.Score_ShowTotal, chkShowTotal.Checked ? 1 : 0).ToInt == 1);
//杨斌 2016-04-20
chkRunTimeShowScore.Checked = (TagSet.LoadValue(TagKey.Score_RunTimeShowScore, chkRunTimeShowScore.Checked ? 1 : 0).ToInt == 1);
//杨斌 2015-07-30
chkShowAvgGroup.Checked = (TagSet.LoadValue(TagKey.Score_ShowAvgGroup, chkShowAvgGroup.Checked ? 1 : 0).ToInt == 1);
chkShowAvgTableGroup.Checked = (TagSet.LoadValue(TagKey.Score_ShowAvgTableGroup, chkShowAvgTableGroup.Checked ? 1 : 0).ToInt == 1);
LoadRosterCols();//杨斌 2014-06-11
if (!ShowJudgeGroup)
{
if (cboJudgeGroup.SelectedIndex > 0)
{
TagSet.SetValue(TagKey.Score_JudgeGroup, "");
cboJudgeGroup.SelectedIndex = 0;
}
}
SetGroupEnable();//杨斌 2015-07-30
}
///
/// 加载名单字段
/// 杨斌 杨斌 2015-07-28
///
private void LoadRosterCols()
{
cboJudgeRate.Enabled = false;
cboJudgeGroup.Enabled = false;
cboJudgeRate.Items.Clear();
cboJudgeRate.Items.Add("");
cboJudgeGroup.Items.Clear();
cboJudgeGroup.Items.Add("");
//杨斌 2015-11-24
cboShowScoreGroup.Items.Clear();
////cboShowScoreGroup.Items.Add("");
RosterList Roster = RosterList.RosterLoad;
for (int i = 1; i < Roster.Columns.Count; i++)
{
cboJudgeRate.Items.Add(Roster.Columns[i].ColumnName);
cboJudgeGroup.Items.Add(Roster.Columns[i].ColumnName);
////cboShowScoreGroup.Items.Add(RosterCol.Columns[i].ColumnName);
}
string sValue = TagSet.LoadValue(TagKey.Score_JudgeRage, "").Value;
string sValueG = TagSet.LoadValue(TagKey.Score_JudgeGroup, "").Value;
//根据加载组内容
//astring sValueD = TagSet.LoadValue(TagKey.Score_JudgeGroupDetail, "").Value;
try
{
cboJudgeRate.Enabled = false;
cboJudgeRate.Text = sValue;
cboJudgeGroup.Enabled = false;
cboJudgeGroup.Text = sValueG;
cboShowScoreGroup.Enabled = false;
//cboShowScoreGroup.Text = sValueD;
}
catch
{
cboJudgeRate.Text = "";
cboJudgeGroup.Text = "";
cboShowScoreGroup.Text = "";
}
finally
{
cboJudgeRate.Enabled = true;
cboJudgeGroup.Enabled = true;
cboShowScoreGroup.Enabled = true;
}
Slide sld = Globals.SunVoteARSAddIn.PPTEdit.SlideEdit;
string group = "";
Dictionary dic = FrmScoreGroupRate.GetDicScoreGroupRate(sld, out group);
SetCboShowScoreGroup(dic);
}
private void cboMax_SelectedIndexChanged(object sender, EventArgs e)
{
//杨斌 2015-05-26
if (GlobalInfo.GetSdkType() == 1)
{
if (ConvertOper.Convert(cboMax.Text).ToInt > 255)
{
cboMax.Text = "255";
cboMax.SelectedIndex = -1;
return;
}
}
//TagSet.SetValue(TagKey.Score_HighRange, cboMax.Text);
}
private void cboMin_SelectedIndexChanged(object sender, EventArgs e)
{
//杨斌 2015-05-26
if (GlobalInfo.GetSdkType() == 1)
{
if (ConvertOper.Convert(cboMin.Text).ToInt > 255)
{
cboMin.Text = "255";
cboMin.SelectedIndex = -1;
return;
}
}
//TagSet.SetValue(TagKey.Score_LowRange, cboMin.Text);
}
private void cboDec_SelectedIndexChanged(object sender, EventArgs e)
{
//修改标志 2012-04-17 赵丽 语言切换数据刷新不准确
TagSet.SetValue(TagKey.Score_DecimalFormat, cboDec.Text == GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "Unrestricted", "不限") ? "" : cboDec.Text);
if (TagSet.GetValue(TagKey.Score_DecimalFormat).Value.ToString() == "")
cboDec.Text = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "Unrestricted", "不限");
}
private void nudScoreRemoveMax_ValueChanged(object sender, EventArgs e)
{
TagSet.SetValue(TagKey.Score_RemoveHighCount, nudScoreRemoveMax.Value);
if (!TagSet.ReadOnlyPPT)
GlobalInfo.response.CaculateScore(Globals.SunVoteARSAddIn.PPTEdit.SlideEdit);
}
private void nudScoreRemoveMin_ValueChanged(object sender, EventArgs e)
{
TagSet.SetValue(TagKey.Score_RemoveLowCount, nudScoreRemoveMin.Value);
if (!TagSet.ReadOnlyPPT)
GlobalInfo.response.CaculateScore(Globals.SunVoteARSAddIn.PPTEdit.SlideEdit);
}
private void nudScoreCountDec_ValueChanged(object sender, EventArgs e)
{
TagSet.SetValue(TagKey.Score_ResultFormat, nudScoreCountDec.Value);
if (!TagSet.ReadOnlyPPT)
GlobalInfo.response.CaculateScore(Globals.SunVoteARSAddIn.PPTEdit.SlideEdit);
}
private void chkShowAvg_CheckedChanged(object sender, EventArgs e)
{
TagSet.SetValue(TagKey.Score_ShowAvg, chkShowAvg.Checked ? 1 : 0);
//显示或隐藏标签
Microsoft.Office.Core.MsoTriState msoTS;
if (chkShowAvg.Checked)
msoTS = Microsoft.Office.Core.MsoTriState.msoTrue;
else
msoTS = Microsoft.Office.Core.MsoTriState.msoFalse;
PPTOper.SetLableVisible("AVGSCORE", msoTS);
}
private void chkShowTotal_CheckedChanged(object sender, EventArgs e)
{
TagSet.SetValue(TagKey.Score_ShowTotal, chkShowTotal.Checked ? 1 : 0);
//显示或隐藏标签
Microsoft.Office.Core.MsoTriState msoTS;
if (chkShowTotal.Checked)
msoTS = Microsoft.Office.Core.MsoTriState.msoTrue;
else
msoTS = Microsoft.Office.Core.MsoTriState.msoFalse;
PPTOper.SetLableVisible("SUMSCORE", msoTS);
}
///
/// 实时显示分数
///
private void chkRunTimeShowScore_CheckedChanged(object sender, EventArgs e)
{
TagSet.SetValue(TagKey.Score_RunTimeShowScore, chkRunTimeShowScore.Checked ? 1 : 0);
}
private void cboMax_KeyPress(object sender, KeyPressEventArgs e)
{
//阻止从键盘输入键
e.Handled = true;
//当输入为0-9的数字、小数点、回车和退格键时不阻止
//允许最小分数和最大分数只能是整数
if (e.KeyChar >= '0' && e.KeyChar <= '9' || e.KeyChar == 13 || e.KeyChar == (char)8)
{
e.Handled = false;
}
if (e.KeyChar == '.')
{
for (int i = 0; i < cboMax.Text.Length; i++)
{
if (cboMax.Text.Substring(i, 1) == ".")
{
e.Handled = false;
break;
}
}
}//只允许有一个“.”
}
private void cboMax_TextChanged(object sender, EventArgs e)
{
//杨斌 2015-05-26
if (GlobalInfo.GetSdkType() == 1)
{
if (ConvertOper.Convert(cboMax.Text).ToInt > 255)
{
cboMax.Text = "255";
return;
}
}
//修改标志 2012-04-17 赵丽 语言切换数据刷新不准确
TagSet.SetValue(TagKey.Score_HighRange, cboMax.Text == GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "Unrestricted", "不限") ? "" : cboMax.Text);
if (TagSet.GetValue(TagKey.Score_HighRange).Value.ToString() == "")
cboMax.Text = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "Unrestricted", "不限");
}
private void cboMin_TextChanged(object sender, EventArgs e)
{
//杨斌 2015-05-26
if (GlobalInfo.GetSdkType() == 1)
{
if (ConvertOper.Convert(cboMin.Text).ToInt > 255)
{
cboMin.Text = "255";
return;
}
}
//修改标志 2012-04-17 赵丽 语言切换数据刷新不准确
TagSet.SetValue(TagKey.Score_LowRange, cboMin.Text == GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "Unrestricted", "不限") ? "" : cboMin.Text);
if (TagSet.GetValue(TagKey.Score_LowRange).Value.ToString() == "")
cboMin.Text = GlobalInfo.SysLanguage.LPT.ReadString(this.Name, "Unrestricted", "不限");
}
private void PanelScore_Load(object sender, EventArgs e)
{
GlobalInfo.SysLanguage.SetLanguage(this.Name, this);
}
///
/// 设置评委权重字段。杨斌 2014-06-11
///
private void cboJudgeRate_SelectedIndexChanged(object sender, EventArgs e)
{
bool bOK = (cboJudgeRate.SelectedIndex < 1);
nudScoreRemoveMax.Enabled = nudScoreRemoveMin.Enabled = bOK;
if (!cboJudgeRate.Enabled) return;
TagSet.SetValue(TagKey.Score_JudgeRage, cboJudgeRate.Text);
}
private void btnJudgeGroupRate_Click(object sender, EventArgs e)
{
new FrmScoreGroupRate().ShowDialog();
}
///
/// 设置是否启用评委分组
/// 杨斌 2015-07-30
///
public void SetGroupEnable()
{
bool bNoGroup = (cboJudgeGroup.SelectedIndex < 1);
nudScoreRemoveMax.Enabled = nudScoreRemoveMin.Enabled = bNoGroup;
btnJudgeGroupRate.Enabled = !bNoGroup;
chkShowAvgGroup.Enabled = chkShowAvgTableGroup.Enabled = btnJudgeGroupRate.Enabled;
if (bNoGroup)
{
chkShowAvgGroup.Checked = chkShowAvgTableGroup.Checked = false;
}
cboJudgeRate.Enabled = bNoGroup;
if (!bNoGroup)
{
cboJudgeRate.SelectedIndex = 0;
}
}
private void cboJudgeGroup_SelectedIndexChanged(object sender, EventArgs e)
{
SetGroupEnable();
if (!cboJudgeGroup.Enabled) return;
string oldGroup = TagSet.GetValue(TagKey.Score_JudgeGroup).Value;
TagSet.SetValue(TagKey.Score_JudgeGroup, cboJudgeGroup.Text);
UpdateAvgScoreTableGroup();//杨斌 2015-07-31
if (oldGroup != cboJudgeGroup.Text)
{
if (cboShowScoreGroup.Items.Count > 0)
cboShowScoreGroup.SelectedIndex = 0;
}
}
private void chkShowAvgGroup_CheckedChanged(object sender, EventArgs e)
{
TagSet.SetValue(TagKey.Score_ShowAvgGroup, chkShowAvgGroup.Checked ? 1 : 0);
//显示或隐藏标签
Microsoft.Office.Core.MsoTriState msoTS;
if (chkShowAvgGroup.Checked)
msoTS = Microsoft.Office.Core.MsoTriState.msoTrue;
else
msoTS = Microsoft.Office.Core.MsoTriState.msoFalse;
PPTOper.SetLableVisible("AVGScoreGroup", msoTS);
}
private void chkShowAvgTableGroup_CheckedChanged(object sender, EventArgs e)
{
TagSet.SetValue(TagKey.Score_ShowAvgTableGroup, chkShowAvgTableGroup.Checked ? 1 : 0);
//显示或隐藏标签
Microsoft.Office.Core.MsoTriState msoTS;
if (chkShowAvgTableGroup.Checked)
msoTS = Microsoft.Office.Core.MsoTriState.msoTrue;
else
msoTS = Microsoft.Office.Core.MsoTriState.msoFalse;
PPTOper.SetLableVisible("AVGScoreTableGroup", msoTS);
//PPTOper.SetLableVisible("AVGScoreTableGroupDetail", msoTS);
UpdateAvgScoreTableGroup();//杨斌 2015-07-31
}
private void SetCboShowScoreGroup(Dictionary dic)
{
//杨斌 2015-11-24
cboShowScoreGroup.Items.Clear();
cboShowScoreGroup.Items.Add("");
foreach (var v in dic)
{
cboShowScoreGroup.Items.Add(v.Key);
}
try
{
string groupItem = TagSet.GetValue(TagKey.Score_JudgeGroupDetail_GroupValue).Value;
IsLoadcboShowScoreGroup = true;
cboShowScoreGroup.Text = groupItem;
}
catch { }
finally
{
IsLoadcboShowScoreGroup = false;
}
}
private void UpdateAvgScoreTableGroup()
{
try
{
if (!cboJudgeGroup.Enabled)
return;
Slide sld = Globals.SunVoteARSAddIn.PPTEdit.SlideEdit;
string group = "";
Dictionary dic = FrmScoreGroupRate.GetDicScoreGroupRate(sld, out group);
SetCboShowScoreGroup(dic);
Shape sha = null;
foreach (Shape s in sld.Shapes)
{
if (s.Name == "AVGScoreTableGroup")
{
sha = s;
break;
}
}
if (sha == null)
return;
if (sha.HasTable != Microsoft.Office.Core.MsoTriState.msoTrue)
return;
if (dic.Count < 1)
return;
int rowCount = dic.Count + 1;
if (rowCount > 100)
rowCount = 100;
if (sha.Table.Rows.Count != rowCount)
{
for (int i = sha.Table.Rows.Count + 1; i <= rowCount; i++)
{
sha.Table.Rows.Add();
}
for (int i = sha.Table.Rows.Count; i > rowCount; i--)
{
sha.Table.Rows[i].Delete();
}
}
Dictionary dicGroup = GetScoreGroupValueCount(cboJudgeGroup.Text);
List lst = dic.Keys.ToList();
for (int i = 2; i <= sha.Table.Rows.Count; i++)
{
string groupValue = lst[i - 2];
sha.Table.Cell(i, 1).Shape.TextFrame.TextRange.Text = groupValue;
if (dicGroup.ContainsKey(groupValue))
sha.Table.Cell(i, 2).Shape.TextFrame.TextRange.Text = dicGroup[groupValue].ToString();
sha.Table.Cell(i, 3).Shape.TextFrame.TextRange.Text = "0";
//if ((i > 2) && (string.IsNullOrEmpty(sha.Table.Cell(i, 2).Shape.TextFrame.TextRange.Text)))
//{
// sha.Table.Cell(i, 2).Shape.TextFrame.TextRange.Text = sha.Table.Cell(i - 1, 2).Shape.TextFrame.TextRange.Text;
//}
}
}
catch { }
}
private bool IsLoadcboShowScoreGroup = false;
private void cboShowScoreGroup_SelectedIndexChanged(object sender, EventArgs e)
{
if (IsLoadcboShowScoreGroup)
return;
TagSet.SetValue(TagKey.Score_JudgeGroupDetail_GroupName, cboJudgeGroup.Text);
TagSet.SetValue(TagKey.Score_JudgeGroupDetail_GroupValue, cboShowScoreGroup.Text);
//显示或隐藏标签
Microsoft.Office.Core.MsoTriState msoTS;
if (cboShowScoreGroup.SelectedIndex > 0)
msoTS = Microsoft.Office.Core.MsoTriState.msoTrue;
else
msoTS = Microsoft.Office.Core.MsoTriState.msoFalse;
PPTOper.SetLableVisible("AVGScoreTableGroupDetail", msoTS);
UpdateAvgScoreTableGroupDetail(cboJudgeGroup.Text, cboShowScoreGroup.Text);
}
public static Dictionary GetScoreGroupValueCount(string groupName)
{
Dictionary res = new Dictionary();
RosterList Roster = RosterList.RosterLoad;
int colIndex = RosterList.GetRosterColumIndex(groupName);
if (colIndex != -1)
{
for (int i = 0; i < Roster.Rows.Count; i++)
{
string groupValue = Roster.Rows[i].Cells[colIndex];
if (res.ContainsKey(groupValue))
res[groupValue]++;
else
res.Add(groupValue, 1);
}
}
return res;
}
public static Dictionary GetScoreGroupVotedCount(string groupName)
{
Dictionary res = new Dictionary();
RosterList Roster = RosterList.RosterLoad;
int colIndex = RosterList.GetRosterColumIndex(groupName);
if (colIndex != -1)
{
for (int i = 0; i < GlobalInfo.response.ResponseDataList.Count; i++)
{
if (GlobalInfo.response.ResponseDataList[i].KeyValue.Length > 0)
{
string keyId = GlobalInfo.response.ResponseDataList[i].KeyID;
RosterRow row = Roster.GetRowByKeyId(keyId);
if (row != null)
{
string groupValue = row.Cells[colIndex];
if (res.ContainsKey(groupValue))
res[groupValue]++;
else
res.Add(groupValue, 1);
}
}
}
}
return res;
}
///
/// 获取需要显示的分组评委名单
/// 杨斌 2015-11-25
///
///
///
///
public static List GetListScoreRoster(string groupName, string groupValue)
{
List lstRow = new List();
RosterList Roster = RosterList.RosterLoad;
int colIndex = RosterList.GetRosterColumIndex(groupName);
if (colIndex != -1)
{
for (int i = 0; i < Roster.Rows.Count; i++)
{
if (Roster.Rows[i].Cells[colIndex] == groupValue)
{
lstRow.Add(Roster.Rows[i]);
}
}
}
return lstRow;
}
private void UpdateAvgScoreTableGroupDetail(string groupName, string groupValue)
{
try
{
Slide sld = Globals.SunVoteARSAddIn.PPTEdit.SlideEdit;
Shape sha = null;
foreach (Shape s in sld.Shapes)
{
if (s.Name == "AVGScoreTableGroupDetail")
{
sha = s;
break;
}
}
if (sha == null)
return;
if (sha.HasTable != Microsoft.Office.Core.MsoTriState.msoTrue)
return;
//RosterList Roster = RosterList.RosterLoad;
//int colIndex = -1;
//for (int i = 0; i < Roster.Columns.Count; i++)
//{
// if (Roster.Columns[i].ColumnName == groupName)
// {
// colIndex = i;
// break;
// }
//}
//List lstRow = new List();
//if (colIndex != -1)
//{
// for (int i = 0; i < Roster.Rows.Count; i++)
// {
// if (Roster.Rows[i].Cells[colIndex] == groupValue)
// {
// lstRow.Add(Roster.Rows[i]);
// }
// }
//}
List lstRow = GetListScoreRoster(groupName, groupValue);
int rowCount = lstRow.Count + 1;
if (rowCount > 100)
rowCount = 100;
if (sha.Table.Rows.Count != rowCount)
{
for (int i = sha.Table.Rows.Count + 1; i <= rowCount; i++)
{
sha.Table.Rows.Add();
}
for (int i = sha.Table.Rows.Count; i > rowCount; i--)
{
sha.Table.Rows[i].Delete();
}
}
for (int i = 2; i <= sha.Table.Rows.Count; i++)
{
//if (GlobalInfo.response.ResponseDataList.Count >= (i - 1))
if (lstRow.Count >= (i - 1))
{
RosterRow row = lstRow[i - 2];
string keyId = row.Cells[0];
string name = row.Cells[1];
sha.Table.Cell(i, 1).Shape.TextFrame.TextRange.Text = keyId;
sha.Table.Cell(i, 2).Shape.TextFrame.TextRange.Text = name;
sha.Table.Cell(i, 3).Shape.TextFrame.TextRange.Text = "0";
}
else
{
sha.Table.Cell(i, 1).Shape.TextFrame.TextRange.Text = "";
sha.Table.Cell(i, 2).Shape.TextFrame.TextRange.Text = "";
sha.Table.Cell(i, 3).Shape.TextFrame.TextRange.Text = "";
}
sha.Table.Cell(i, 1).Shape.Fill.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;
sha.Table.Cell(i, 2).Shape.Fill.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;
sha.Table.Cell(i, 3).Shape.Fill.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;
}
}
catch { }
}
}
}