public TokenUpdator(NetConnection connection) { this.connection = connection; }
public ServerTestSaveProvider(NetConnection connection) { this.connection = connection; }
public ServerLoadDialog(NetConnection connection, bool isPassing) { InitializeComponent(); this.connection = connection; this.isPassing = isPassing; }
public TestResults(string FIO, string Class, int passMinutes, int passSeconds, List <AnswerListItem> answers, bool isServerTest, NetConnection connection) { InitializeComponent(); if (answers == null) { throw new ArgumentNullException("Значение answers не может быть null"); } else { this.answers = new List <AnswerListItem>(answers); } labelFIO.Text += FIO; labelClass.Text += Class; var mark = Math.Round((double)this.answers.Sum((x) => { return(x.IsRight ? x.Question_score : 0); }) / this.answers.Sum((x) => { return(x.Question_score); }) * 10); labelOcenka.Text += mark.ToString(); if (mark < 4) { labelOcenka.ForeColor = Color.Red; } labelProcPrav.Text += string.Format("{0:0.00}", ((double)this.answers.Sum((x) => { return(x.IsRight ? 1 : 0); }) / this.answers.Count * 100)); labelTime.Text += passMinutes + ":" + passSeconds; this.connection = connection; if (isServerTest && connection != null && connection.IsConnected) { connection.SendCommand( new RequestInfo( "SaveResult", SequrityUtils.Encrypt( new TestResult( Convert.ToInt32(mark), new DateTime(1, 1, 1, passMinutes / 60 > 23 ? 23 : passMinutes / 60, passMinutes % 60, passSeconds), answers).ToJson(), connection.User.SecretKey), connection.User.UserToken), onRecive); } }