示例#1
0
        //打印条形码
        private void button1_Click(object sender, EventArgs e)
        {
            label45.Text = "";
            string address     = richTextBox1.Text;
            string sexcomboBox = this.comboBox1.Text;
            string sex         = "1";

            if ("男".Equals(sexcomboBox))
            {
                sex = "1";
            }
            else if ("女".Equals(sexcomboBox))
            {
                sex = "2";
            }
            else if ("未说明的性别".Equals(sexcomboBox))
            {
                sex = "9";
            }
            else if ("未知的性别".Equals(sexcomboBox))
            {
                sex = "0";
            }
            string birthday = textBox8.Text;
            string signdate = textBox4.Text;
            string number   = textBox3.Text;
            string name     = textBox1.Text;
            string people   = "1";
            string tmp      = comboBox2.Text;

            if (tmp == "")
            {
                tmp = "汉族";
            }
            DataRow[] drw = dtno.Select("name='" + tmp + "'");
            if (drw != null)
            {
                people = drw[0]["id"].ToString();
            }

            if (number == null || number == "" || "".Equals(number))
            {
                MessageBox.Show("身份证号不能为空,如未带身份证,请手动填写身份证号!");
                return;
            }
            if (number.Length != 18)
            {
                MessageBox.Show("身份证号有误,请输入正确的号码!");
                return;
            }
            DisplayPersonTeShuInfo(number);
            string    time1  = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd") + " 00:00:00";
            DataTable dttjjk = grjddao.selectTjjk(number, time1);

            if (dttjjk != null && dttjjk.Rows.Count > 0)
            {
                MessageBox.Show("此居民身份证号在7天内已经登记过,不能再次登记,如需补打条码,请点击补打条码按钮!");
                return;
            }
            if (name != null && !"".Equals(name) && birthday != null && !"".Equals(birthday))
            {
                shengName                   = bsdao.selectAreaBycode(shengcode).Rows[0][0].ToString();
                shiName                     = bsdao.selectAreaBycode(shicode).Rows[0][0].ToString();
                qxName                      = bsdao.selectAreaBycode(qxcode).Rows[0][0].ToString();
                xzName                      = bsdao.selectAreaBycode(xzcode).Rows[0][0].ToString();
                xcName                      = bsdao.selectAreaBycode(xcuncode).Rows[0][0].ToString();
                grjdxx                      = new grjdxxBean();
                grjdxx.name                 = name;
                grjdxx.Sex                  = sex;
                grjdxx.Nation               = people;
                grjdxx.Birthday             = birthday;
                grjdxx.Zhuzhi               = address;
                grjdxx.Cardcode             = number;
                grjdxx.IssuingAgencies      = signdate;
                grjdxx.CardPic              = textBox3.Text + ".jpg";
                grjdxx.photo_code           = grjdxx.Cardcode + ".jpg";
                grjdxx.age                  = DateTime.Now.Year - Int32.Parse(grjdxx.Birthday.Substring(0, 4));
                grjdxx.aichive_org          = basicInfoSettings.organ_name;
                grjdxx.create_org           = frmLogin.organCode;
                grjdxx.create_org_name      = basicInfoSettings.organ_name;
                grjdxx.doctor_name          = basicInfoSettings.zeren_doctor;
                grjdxx.create_archives_name = basicInfoSettings.input_name;
                grjdxx.residence_address    = basicInfoSettings.allareaname;
                grjdxx.province_name        = shengName;
                grjdxx.province_code        = shengcode;
                grjdxx.city_code            = shicode;
                grjdxx.city_name            = shiName;
                grjdxx.county_code          = qxcode;
                grjdxx.county_name          = qxName;
                grjdxx.towns_code           = xzcode;
                grjdxx.towns_name           = xzName;
                grjdxx.village_code         = xcuncode;
                grjdxx.village_name         = xcName;
                grjdxx.create_name          = frmLogin.user_Name;
            }
            else
            {
                MessageBox.Show("居民信息填写不完整!");
                return;
            }
            //if (pictureBox2.Image == null)
            //{
            //    MessageBox.Show("没有摄像头拍摄照片,请重试!");
            //    return;
            //}

            xmlDoc.Load(path);
            node    = xmlDoc.SelectSingleNode("config/chejiahao");
            carcode = node.InnerText;
            carcode = carcode.Substring(carcode.Length - 4, 4);

            node = xmlDoc.SelectSingleNode("config/barnumCode");  //获取最后一次的编号
            string barnumCode = node.InnerText;

            node = xmlDoc.SelectSingleNode("config/chebiaoshi");  //获取车标识
            string chebiaoshi = node.InnerText;

            if (chebiaoshi == null || chebiaoshi.Length != 3)
            {
                MessageBox.Show("车标识不正确,请确认系统设置中的车标识!"); return;
            }
            ;
            string finalBarCode = CreateBarCode(chebiaoshi, barnumCode);

            if (carcode == null || carcode.Length != 4)
            {
                MessageBox.Show("车编号不正确,请确认系统设置中的车编号!"); return;
            }
            ;

            string nameCode = textBox1.Text + " " + Regex.Replace(textBox3.Text, "(\\d{6})\\d{10}(\\d{2})", "$1**********$2");

            if (nameCode.IndexOf('*') < 0)
            {
                nameCode = textBox1.Text + " " + textBox3.Text.Substring(0, 6) + "**********" + textBox3.Text.Substring(16, 2);
            }
            OnPrintSampleBarcode(finalBarCode, Int32.Parse(this.numericUpDown1.Value.ToString()), nameCode);

            node = xmlDoc.SelectSingleNode("config/barnumCode");
            int fnum = Int32.Parse(barnumCode) + 1;

            if (fnum == 1000000)
            {
                fnum = 1;
            }
            node.InnerText = fnum.ToString();
            xmlDoc.Save(path);

            registrationRecordCheck();//右侧统计信息
        }
