Esempio n. 1
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count < 1)
            {
                MessageBox.Show("未选中任何行!"); return;
            }
            string archiveno = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
            string idnumber  = dataGridView1.SelectedRows[0].Cells[2].Value.ToString();
            string sql       = "";

            if (archiveno != "")
            {
                sql = string.Format("select * from elderly_selfcare_estimate Where aichive_no='{0}'", archiveno);
            }
            else
            {
                sql = string.Format("select * from elderly_selfcare_estimate Where id_number='{0}'", idnumber);
            }
            DataSet estimate = DbHelperMySQL.Query(sql);

            if (estimate != null && estimate.Tables[0].Rows.Count > 0)
            {
                //判断是否上传
                DataTable data          = estimate.Tables[0];
                string    upload_status = data.Rows[0]["upload_status"].ToString();
                if (upload_status == "1")
                {
                    string _testdate   = data.Rows[0]["test_date"].ToString();
                    string _strDisplay = string.Format("已经上传,问询日期为{0} !", _testdate);
                    MessageBox.Show(_strDisplay);
                    return;
                }

                string _totalscore      = data.Rows[0]["total_score"].ToString();
                string _judgementresult = data.Rows[0]["judgement_result"].ToString();
                if (_judgementresult == "")
                {
                    MessageBox.Show("还未测评不能上传!"); return;
                }
                List <string> sqllist = new List <string>();
                string        _id     = data.Rows[0]["id"].ToString();
                sqllist.Add($@"delete from elderly_selfcare_estimate where id={Ifnull(data.Rows[0]["id"])};");
                sqllist.Add($@"insert into elderly_selfcare_estimate (id,name,archive_no,id_number,test_date,answer_result,total_score,judgement_result,test_doctor,create_user,create_name,create_org,create_org_name,create_time
                ) values({Ifnull(data.Rows[0]["id"])},{Ifnull(data.Rows[0]["name"])},{Ifnull(data.Rows[0]["aichive_no"])},{Ifnull(data.Rows[0]["id_number"])},{Ifnull(data.Rows[0]["test_date"])},{Ifnull(data.Rows[0]["answer_result"])},{Ifnull(data.Rows[0]["total_score"])},{Ifnull(data.Rows[0]["judgement_result"])},{Ifnull(data.Rows[0]["test_doctor"])},{Ifnull(data.Rows[0]["create_user"])},{Ifnull(data.Rows[0]["create_name"])},{Ifnull(data.Rows[0]["create_org"])},{Ifnull(data.Rows[0]["create_org_name"])},{Ifnull(Convert.ToDateTime(data.Rows[0]["create_time"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"))})");
                int ret = DbHelperMySQL.ExecuteSqlTranYpt(sqllist);

                if (ret > 0)
                {
                    MessageBox.Show("上传成功!");
                    //更新本地表中的状态为 1
                    sql = string.Format("update elderly_selfcare_estimate set  upload_status=1 where  id='{0}'", _id);
                    ret = 0;
                    ret = DbHelperMySQL.ExecuteSql(sql);
                    dataGridView1.SelectedRows[0].Cells[8].Value = 1;
                    dataGridView1.SelectedRows[0].Cells[9].Value = "是";
                    dataGridView1.Refresh();
                }
                else
                {
                    MessageBox.Show("上传失败!");
                }
            }
            else
            {
                MessageBox.Show("无信息不能上传!");
            }
        }
Esempio n. 2
0
        private void btnUpload_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count < 1)
            {
                MessageBox.Show("未选中任何行!"); return;
            }
            int    row        = dataGridView1.CurrentRow.Index;
            string _archiveno = dataGridView1["archive_no", row].Value.ToString();
            string _idnumber  = dataGridView1["id_number", row].Value.ToString();
            string _idd       = dataGridView1["id", row].Value.ToString();
            string sql        = string.Format("select * from elderly_tcm_record Where id='{0}'", _idd);
            //if (_archiveno != "")
            //{
            //    sql = string.Format("select * from elderly_tcm_record Where aichive_no='{0}'", _archiveno);
            //}
            //else
            //{
            //    sql = string.Format("select * from elderly_tcm_record Where id_number='{0}'", _idnumber);
            //}
            DataSet estimate = DbHelperMySQL.Query(sql);

            if (estimate != null && estimate.Tables[0].Rows.Count > 0)
            {
                //判断是否上传
                DataTable data          = estimate.Tables[0];
                string    _uploadstatus = data.Rows[0]["upload_status"].ToString();
                if (_uploadstatus == "1")
                {
                    string _testdate   = data.Rows[0]["test_date"].ToString();
                    string _strDisplay = string.Format("已经上传,日期为{0} !", _testdate);
                    MessageBox.Show(_strDisplay);
                    return;
                }

                string _answerresult = data.Rows[0]["answer_result"].ToString();
                if (_answerresult == "")
                {
                    MessageBox.Show("还未参加体质服务不能上传!"); return;
                }
                List <string> sqllist = new List <string>();
                //这里上传对应的档案信息
                string str1 = "";
                string str2 = "";
                GetResidentBaseInfo(_idnumber, out str1, out str2);
                if (str1 != "")
                {
                    sqllist.Add(str1);
                    sqllist.Add(str2);
                }
                string _id = data.Rows[0]["id"].ToString();
                sqllist.Add($@"delete from elderly_tcm_record where id={Ifnull(data.Rows[0]["id"])};");
                sqllist.Add($@"insert into elderly_tcm_record (id,name,archive_no,id_number,test_date,answer_result,qixuzhi_score,qixuzhi_result,yangxuzhi_score,yangxuzhi_result,yinxuzhi_score,yinxuzhi_result,tanshizhi_score,tanshizhi_result,shirezhi_score,shirezhi_result,xueyuzhi_score,xueyuzhi_result,qiyuzhi_score,qiyuzhi_result,tebingzhi_sorce,tebingzhi_result,pinghezhi_sorce,pinghezhi_result,test_doctor,tcm_guidance,create_user,create_name,create_org,create_org_name,create_time,upload_status,exam_id) 
                            values({Ifnull(data.Rows[0]["id"])},{Ifnull(data.Rows[0]["name"])},{Ifnull(data.Rows[0]["aichive_no"])},{Ifnull(data.Rows[0]["id_number"])},{Ifnull(data.Rows[0]["test_date"])},{Ifnull(data.Rows[0]["answer_result"])},{Ifnull(data.Rows[0]["qixuzhi_score"])},{Ifnull(data.Rows[0]["qixuzhi_result"])},{Ifnull(data.Rows[0]["yangxuzhi_score"])},
                            {Ifnull(data.Rows[0]["yangxuzhi_result"])},{Ifnull(data.Rows[0]["yinxuzhi_score"])},{Ifnull(data.Rows[0]["yinxuzhi_result"])},{Ifnull(data.Rows[0]["tanshizhi_score"])},{Ifnull(data.Rows[0]["tanshizhi_result"])},{Ifnull(data.Rows[0]["shirezhi_score"])},{Ifnull(data.Rows[0]["shirezhi_result"])},{Ifnull(data.Rows[0]["xueyuzhi_score"])},{Ifnull(data.Rows[0]["xueyuzhi_result"])},{Ifnull(data.Rows[0]["qiyuzhi_score"])},{Ifnull(data.Rows[0]["qiyuzhi_result"])},{Ifnull(data.Rows[0]["tebingzhi_sorce"])},{Ifnull(data.Rows[0]["tebingzhi_result"])},{Ifnull(data.Rows[0]["pinghezhi_sorce"])},{Ifnull(data.Rows[0]["pinghezhi_result"])},{Ifnull(data.Rows[0]["test_doctor"])},{Ifnull(data.Rows[0]["tcm_guidance"])},
                            {Ifnull(data.Rows[0]["create_user"])},{Ifnull(data.Rows[0]["create_name"])},{Ifnull(data.Rows[0]["create_org"])},{Ifnull(data.Rows[0]["create_org_name"])},{Ifnull(Convert.ToDateTime(data.Rows[0]["create_time"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"))},{Ifnull(data.Rows[0]["upload_status"])},{Ifnull(data.Rows[0]["exam_id"])}
                            );");
                int ret = DbHelperMySQL.ExecuteSqlTranYpt(sqllist);
                if (ret > 0)
                {
                    MessageBox.Show("上传成功!");
                    //更新本地表中的状态为 1
                    sql = string.Format("update elderly_tcm_record set  upload_status=1 where  id='{0}'", _id);
                    ret = 0;
                    ret = DbHelperMySQL.ExecuteSql(sql);
                    dataGridView1.SelectedRows[0].Cells[6].Value = "是";
                    dataGridView1.Refresh();
                }
                else
                {
                    MessageBox.Show("上传失败!");
                }
            }
            else
            {
                MessageBox.Show("无信息不能上传!");
            }
        }