Esempio n. 1
0
        //打印条形码
        private void button1_Click(object sender, EventArgs e)
        {
            string address  = richTextBox1.Text;
            string sex      = textBox9.Text;
            string birthday = textBox8.Text;
            string signdate = textBox4.Text;
            string number   = textBox3.Text;
            string name     = textBox1.Text;
            string people   = textBox2.Text;

            if (number != null && !"".Equals(number) && name != null && !"".Equals(name) && birthday != null && !"".Equals(birthday))
            {
                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";
            }
            else
            {
                MessageBox.Show("居民信息填写不完整!");
                return;
            }
            if (pictureBox1.Image == null || pictureBox2.Image == null)
            {
                MessageBox.Show("没有身份证照片或摄像头拍摄照片,请重试!");
                return;
            }

            Random rand    = new Random();
            int    randnum = rand.Next(10000, 99999);

            xmlDoc.Load(path);
            node    = xmlDoc.SelectSingleNode("config/carCode");
            carcode = node.InnerText;
            if (carcode == null || carcode.Length != 4)
            {
                MessageBox.Show("车编号不正确,请确认系统设置中的车编号!"); return;
            }
            ;

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

            if (textBox1.Text == "" || textBox3.Text == "")
            {
                OnPrintSampleBarcode(carcode + randnum.ToString(), Int32.Parse(this.numericUpDown1.Value.ToString()), "测试 2202****1410186221");
            }
            else
            {
                OnPrintSampleBarcode(carcode + randnum.ToString(), Int32.Parse(this.numericUpDown1.Value.ToString()), nameCode);
            }
        }
Esempio n. 2
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();//右侧统计信息
        }