示例#2
0
        private void basicInfoSettings_Load(object sender, EventArgs e)
        {
            issave = "0";
            Common.SetComboBoxInfo(comboBox1, ltdorganizationDao.GetShengInfo());
            showCombobox();

            DataTable dtbasic = bsdao.checkBasicsettingInfo();

            if (dtbasic.Rows.Count > 0)
            {
                zeren_doctor   = dtbasic.Rows[0]["zeren_doctor"].ToString();
                zeren_doctorId = dtbasic.Rows[0]["update_user"].ToString();
                organ_name     = dtbasic.Rows[0]["organ_name"].ToString();
                input_name     = dtbasic.Rows[0]["input_name"].ToString();
                createtime     = dtbasic.Rows[0]["create_time"].ToString();
                xcuncode       = dtbasic.Rows[0]["cun_code"].ToString();
                shengcode      = dtbasic.Rows[0]["sheng_code"].ToString();

                Common.SetComboBoxInfo(comboBox2, ltdorganizationDao.GetCityInfo(shengcode));

                shicode = dtbasic.Rows[0]["shi_code"].ToString();

                Common.SetComboBoxInfo(comboBox3, ltdorganizationDao.GetCountyInfo(shicode));

                qxcode = dtbasic.Rows[0]["qx_code"].ToString();
                Common.SetComboBoxInfo(comboBox4, areadao.zhenInfo(qxcode));

                //this.comboBox4.DataSource = areadao.zhenInfo(qxcode);//绑定数据源
                //this.comboBox4.DisplayMember = "name";//显示给用户的数据集表项
                //this.comboBox4.ValueMember = "code";//操作时获取的值

                xzcode = dtbasic.Rows[0]["xz_code"].ToString();
                Common.SetComboBoxInfo(comboBox5, areadao.cunInfo(xzcode));

                //this.comboBox5.DataSource = areadao.cunInfo(xzcode);//绑定数据源
                //this.comboBox5.DisplayMember = "name";//显示给用户的数据集表项
                //this.comboBox5.ValueMember = "code";//操作时获取的值

                allareaname = dtbasic.Rows[0]["allFullName"].ToString();
                bc          = dtbasic.Rows[0]["bc"].ToString();
                xcg         = dtbasic.Rows[0]["xcg"].ToString();
                sh          = dtbasic.Rows[0]["sh"].ToString();
                sgtz        = dtbasic.Rows[0]["sgtz"].ToString();
                ncg         = dtbasic.Rows[0]["ncg"].ToString();
                xdt         = dtbasic.Rows[0]["xdt"].ToString();
                xy          = dtbasic.Rows[0]["xy"].ToString();
                wx          = dtbasic.Rows[0]["wx"].ToString();
                string czy     = dtbasic.Rows[0]["operation"].ToString();
                string carname = dtbasic.Rows[0]["car_name"].ToString();
                string other   = dtbasic.Rows[0]["other"].ToString();
                if (xzcode != null && !"".Equals(xzcode))
                {
                    xzName = bsdao.selectAreaBycode(xzcode).Rows[0][0].ToString();
                }
                if (xcuncode != null && !"".Equals(xcuncode))
                {
                    xcName = bsdao.selectAreaBycode(xcuncode).Rows[0][0].ToString();
                }
                shengName = bsdao.selectAreaBycode(shengcode).Rows[0][0].ToString();
                shiName   = bsdao.selectAreaBycode(shicode).Rows[0][0].ToString();
                qxName    = bsdao.selectAreaBycode(qxcode).Rows[0][0].ToString();
                //因为名称有可能对应不上那么就用code对应
                Common.SetComboBoxSelectIndex(comboBox1, shengcode);
                Common.SetComboBoxSelectIndex(comboBox2, shicode);
                Common.SetComboBoxSelectIndex(comboBox3, qxcode);
                Common.SetComboBoxSelectIndex(comboBox4, xzcode);
                Common.SetComboBoxSelectIndex(comboBox5, xcuncode);

                this.textBox1.Text  = organ_name;
                this.comboBox6.Text = input_name;
                this.comboBox7.Text = zeren_doctor;

                this.comboBox8.Text  = bc;
                this.comboBox9.Text  = xcg;
                this.comboBox10.Text = sh;
                this.comboBox11.Text = sgtz;
                this.comboBox12.Text = ncg;
                this.comboBox13.Text = xdt;
                this.comboBox14.Text = xy;
                this.comboBox16.Text = czy;
                this.comboBox17.Text = carname;

                this.textBox2.Text = other;
                this.textBox3.Text = wx;

                issave = "1";
            }
            //this.comboBox7.DropDownStyle = ComboBoxStyle.DropDownList;
            if (IsInternetAvailable())
            {
                isPaint = true;
                button2_Paint(null, new PaintEventArgs(CreateGraphics(), ClientRectangle));
            }
            else
            {
                isPaint = false;
                button2_Paint(null, new PaintEventArgs(CreateGraphics(), ClientRectangle));
            }
        }