本文整理汇总了C#中Assignment类的典型用法代码示例。如果您正苦于以下问题:C# Assignment类的具体用法?C# Assignment怎么用?C# Assignment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Assignment类属于命名空间,在下文中一共展示了Assignment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddAssignmentGroup
//添加对应的作业-组信息
protected void AddAssignmentGroup(Control topctrl, Assignment EditAssignment, int assignmentID)
{
foreach (Control c in topctrl.Controls)
{
if (c.GetType().ToString().Equals("System.Web.UI.WebControls.CheckBoxList"))
{
CheckBoxList cb = (CheckBoxList)c;
//从1开始,因为第0项是班级
for (int i = 1; i < cb.Items.Count; i++)
{
if (cb.Items[i].Selected == true)
{
//new AssignmentGroupInfo对象
AssignmentGroupInfo newAssignmentGroupInfo = new AssignmentGroupInfo();
//初始化newAssignmentGroupInfo
newAssignmentGroupInfo.IAssignmentId = assignmentID;
//Items[i].Value保存的是组的ID,这是在动态生成的时候绑定的
newAssignmentGroupInfo.IGroupId = Convert.ToInt32(cb.Items[i].Value);
newAssignmentGroupInfo.INewMsgNum = 0;
newAssignmentGroupInfo.IState = 0;
//添加相应的组
EditAssignment.AddAssignmentGroup(newAssignmentGroupInfo);
}
}
}
if (c.HasControls())
{
AddAssignmentGroup(c, EditAssignment, assignmentID);
}
}
}
示例2: FinalizeAssignment
/// <summary>
/// Saves the assignment data in a hashtable and creates a new assignment and adds it to the AssignmentObject.
/// </summary>
public override void FinalizeAssignment () {
Hashtable h = new Hashtable ();
h.Add ("photosNeeded", Int32.Parse(assignmentMaker.typeInputField.text));
h.Add ("missionDescription", assignmentMaker.descriptionField.text + ". " + assignmentMaker.assignmentExplanation.text);
Assignment newCameraAssignment = new Assignment (0,"Camera", h);
assignmentMaker.assignmentObject.AddAssignment(newCameraAssignment);
}
示例3: InitAssignment
/// <summary>
/// Initializes the assignment by retrieving the active Assignment from MissionControl, then configuring the scene with Assignment data if assignmentState = STATE_NEW.
/// </summary>
private void InitAssignment()
{
if (MissionControl.pObject.activeMission != null && MissionControl.pObject.activeAssignment != null)
{
walkAssignment = MissionControl.pObject.activeMission.activeAssignment;
}
else
{
print("Creating test assignment");
walkAssignment = new Assignment(0, "Walk");
Vector2 newPosition = UnityEngine.Random.insideUnitCircle * 300;
targetLocation = new Vector3(newPosition.x, 0, newPosition.y);
}
if (walkAssignment.assignmentState == Assignment.STATE_NEW)
{
object value;
if (walkAssignment.typeData.TryGetValue("targetLocation", out value))
{
targetLocation = (Vector3)value;
Debug.Log("targetLocation: " + targetLocation);
}
else
{
Debug.Log("No target location found!");
}
walkAssignment.Start();
}
targetObject.transform.position = targetLocation;
background.SetActive(false);
backgroundGrid.SetActive(true);
}
示例4: Assignment_SelectAddSelectDeleteSelect_OK
public void Assignment_SelectAddSelectDeleteSelect_OK()
{
using (System.Transactions.TransactionScope updateTransaction =
new System.Transactions.TransactionScope())
{
string connectionString = GetConnectionstring();
DataAccess d2 = new DataAccess(connectionString);
List<Assignment> assignmentsBefore = d2.GetAssignments();
Assignment assignment = new Assignment();
assignment.AssignmentId = -1;
assignment.AssignmentName = "asfdasfasdfsaf";
Assignment assignmentAfterSave = d2.SaveAssignment(assignment);
Assignment assignmentGetById = d2.GetAssignmentByID(assignment.AssignmentId);
Assert.AreNotEqual(assignment.AssignmentId, -1);
Assert.AreEqual(assignment.AssignmentName, assignmentGetById.AssignmentName);
List<Assignment> assignmentsAfterSave = d2.GetAssignments();
Assert.AreEqual(assignmentsAfterSave.Count, assignmentsBefore.Count + 1);
d2.DeleteAssignment(assignment.AssignmentId);
List<Assignment> assignmentsAfterDelete = d2.GetAssignments();
Assert.AreEqual(assignmentsBefore.Count, assignmentsAfterDelete.Count);
}
}
示例5: ShouldParseSimpleAssignment
public void ShouldParseSimpleAssignment()
{
var assignment = new Assignment(new[] {new Variable("a")},
new[] {new ConstantExpression(Constants.One)}, false);
var expected = new StatementBlock(assignment);
Assert.AreEqual(expected, SyntaxParser.Parse("a = 1"));
}
示例6: GetTimePhaseData
/// <summary>
/// Gets the time phase data.
/// </summary>
/// <param name="assignment">The assignment.</param>
/// <param name="type">The type.</param>
/// <returns></returns>
public static IEnumerable<TimePhasedDataType> GetTimePhaseData(Assignment.Assignment assignment, TimePhasedDataType.TimePhaseType type)
{
if(assignment == null)
throw new ArgumentException("assignment");
//определяем величину дискретизации для генератора интервалов.
//Если ее определить слишком маленькую то будет много TimePhases елементов
//Для плоского распределения трудозатрат использовать ДЕНЬ для нелинейных функций использовать ЧАС
long groupIntervalValue = assignment.CurrentContour.ContourType == ContourTypes.Flat ? CalendarHelper.MilisPerDay() : CalendarHelper.MilisPerHour();
long start = type == TimePhasedDataType.TimePhaseType.AssignmentActualWork ? assignment.Start : assignment.Stop;
long stop = type == TimePhasedDataType.TimePhaseType.AssignmentActualWork ? assignment.Stop : assignment.End;
Query<Interval> query = new Query<Interval>();
AssignmentBaseFunctor<double> workFunctor = assignment.GetWorkFunctor();
GroupingIntervalGenerator groupGen = new GroupingIntervalGenerator(start, stop, groupIntervalValue,
workFunctor.CountourGenerator);
TimePhaseDataGetter timePhaseGetter = new TimePhaseDataGetter(type, TimePhasedDataType.TimePhaseUnit.Day,
TimePhasedDataType.TimePhaseUnit.Minute, workFunctor);
WhereInRangePredicate whereInRange = new WhereInRangePredicate(start, stop);
query.Select(timePhaseGetter).From(groupGen).Where(whereInRange.Evaluate).Execute();
return timePhaseGetter.Value;
}
示例7: ShouldParseMultipleAssignments
public void ShouldParseMultipleAssignments()
{
var assignment = new Assignment(new[] { new Variable("a"), new Variable("b") },
new[] { new ConstantExpression(Constants.One) }, true);
var expected = new StatementBlock(assignment);
Assert.AreEqual(expected, SyntaxParser.Parse("local a,b = 1"));
}
示例8: AdjustValue
public void AdjustValue()
{
esp = Tmp32("esp");
CreateSymbolicEvaluator(frame);
var ass = new Assignment(esp, new BinaryExpression(BinaryOperator.IAdd, esp.DataType, esp, Constant.Word32(4)));
se.Evaluate(ass);
Assert.AreEqual("fp + 0x00000004", ctx.TemporaryState[esp.Storage].ToString());
}
示例9: OnSynchronize
protected override void OnSynchronize(Assignment delta)
{
sum_ = 0;
for (int index = 0; index < Size(); ++index)
{
sum_ += Value(index);
}
}
示例10: ShouldParseLocalAssignment
public void ShouldParseLocalAssignment()
{
var assignment = new Assignment(new[] {new Variable("a")},
new[] {new ConstantExpression(Constants.One)}, true);
var expected = new StatementBlock(assignment);
var actual = SyntaxParser.Parse("local a = 1");
Assert.AreEqual(expected, actual);
}
示例11: AddAssignment
internal void AddAssignment(Guid id, Assignment a, string action)
{
// Make sure there isn't one already here
_object.Remove(id);
_action.Remove(id);
_object.Add(id, a);
_action.Add(id, action);
}
示例12: FinalizeAssignment
/// <summary>
/// Saves the assignment data in a hashtable and creates a new assignment and adds it to the AssignmentObject.
/// </summary>
public override void FinalizeAssignment()
{
Debug.Log("Finishing Assignment");
Hashtable h = new Hashtable();
h.Add("missionDescription", assignmentMaker.descriptionField.text + ". " + assignmentMaker.assignmentExplanation.text);
Assignment newAssignment = new Assignment(0, "Scan", h);
assignmentMaker.assignmentObject.AddAssignment(newAssignment);
}
示例13: create
public bool create(Assignment thisAssignment)
{
// ������ҵ
DataClassesDataContext da = new DataClassesDataContext();
da.Assignment.InsertOnSubmit(thisAssignment);
da.SubmitChanges();
return true;
}
示例14: Test2
public void Test2()
{
BinaryExpression b = m.IAdd(id, m.UMul(id, 5));
Assignment ass = new Assignment(x, b);
var rule = new Add_mul_id_c_id_Rule(new SsaEvaluationContext(null, ssaIds));
Assert.IsTrue(rule.Match(b));
ass.Src = rule.Transform();
Assert.AreEqual("x = id *u 0x00000006", ass.ToString());
}
示例15: ShouldParseSequentialAssignments
public void ShouldParseSequentialAssignments()
{
var assignment1 = new Assignment(new[] { new Variable("a") },
new[] { new ConstantExpression(Constants.One) }, true);
var assignment2 = new Assignment(new[] { new Variable("b") },
new[] { new ConstantExpression(Constants.Two) }, true);
var expected = new StatementBlock(assignment1, assignment2);
Assert.AreEqual(expected, SyntaxParser.Parse("local a = 1\nlocal b = 2"));
}