コード例 #1
0
        public EditStudentCheckDetail(string activityId, string studentId)
        {
            InitializeComponent();
            StudentCheckData            checkData = dbUtill.GetStudentCheckInfo(activityId, studentId);
            Dictionary <string, string> dic       = checkDataUtill.GetDicByBackStr(checkData.jsonContent);
            Student student1 = dbUtill.GetStudentNameAndBirthDayByID(studentId);

            name.Text     = student1.studentName;
            age.Text      = dic["AG"];
            date.Text     = checkData.checkDate;
            birthday.Text = student1.birthday.Split(' ')[0];
            if (dic["GE"].Equals("0"))
            {
                sex.Text = "男";
            }
            else
            {
                sex.Text = "女";
            }
            weight.Text = dic["Wk"];
            Pt.Text     = dic["Pt"];
            FW.Text     = dic["FW"];
            fW.Text     = dic["fW"];
            wW.Text     = dic["wW"];
            MW.Text     = dic["MW"];
            mW.Text     = dic["mW"];
            height.Text = dic["Hm"];
            BMI.Text    = dic["MI"];
            rB.Text     = dic["rB"];
            bW.Text     = dic["bW"];
        }
コード例 #2
0
        //确定
        private void Button_Click_1(object sender, System.Windows.RoutedEventArgs e)
        {
            StudentCheckData            checkData = dbUtill.GetStudentCheckInfo(activityId, studentId);
            Dictionary <string, string> dic       = checkDataUtill.GetDicByBackStr(checkData.jsonContent);

            dic["Wk"] = weight.Text;
            dic["AG"] = age.Text;
            dic["Pt"] = Pt.Text;
            dic["FW"] = FW.Text;
            dic["fW"] = fW.Text;
            dic["wW"] = wW.Text;
            dic["MW"] = MW.Text;
            dic["mW"] = mW.Text;
            dic["Hm"] = height.Text;
            dic["MI"] = BMI.Text;
            dic["rB"] = rB.Text;
            dic["bW"] = bW.Text;
            string jsonContent = checkDataUtill.DictionaryListToString(dic);
            int    i           = dbUtill.EditStudentCheckInfo(activityId, studentId, jsonContent);

            if (i > 0)
            {
                MessageBox.Show("修改成功", "提示");
                Close();
            }
            else
            {
                MessageBox.Show("修改失败", "提示");
                Close();
            }
        }
コード例 #3
0
ファイル: TestActivity.xaml.cs プロジェクト: DayDreamM/Tanita
        //删除检测结果
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            Student          student   = StdDataGrid.SelectedItem as Student;
            StudentCheckData checkData = dbUtill.GetStudentCheckInfo(Uid, student.studentId);

            if (checkData.jsonContent != null)
            {
                if (System.Windows.MessageBox.Show("是否删除检测记录?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    int i = dbUtill.DeleteCheckData(Uid, student.studentId);
                    if (i > 0)
                    {
                        gradepanel.Children.Clear();
                        TestActivityInit(ActivityName, ActivityId);
                        System.Windows.MessageBox.Show("删除成功", "提示");
                    }
                    else
                    {
                        System.Windows.MessageBox.Show("删除失败", "提示");
                    }
                }
            }
            else
            {
                System.Windows.MessageBox.Show("该学生不存在检测结果", "提示");
            }
        }
コード例 #4
0
ファイル: TestActivity.xaml.cs プロジェクト: DayDreamM/Tanita
 //打印报告
 private void PrintCheck_Click(object sender, RoutedEventArgs e)
 {
     if (StdDataGrid.SelectedItem is Student student)
     {
         Report           rp         = new Report();
         string           studentId  = student.studentId;
         string           activityId = Uid;
         StudentCheckData checkData  = dbUtill.GetStudentCheckInfo(activityId, studentId);
         if (checkData != null)
         {
             if (checkData.jsonContent != null)
             {
                 rp.checkData = checkData;
                 rp.PrintService();
             }
             else
             {
                 System.Windows.MessageBox.Show("体测数据不存在", "错误");
             }
         }
         else
         {
             System.Windows.MessageBox.Show("体测数据不存在", "错误");
         }
     }
 }
コード例 #5
0
ファイル: CheckDataUtill.cs プロジェクト: DayDreamM/Tanita
        public bool GetCheckDataByBackStr(string backStr, out StudentCheckData checkData, out string errMsg)
        {
            backStr = backStr.Replace(",DT,", ",Da,");
            backStr = backStr.Replace("\"", "");
            Dictionary <string, string> dicByBackStr = GetDicByBackStr(backStr);

            errMsg    = "";
            checkData = new StudentCheckData();
            string jsonByDic = JsonHelper.GetJsonByDic(dicByBackStr);

            checkData = JsonHelper.DeserializeAnonymousType(jsonByDic, checkData, out errMsg);
            bool flag = !string.IsNullOrEmpty(errMsg);
            bool result;

            if (flag)
            {
                result = false;
            }
            else
            {
                checkData.jsonContent = backStr;
                checkData.Pdate       = DateTime.Now;
                result = true;
            }
            return(result);
        }
