示例#1
0
        public EditActivity(string activityId)
        {
            InitializeComponent();
            string activityName = dbUtill.GetActivitieNameByID(activityId);

            txtUserName.Text = activityName;
        }
示例#2
0
        //保存报告图片
        public void CreateMC780_boy()
        {
            Dictionary <string, string> dic = checkDataUtill.GetDicByBackStr(checkData.jsonContent);
            Font     font   = new Font("宋体", 11f);
            Font     font1  = new Font("宋体", 7f);
            Font     font2  = new Font("宋体", 9f);
            Font     font3  = new Font("宋体", 6f);
            int      num    = 0x317;
            int      num1   = 0x45f;
            Image    image  = Image.FromFile(@"Resources/780_boy.jpg");
            Image    image2 = new Bitmap(num1, num);
            Graphics g      = Graphics.FromImage(image2);

            g.DrawImage(image, 0, 0, num1, num);
            string studentName = dbUtill.GetStudentNameByID(checkData.studentId);
            string studentId   = checkData.studentId;
            string activityId  = checkData.activityId;

            try
            {
                g.DrawString(studentName, font, Brushes.Black, new Point(75, 72));               //姓名
                g.DrawString(dic["AG"], font, Brushes.Black, new Point(200, 72));                //年龄
                g.DrawString(dic["Da"], new Font("宋体", 11f), Brushes.Black, new Point(300, 72)); //日期
                string sex = dic["GE"];
                if (sex.Equals("1"))
                {
                    g.DrawString("√", font, Brushes.Black, new Point(476, 72)); //性别
                }
                else
                {
                    g.DrawString("√", font, Brushes.Black, new Point(511, 72));
                }
                g.DrawString(studentId, new Font("宋体", 11f), Brushes.Black, new Point(75, 103)); //Id
                g.DrawString(dic["Pt"], font, Brushes.Black, new Point(240, 103));               //着衣重量
                g.DrawString(dic["Hm"], font, Brushes.Black, new Point(330, 103));               //身高
                string bodytype = dic["Bt"];
                if (bodytype.Equals("0"))
                {
                    g.DrawString("√", font, Brushes.Black, new Point(437, 104)); //身体类型
                }
                else
                {
                    g.DrawString("√", font, Brushes.Black, new Point(457, 104));
                }
                g.DrawString(dic["Wk"], font, Brushes.Black, new Point(80, 191));       //体重
                g.DrawString(dic["FW"], font, Brushes.Black, new Point(80, 218));       //体脂率
                g.DrawString(dic["fW"], font, Brushes.Black, new Point(80, 245));       //体脂量
                g.DrawString(dic["MW"], font, Brushes.Black, new Point(80, 271));       //去脂体重
                g.DrawString(dic["wW"], font, Brushes.Black, new Point(80, 297));       //体水份量
                g.DrawString(dic["MI"], font, Brushes.Black, new Point(80, 325));       //BMI
                //参考值
                g.DrawString("30.22~38.11", font3, Brushes.Black, new Point(152, 193)); //体重
                g.DrawString("10~25.9", font3, Brushes.Black, new Point(152, 220));     //体脂率
                g.DrawString("2.84~8.95", font3, Brushes.Black, new Point(152, 247));   //体脂量
                g.DrawString("27.38~29.16", font3, Brushes.Black, new Point(152, 273)); //去脂体重
                g.DrawString("17.1~18.525", font3, Brushes.Black, new Point(152, 299)); //体水份量
                g.DrawString("13.6~18.6", font3, Brushes.Black, new Point(152, 327));   //BMI
                //
                g.DrawString(dic["mW"], font, Brushes.Black, new Point(130, 365));      //肌肉量
                g.DrawString(dic["bW"], font, Brushes.Black, new Point(130, 398));      //推定骨量
                g.DrawString(dic["rB"], font, Brushes.Black, new Point(79, 450));       // 基础代谢率

                g.DrawString(dic["ml"], font1, Brushes.Black, new Point(60, 630));      //左上肢
                g.DrawString(dic["mr"], font1, Brushes.Black, new Point(220, 630));     //BMI
                g.DrawString(dic["mL"], font1, Brushes.Black, new Point(60, 710));      //BMI
                g.DrawString(dic["mR"], font1, Brushes.Black, new Point(220, 710));     //BMI
                g.DrawString(dic["mT"], font1, Brushes.Black, new Point(220, 680));     //躯干
                //肌肉平衡
                g.DrawString(dic["mr"], font1, Brushes.Black, new Point(330, 420));     //左上肢
                g.DrawString(dic["Mr"], font1, Brushes.Black, new Point(490, 420));     //BMI
                g.DrawString(dic["mR"], font1, Brushes.Black, new Point(330, 480));     //BMI
                g.DrawString(dic["MR"], font1, Brushes.Black, new Point(490, 480));     //BMI
                //各部分脂肪
                g.DrawString(dic["Fr"], font1, Brushes.Black, new Point(510, 622));     //右上肢
                g.DrawString(dic["fr"], font1, Brushes.Black, new Point(510, 634));     //
                g.DrawString(dic["Fl"], font1, Brushes.Black, new Point(340, 625));     //左上肢
                g.DrawString(dic["fl"], font1, Brushes.Black, new Point(340, 637));     //
                g.DrawString(dic["FR"], font1, Brushes.Black, new Point(518, 712));     //右下肢
                g.DrawString(dic["fR"], font1, Brushes.Black, new Point(518, 724));     //
                g.DrawString(dic["FL"], font1, Brushes.Black, new Point(335, 708));     //左下肢
                g.DrawString(dic["fL"], font1, Brushes.Black, new Point(335, 720));     //
                g.DrawString(dic["FT"], font1, Brushes.Black, new Point(515, 679));     //躯干部
                g.DrawString(dic["fT"], font1, Brushes.Black, new Point(515, 691));     //
                //
                g.DrawString(dic["fW"], font1, Brushes.Black, new Point(380, 175));     //体脂量
                g.DrawString(dic["bW"], font1, Brushes.Black, new Point(440, 175));     //推定骨量
                g.DrawString(dic["Wk"], font1, Brushes.Black, new Point(318, 330));     //体重
                g.DrawString(dic["MW"], font1, Brushes.Black, new Point(378, 330));     //非脂肪量
                g.DrawString(dic["mW"], font1, Brushes.Black, new Point(438, 330));     //肌肉量
                g.DrawString(dic["wW"], font1, Brushes.Black, new Point(500, 330));     //体水份量
                int    age     = int.Parse(dic["AG"]);
                double weight  = double.Parse(dic["Wk"]) * 3.2;
                double height  = double.Parse(dic["Hm"]) * 2.08;
                int    weight1 = Convert.ToInt32(weight);
                int    height1 = Convert.ToInt32(height);
                if (sex.Equals("0"))
                {
                    g.DrawString("•", font, Brushes.Red, new Point(591 + age * 11, 512 - weight1));         //体重
                    g.DrawString("体重", font, Brushes.Black, new Point(593 + age * 11, 505 - weight1));      //体重
                    g.DrawString(dic["Wk"], font, Brushes.Black, new Point(625 + age * 11, 505 - height1)); //
                    g.DrawString("•", font, Brushes.Blue, new Point(591 + age * 11, 512 - height1));
                    g.DrawString("身高", font, Brushes.Black, new Point(593 + age * 11, 505 - height1));
                    g.DrawString(dic["Hm"], font, Brushes.Black, new Point(625 + age * 11, 505 - height1)); //
                }
                else
                {
                    g.DrawString("•", font, Brushes.Red, new Point(851 + age * 11, 512 - weight1));
                    g.DrawString("体重", font, Brushes.Black, new Point(855 + age * 11, 505 - weight1));      //体重
                    g.DrawString(dic["Wk"], font, Brushes.Black, new Point(895 + age * 11, 505 - weight1)); //体重
                    g.DrawString("•", font, Brushes.Blue, new Point(851 + age * 11, 512 - height1));
                    g.DrawString("身高", font, Brushes.Black, new Point(855 + age * 11, 505 - height1));      //身高
                    g.DrawString(dic["Hm"], font, Brushes.Black, new Point(895 + age * 11, 505 - height1)); //
                }
                g.DrawString(dic["MI"], font, Brushes.Black, new Point(79, 500));                           // 肥胖指数
                double    bmi       = double.Parse(dic["MI"]);
                int       bmi_i     = (int)bmi;
                int       b         = 10 * (bmi_i - 16);
                Rectangle rectangle = new Rectangle(125, 495, 80 + b, 10);
                g.FillRectangle(Brushes.Black, rectangle);
                //建议
                Comment comment = dbUtill.GetComment();
                if (bmi < 18.5)
                {
                    g.DrawString(comment.low, font2, Brushes.Black, new Point(575, 610));
                }
                else if (bmi < 22.5)
                {
                    g.DrawString(comment.mid, font2, Brushes.Black, new Point(575, 610));
                }
                else
                {
                    g.DrawString(comment.hight, font2, Brushes.Black, new Point(575, 610));
                }
                string   url          = dbUtill.GetImageUrl();
                string   activityName = dbUtill.GetActivitieNameByID(checkData.activityId);
                string   res          = dbUtill.GetStudentInfoByStudentId(checkData.studentId);
                string[] resArray     = res.Split(',');
                string   gradeName    = resArray[1];
                string   className    = resArray[0];
                if (!Directory.Exists(@url + "\\" + activityName + "\\" + gradeName + "\\" + className + "\\"))
                {
                    Directory.CreateDirectory(@url + "\\" + activityName + "\\" + gradeName + "\\" + className + "\\");
                }
                image2.Save(@url + "\\" + activityName + "\\" + gradeName + "\\" + className + "\\" + studentId + "_" + studentName + ".jpg");
            }
            catch (Exception ex)
            {
                MessageBox.Show("错误,因为" + ex.Message, "提示");
            }
        }