public override object Run(object input) { LogDebug("Input to Task2: " + input.ToString());// TRACE < DEBUG < INFO < WARN < ERROR < FATAL long op = (long)input * Number1; LogInfo(input.ToString() + " * " + Number1.ToString() + " = " + Convert.ToString(op)); return(op); }
public override object Run(object input) { // TRACE < DEBUG < INFO < WARN < ERROR < FATAL LogDebug("Starting Task 1!"); long op = Number1 + Number2; LogInfo(Number1.ToString() + " + " + Number2.ToString() + " = " + Convert.ToString(op)); return(op); }
protected void btncalculate_Click(object sender, EventArgs e) { float Num, Num2, WeigTea, WeigStu; float SUMScore, Number1, Number2; string strCount = "select count(*) AS COUNT1 from 评分表 where ( 评分表.DID = (select 传值表.TransID from 传值表)) and (select 用户表.urid from 用户表 where 用户表.cid = 评分表.cid) = 1"; DataTable DTC = DBOper.execQueryBySQLText(strCount); if (DTC.Rows.Count > 0) { Num = float.Parse(DTC.Rows[0]["COUNT1"].ToString()); string strSti = "select SUM (Value1+Value2+Value3+Value4) AS SumScore1 from 评分表 where ( 评分表.DID = (select 传值表.TransID from 传值表)) and (select 用户表.urid from 用户表 where 用户表.cid = 评分表.cid) = 1"; DataTable DTT = DBOper.execQueryBySQLText(strSti); if (DTT.Rows.Count > 0) { Number1 = float.Parse(DTT.Rows[0]["SumScore1"].ToString()) / Num; txtScoreTeacher.Text = Number1.ToString(); string strCOUNT = "select count(*) AS COUNT2 from 评分表 where ( 评分表.DID = (select 传值表.TransID from 传值表)) and (select 用户表.urid from 用户表 where 用户表.cid = 评分表.cid) = 2"; DataTable DTCS = DBOper.execQueryBySQLText(strCOUNT); if (DTCS.Rows.Count > 0) { Num2 = float.Parse(DTCS.Rows[0]["COUNT2"].ToString()); string strStiSUM = "select SUM (Value1+Value2+Value3+Value4) AS SumScore2 from 评分表 where ( 评分表.DID = (select 传值表.TransID from 传值表)) and (select 用户表.urid from 用户表 where 用户表.cid = 评分表.cid) = 2"; DataTable DTTSUM = DBOper.execQueryBySQLText(strStiSUM); if (DTT.Rows.Count > 0) { Number2 = float.Parse(DTTSUM.Rows[0]["SumScore2"].ToString()) / Num2; txtScoreStudent.Text = Number2.ToString(); string sqlweight1 = "select UWeight from 用户权重表 where URID = 1"; DataTable DTW1 = DBOper.execQueryBySQLText(sqlweight1); if (DTCS.Rows.Count > 0) { WeigTea = float.Parse(DTW1.Rows[0]["UWeight"].ToString()); string sqlweight2 = "select UWeight from 用户权重表 where URID = 2"; DataTable DTW2 = DBOper.execQueryBySQLText(sqlweight2); if (DTCS.Rows.Count > 0) { WeigStu = float.Parse(DTW2.Rows[0]["UWeight"].ToString()); SUMScore = Number1 * WeigTea + Number2 * WeigStu; //计算总成绩 txtSummaryScore.Text = SUMScore.ToString(); string sqlsummary = "insert into 汇总表 (DID,SValue,TValue,SUValue) values('" + txtkong.Text + "','" + txtScoreStudent.Text + "','" + txtScoreTeacher.Text + "','" + txtSummaryScore.Text + "')"; DataTable DTSum = DBOper.execQueryBySQLText(sqlsummary); if (DTSum.Rows.Count > 0) { ; } } } } } } } }
private void ButtonNumberClick(object sender, RoutedEventArgs e) { ContentControl contentControl = (ContentControl)sender; string button = contentControl.Content.ToString(); int inputValue = Convert.ToInt32(button); if (Operation == "") { Number1 = (Number1 * 10) + inputValue; txtResult.Text = Number1.ToString(); } else { Number2 = (Number2 * 10) + inputValue; txtResult.Text = Number2.ToString(); } }
public List <string> FizzBuzzer() { List <string> result = new List <string>(); if ((Number1 % DivisableBy1 == 0) && (Number1 % DivisableBy2 == 0)) { result.Add(Number1.ToString() + " " + Fizz + Buzz); } else if (Number1 % DivisableBy1 == 0) { result.Add(Number1.ToString() + " " + Fizz); } else if (Number1 % DivisableBy2 == 0) { result.Add(Number1.ToString() + " " + Buzz); } else { result.Add(Number1.ToString()); } if ((Number2 % DivisableBy1 == 0) && (Number2 % DivisableBy2 == 0)) { result.Add(Number2.ToString() + " " + Fizz + Buzz); } else if (Number2 % DivisableBy1 == 0) { result.Add(Number2.ToString() + " " + Fizz); } else if (Number2 % DivisableBy2 == 0) { result.Add(Number2.ToString() + " " + Buzz); } else { result.Add(Number2.ToString()); } if ((Number3 % DivisableBy1 == 0) && (Number3 % DivisableBy2 == 0)) { result.Add(Number3.ToString() + " " + Fizz + Buzz); } else if (Number3 % DivisableBy1 == 0) { result.Add(Number3.ToString() + " " + Fizz); } else if (Number3 % DivisableBy2 == 0) { result.Add(Number3.ToString() + " " + Buzz); } else { result.Add(Number3.ToString()); } if ((Number4 % DivisableBy1 == 0) && (Number4 % DivisableBy2 == 0)) { result.Add(Number4.ToString() + " " + Fizz + Buzz); } else if (Number4 % DivisableBy1 == 0) { result.Add(Number4.ToString() + " " + Fizz); } else if (Number4 % DivisableBy2 == 0) { result.Add(Number4.ToString() + " " + Buzz); } else { result.Add(Number4.ToString()); } if ((Number5 % DivisableBy1 == 0) && (Number5 % DivisableBy2 == 0)) { result.Add(Number5.ToString() + " " + Fizz + Buzz); } else if (Number5 % DivisableBy1 == 0) { result.Add(Number5.ToString() + " " + Fizz); } else if (Number5 % DivisableBy2 == 0) { result.Add(Number5.ToString() + " " + Buzz); } else { result.Add(Number5.ToString()); } return(result); }