📄 strategyitem.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using ExaminationSystem.BLL.Utils;
namespace ExaminationSystem.BLL.Domain
{
public class StrategyItem:DomainObject<long>
{
private IList<QuestionContent> questionContents = new List<QuestionContent>();
private string name;
public virtual string Name
{
get { return name; }
set { name = value; }
}
public bool HasQuestion(QuestionContent question)
{
if (QuestionContents.Contains(question))
return true;
else
return false;
}
public virtual IList<QuestionContent> QuestionContents
{
get { return questionContents; }
set { questionContents = value; }
}
private int scoreValue;
public virtual int ScoreValue
{
get { return scoreValue; }
set { scoreValue = value; }
}
private int count;
public int Count
{
get { return count; }
set
{
//if (value >= QuestionContents.Count)
// throw new Exception("count必需不能大于备选数量");
count = value;
}
}
public IList<Question> GetQuestions()
{
IList<Question> result = new List<Question>();
IList<int> sourceList = new List<int>();
for (int i = 0; i < QuestionContents.Count; i++)
sourceList.Add(i);
IList<int> resultList = RandomNumberHelper.RandomSelect(sourceList, count);
foreach (int i in resultList)
{
Question question = new Question();
question.Content = QuestionContents[i];
question.ScoreValue = ScoreValue;
result.Add(question);
}
return result;
}
private StrategyContainer strategyContainer;
public virtual StrategyContainer StrategyContainer
{
get { return strategyContainer; }
set { strategyContainer = value; }
}
public override int GetHashCode()
{
return (GetType().FullName + "|" +
QuestionContents.GetHashCode()).GetHashCode();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -