Beispiel #1
0
 /// <summary>
 /// 设置用户信息
 /// </summary>
 /// <param name="userinfo"></param>
 void SetUserInfo(userinfo userinfo)
 {
     try
     {
         this.Dispatcher.BeginInvoke(new Action(() =>
         {
             if (userinfo.user_head_img != null)
             {
                 //new BitmapImage(new Uri(userinfo.user_head_img,UriKind.Absolute));
                 byte[] arr    = Convert.FromBase64String(userinfo.user_head_img);
                 ks_img.Source = LoadImage(arr); //new BitmapImage(new Uri(Base64StringToImage(arr), UriKind.Absolute));/
             }
             ks_name.Text = userinfo.user_name == null ? "" : userinfo.user_name;
             ks_xb.Text   = userinfo.user_sex == null ? "" : userinfo.user_sex;
             ks_sfz.Text  = userinfo.user_card == null ? "" : userinfo.user_card;
             ks_dw.Text   = userinfo.user_work_str == null ? "" : userinfo.user_work_str;
             ks_sd.Text   = userinfo.user_place_str == null ? "" : userinfo.user_place_str;
             ks_zkzh.Text = userinfo.exam_card == null ? "" : userinfo.exam_card;
             ks_zwh.Text  = userinfo.exam_card == null ? "" : userinfo.exam_card.Substring(userinfo.exam_card.Length - 2, 2);
             if (!String.IsNullOrEmpty(userinfo.start_time))
             {
                 ExamTime = DateTime.Parse(userinfo.start_time);//DateTime.Parse("2018-07-02 11:00:00"); //
             }
             this.Title      = "湘西州专业技术人员公需科目考试作答系统 [正在获取试题信息...]";
             tbk_tagMsg.Text = this.Title;
         }));
     }
     catch (Exception ex)
     {
         MessageBox.Show("考试信息获取失败,请监考老师重新打开程序获取考生信息!");
         ResStartApp();
     }
 }
Beispiel #2
0
        public userinfo GetUserinfo()
        {
            ResponseBase req = new ResponseBase()
            {
                exam_id = examTCP.exam_id, local_ip = examTCP.local_id, module_id = examTCP.module_id
            };
            string reqStr = JsonConvert.SerializeObject(req);
            string Info   = HttpHelper.SendHttpRequest(GetWcfIp + "/GetUserInfo", reqStr);

            if (Info == "")
            {
                return(null);
            }
            userinfo info = JsonConvert.DeserializeObject <userinfo>(Info);

            return(info);
        }
Beispiel #3
0
 private void ExTCP_On_isGetUserInfo(string title)
 {
     Dispatcher.BeginInvoke(new Action(() =>
     {
         //作答试题信息
         List <question_list> qlist = null;
         this.tbk_title.Text        = title;
         Info = examCtl.Instans.GetUserinfo();
         if (Info != null)//用户信息不等于空就设置用户信息
         {
             SetUserInfo(Info);
             //如果本地文件不存在则问服务器获取考试试题
             if (!ExTCP.HasQuseFile)
             {
                 fz    = 0;
                 mz    = 0;
                 qlist = examCtl.Instans.GetQuestion_list();
                 AddQuesBtn(qlist);
             }
             else
             {
                 //如果本地考试文件存在就直接加载已保存试题信息
                 qlist = ExTCP.GET_ques_list.question_list;
                 fz    = ExTCP.GET_ques_list.fz;
                 mz    = ExTCP.GET_ques_list.mz;
                 if (QuseList != null && QuseList.Count > 0)
                 {
                     QuseList.Clear();
                 }
                 AddQuesBtn(qlist);
             }
             //以下设置为可以开考
             this.IsEnabled = true;
             BackOrSetExamStat(false);
         }
         else
         {
             MessageBox.Show("获取考生信息失败,请联系监考老师重启作答客户端!");
         }
     }));
 }