コード例 #1
0
        private void Get_EducationSystem(object obj)
        {
            User   user     = (User)obj;
            string username = string.Empty;
            string password = string.Empty;

            string data = user.data;
            string res  = string.Empty;

            if (string.IsNullOrEmpty(data))
            {
                data = string.Empty;
            }
            Regex           reg     = new Regex(@"username=(.+?)&password=(.+)");
            MatchCollection mcResul = reg.Matches(data);

            if (mcResul.Count > 0)
            {
                username = mcResul[0].Groups[1].Value;
                password = mcResul[0].Groups[2].Value;
            }
            AddContent("收到 [" + user.client.Client.RemoteEndPoint + "][" + username + "] 请求教务系统查询");
            res = new EducationSystem().Get(username, password);
            SendToClient(user, res);
            AddContent("已向 [" + user.client.Client.RemoteEndPoint + "][" + username + "] 发送教务系统查询结果");
            RemoveUser(user);
        }
コード例 #2
0
        public async Task <ActionResult <EducationSystem> > PostEducationSystem(EducationSystem educationSystem)
        {
            _context.EducationSystems.Add(educationSystem);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetEducationSystem", new { id = educationSystem.Id }, educationSystem));
        }
コード例 #3
0
        public async Task <IActionResult> PutEducationSystem(int id, EducationSystem educationSystem)
        {
            if (id != educationSystem.Id)
            {
                return(BadRequest());
            }

            _context.Entry(educationSystem).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EducationSystemExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #4
0
        private void Get_EducationSystem(object obj)
        {
            MissionInfo info     = (MissionInfo)obj;
            string      username = string.Empty;
            string      password = string.Empty;

            string data = info.MissionData;
            string res  = string.Empty;

            if (string.IsNullOrEmpty(data))
            {
                data = string.Empty;
            }
            Regex           reg     = new Regex(@"username=(.+?)&password=(.+)");
            MatchCollection mcResul = reg.Matches(data);

            if (mcResul.Count > 0)
            {
                username = mcResul[0].Groups[1].Value;
                password = mcResul[0].Groups[2].Value;
            }
            AddTalkMessage("收到 [" + username + "] 请求教务系统查询");
            res = new EducationSystem().Get(username, password);
            SendMessage(info.MissionID + "," + res);
            AddTalkMessage("已向 [" + username + "] 发送教务系统查询结果");
        }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string Re = "";

        if (Request.RequestType.ToUpper() == "POST")
        {
            string     username = string.Empty;
            string     password = string.Empty;
            SortedList table    = sParam();
            //Hashtable table = hParam();
            if (table != null)
            {
                foreach (DictionaryEntry De in table)
                {
                    if (De.Key.ToString() == "username")
                    {
                        username = De.Value.ToString();
                    }
                    if (De.Key.ToString() == "pwd")
                    {
                        password = De.Value.ToString();
                    }
                }
                Re = new EducationSystem().GetEducationSystem(username, password);
            }
            else
            {
                Re = "Error";
            }
        }
        Response.Write(Re);
    }
コード例 #6
0
        private void button5_Click(object sender, EventArgs e)
        {
            Console.WriteLine("开始获取 - " + DateTime.Now + '.' + DateTime.Now.Millisecond);
            EducationSystem esb = new EducationSystem();

            textBox1.Text = esb.Get(textBox2.Text, textBox3.Text);
            Console.WriteLine("获取完成 - " + DateTime.Now + '.' + DateTime.Now.Millisecond);
        }