示例#1
0
        void timer1_Tick(object sender, EventArgs e)
        {
            HeaderInfo headerInfo = new HeaderInfo();
            labelWait1C.Text = headerInfo.WaitClients;
            labelWait1C.ForeColor = !headerInfo.WaitClients.Contains("WAIT 0") ? Color.Red : Color.Black;
            labelLost1C.Text = headerInfo.LostClients;

            labelFree1C.Text = headerInfo.FreeAbonents;

            OperatorInfo = _form.GetInfo();
            if (OperatorInfo != null)
            {
                lblCountAnswered.Text = OperatorInfo.CountAnswered;
                lblPauseStatus.Text = OperatorInfo.PauseStatus;
                lblPauseTime.Text = OperatorInfo.PauseTime;
                lblPhoneNumber.Text = OperatorInfo.PhoneNumber;
                lblWorkTime.Text = OperatorInfo.WorkTime;
            }
        }
        public OperatorInfo GetInfo(string phoneNumber)
        {
            HtmlParser parser = new HtmlParser();
            IEnumerable<List<HtmlNode>> allOperators =  parser.GetOperatorsData();
            foreach (List<HtmlNode> oper in allOperators)
            {
                var o = oper;
                if (o[0].InnerHtml == phoneNumber)
                {
                    OperatorInfo operatorInfo = new OperatorInfo();
                    operatorInfo.PhoneNumber = o[0].InnerHtml;
                    operatorInfo.CountAnswered = o[7].InnerHtml;
                    operatorInfo.PauseStatus = o[11].InnerText;
                    int index = o[10].InnerText.IndexOf("\t", StringComparison.Ordinal);

                    operatorInfo.PauseTime = o[10].InnerText.Substring(index+1);
                    operatorInfo.WorkTime = o[9].InnerHtml;
                    return operatorInfo;
                }
            }
            return null;
        }