コード例 #6
0
ファイル: Test.xaml.cs プロジェクト: DayDreamM/Tanita
 //接收数据
 private void Com_DataReceived(object sender, SerialDataReceivedEventArgs e)
 {
     if (PortConfig.serialPort1.IsOpen)
     {
         string backStr = PortConfig.serialPort1.ReadExisting();
         if (backStr.Length < 30)
         {
             if (backStr.Trim() == "@")
             {
                 Dispatcher.Invoke(new Action(() =>
                 {
                     CheckBtn.Background = System.Windows.Media.Brushes.Orange;
                     CheckBtn.Content    = "正在设置数据";
                 }));
             }
             else if (backStr.Trim() == "S6")
             {
                 Dispatcher.Invoke(new Action(() =>
                 {
                     CheckBtn.Content = "检测中......";
                 }));
             }
         }
         if (backStr.Length > 30)
         {
             if (backStr.Substring(0, 1) == "{")
             {
                 StudentCheckData data = new StudentCheckData
                 {
                     activityId  = activityId,
                     studentId   = stnId,
                     checkDate   = DateTime.Now.ToString(),
                     jsonContent = backStr
                 };
                 bool isSave = dbUtill.SavaStudentCheckData(data);
                 if (isSave)
                 {
                     MessageBox.Show("检测完毕,请离开体测仪", "提示");
                 }
                 else
                 {
                     MessageBox.Show("保存失败,请离开体测仪", "提示");
                 }
                 Dispatcher.Invoke(new Action(() =>
                 {
                     CheckBtn.Content = "开始检测";
                 }));
             }
         }
     }
     else
     {
         MessageBox.Show("串口未打开", "提示");
     }
 }
コード例 #7
0
ファイル: TestActivity.xaml.cs プロジェクト: DayDreamM/Tanita
 //详情
 private void CheckInfo_Click(object sender, RoutedEventArgs e)
 {
     if (StdDataGrid.SelectedItem is Student student)
     {
         StudentDetail    studentDetail = new StudentDetail();
         string           studentId     = student.studentId;
         string           activityId    = Uid;
         StudentCheckData checkData     = dbUtill.GetStudentCheckInfo(activityId, studentId);
         if (checkData.jsonContent == null || checkData.jsonContent.Equals(""))
         {
             System.Windows.MessageBox.Show("体测数据未存在", "错误");
         }
         else
         {
             Dictionary <string, string> dic = checkDataUtill.GetDicByBackStr(checkData.jsonContent);
             Student student1 = dbUtill.GetStudentNameAndBirthDayByID(studentId);
             studentDetail.name.Text     = student1.studentName;
             studentDetail.age.Text      = dic["AG"];
             studentDetail.date.Text     = checkData.checkDate;
             studentDetail.birthday.Text = student1.birthday.Split(' ')[0];
             if (dic["GE"].Equals("0"))
             {
                 studentDetail.sex.Text = "男";
             }
             else
             {
                 studentDetail.sex.Text = "女";
             }
             studentDetail.weight.Text = dic["Wk"];
             studentDetail.Pt.Text     = dic["Pt"];
             studentDetail.FW.Text     = dic["FW"];
             studentDetail.fW.Text     = dic["fW"];
             studentDetail.wW.Text     = dic["wW"];
             studentDetail.MW.Text     = dic["MW"];
             studentDetail.mW.Text     = dic["mW"];
             studentDetail.height.Text = dic["Hm"];
             studentDetail.BMI.Text    = dic["MI"];
             studentDetail.rB.Text     = dic["rB"];
             studentDetail.bW.Text     = dic["bW"];
             studentDetail.ShowDialog();
         }
     }
 }
コード例 #8
0
ファイル: TestActivity.xaml.cs プロジェクト: DayDreamM/Tanita
 //修改检测结果
 private void MenuItem_Click_1(object sender, RoutedEventArgs e)
 {
     if (StdDataGrid.SelectedItem is Student student)
     {
         StudentDetail    studentDetail = new StudentDetail();
         string           studentId     = student.studentId;
         string           activityId    = Uid;
         StudentCheckData checkData     = dbUtill.GetStudentCheckInfo(activityId, studentId);
         if (checkData.jsonContent == null || checkData.jsonContent.Equals(""))
         {
             System.Windows.MessageBox.Show("体测数据不存在", "错误");
         }
         else
         {
             EditStudentCheckDetail EditStudentDetail = new EditStudentCheckDetail(activityId, studentId)
             {
                 activityId = activityId,
                 studentId  = studentId
             };
             EditStudentDetail.ShowDialog();
         }
     }
 }