Ejemplo n.º 1
0
 public static AllPrinterConfig GetPrinterConfig()
 {
     if (instance == null)
     {
         string path = Application.StartupPath + "/config/" + FileName;
         if (File.Exists(path))
         {
             instance = (AllPrinterConfig)SerializeHelper.DeserializeFromFile(path);
             if (instance.SysConfig == null)
             {
                 instance.SysConfig = new SystemConfig();
             }
         }
         else
         {
             instance             = new AllPrinterConfig();
             instance.ApplyConfig = new ApplyPrinterConfig();
             instance.F2Config    = new F2PrinterConfig();
             instance.F3Config    = new F3PrinterConfig();
             instance.F4Config    = new F4PrinterConfig();
             instance.F6Config    = new F6PrinterConfig();
             instance.SysConfig   = new SystemConfig();
         }
     }
     return(instance);
 }
Ejemplo n.º 2
0
 public static AllPrinterConfig GetPrinterConfig()
 {
     if (instance == null)
     {
         string path=Application.StartupPath+"/config/"+FileName;
         if (File.Exists(path))
         {
             instance = (AllPrinterConfig)SerializeHelper.DeserializeFromFile(path);
             if (instance.SysConfig == null)
             {
                 instance.SysConfig = new SystemConfig();
             }
         }
         else
         {
             instance = new AllPrinterConfig();
             instance.ApplyConfig = new ApplyPrinterConfig();
             instance.F2Config = new F2PrinterConfig();
             instance.F3Config = new F3PrinterConfig();
             instance.F4Config = new F4PrinterConfig();
             instance.F6Config = new F6PrinterConfig();
             instance.SysConfig = new SystemConfig();
         }
     }
     return instance;
 }
Ejemplo n.º 3
0
        private void CreatePlugin()
        {
            if (firstPlugin)
            {
                string           path   = Application.StartupPath + "/plugins/SystemPlugin.dll";
                FileInfo         dir    = new FileInfo(path);
                AllPrinterConfig config = AllPrinterConfig.GetPrinterConfig();
                string           ip     = config.SysConfig.Ip;
                string           dbname = config.SysConfig.DbName;
                string           userid = config.SysConfig.UID;
                string           pwd    = config.SysConfig.Pwd;
                if (dir.Exists && dbname.Length > 0 && userid.Length > 0)
                {
                    System.Reflection.Assembly ass = System.Reflection.Assembly.LoadFile(path);
                    Type t  = ass.GetType("SystemPlugin.StudentPlugin");
                    Type t1 = typeof(FT.DAL.IDataAccess);
                    System.Reflection.ConstructorInfo cinfo = t.GetConstructor(new Type[] { t1 });

                    object o1 = null;
                    if (config.SysConfig.DbType.ToLower() == "sqlserver")
                    {
                        o1 = new FT.DAL.SqlServer.SqlServerDataHelper(ip, dbname, userid, pwd);
                    }
                    else if (config.SysConfig.DbType.ToLower() == "oracle")
                    {
                        o1 = new FT.DAL.Oracle.OracleDataHelper(dbname, userid, pwd);
                    }
                    else if (config.SysConfig.DbType.ToLower() == "access")
                    {
                        if (pwd.Length > 0)
                        {
                            o1 = new FT.DAL.Access.AccessDataHelper("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=true;Data Source=" + dbname + ";Jet OLEDB:Database Password="******"没有找到插件类,无法同步!");
                    }
                }

                firstPlugin = false;
            }
        }
Ejemplo n.º 4
0
        protected void PrintF5()
        {
            F6PrinterConfig config = AllPrinterConfig.GetPrinterConfig().F6Config;
            int             height = (config.Down - config.Up) * PixelUnit + 215;
            int             width  = (config.Right - config.Left) * PixelUnit + 250;
            int             sep    = 36;

            this.DrawTitleDefault();
            height += sep;
            this.Draw15String(Student.Name, new Point(width, height));
            this.Draw15String(Student.Sex, new Point(width + 300, height));
            height += sep + 5;
            if (Student.ExamId != null && Student.ExamId.Length > 0)
            {
                this.Draw15String(Student.ExamId, new Point(width, height));
            }
            else if (config.ExamIdPrefix.Length > 0)
            {
                this.Draw15String(config.ExamIdPrefix, new Point(width, height));
            }
            height += sep;
            this.Draw15String(Student.IdCard, new Point(width, height));
            height += sep + 5;
            //this.Draw13String(Fm.Windows.Forms.CompanyInfoForm.Info.NickName, new System.Drawing.Point(width, height));
            if (config.PrintCompany)
            {
                this.Draw15String(this.GetNickName(), new System.Drawing.Point(width, height));
                //this.DrawTitle(new System.Drawing.Point(width, height));
            }
            string tmp = Student.NewCarType;

            if (tmp.ToUpper() == "C1" && config.CheckC1)
            {
                if (Student.NewCarStyle.IndexOf("轿") != -1)
                {
                    tmp += "轿";
                }
                else if (Student.NewCarStyle.IndexOf("货") != -1)
                {
                    tmp += "货";
                }
            }
            this.Draw15String(tmp, new Point(width + 300, height));
            height += sep;
            if (config.ExamAddress.Length > 0)
            {
                this.Draw15String(config.ExamAddress, new Point(width, height));
            }
        }
Ejemplo n.º 5
0
        protected void PrintF3()
        {
            F3PrinterConfig config = AllPrinterConfig.GetPrinterConfig().F3Config;

            //this.Draw13String(Fm.Windows.Forms.CompanyInfoForm.Info.NickName, new System.Drawing.Point(610, 75));
            this.DrawTitle(new System.Drawing.Point(610, 75));
            int height = (config.Down - config.Up) * PixelUnit + 150;
            int width  = (config.Right - config.Left) * PixelUnit + 150;
            int sep    = 36;

            this.Draw15String(Student.Name, new Point(width, height));
            this.Draw15String(Student.Sex, new Point(width + 170, height));
            this.Draw15String(Convert.ToDateTime(Student.Birthday).ToString("yyyy-MM-dd"), new Point(width + 300, height));
            this.Draw15String(Student.Nation, new Point(width + 550, height));
            height += sep;
            this.Draw15String(Student.IdCardType, new Point(width, height));

            StringFormat stringFormat = new StringFormat();

            stringFormat.LineAlignment = StringAlignment.Center;
            stringFormat.Alignment     = StringAlignment.Center;

            for (int i = 0; i < Student.IdCard.Length; i++)
            {
                MyGraphics.DrawString(Student.IdCard[i].ToString(), body15Font, blackBrush, new RectangleF(width + 216 + 22 * i, height - 6, 22, 35), stringFormat);
                //MyGraphics.DrawString(idCard[i].ToString(), body9Font, blackBrush, new RectangleF(445 + 19 * i , height - 6, 19, 35), stringFormat);
                // MyGraphics.DrawRectangle(blackPen, 332 + 17 * i + (i / 2) * 1, height - 7, 17, 36);+ (i / 2) * 1
                // this.Draw15String(idCard[i].ToString(), new Point(334 + i * tempIdSep, height));
            }
            height += sep + 10;
            this.Draw15String(Student.NewCarType, new Point(width + 150, height));
            if (config.PrintProfile && student.LearnType == "增驾")
            {
                this.Draw15String(Student.Profile, new Point(width + 300, height));
            }

            height += sep;
            this.Draw15String(Student.Mobile, new Point(width + 300, height));
            Font check = new Font("宋体", 20);

            this.DrawStringHor("√", check, new Point(width + 93, height + sep));//MyGraphics.DrawImageUnscaled(Image.FromFile(Gou), new Point(width + 63, height));
        }
Ejemplo n.º 6
0
 private void StudentBrowser_Load(object sender, EventArgs e)
 {
     if (!this.DesignMode)
     {
         IDCardConfig config = FT.Commons.Cache.StaticCacheManager.GetConfig <IDCardConfig>();
         if (config.UseIDCard)
         {
             reader = new IDCardReaderHelper(new De_ReadICCardComplete(AfterReadIdCard));
         }
         AllPrinterConfig printconfig = AllPrinterConfig.GetPrinterConfig();
         if (printconfig.SysConfig.DefaultEye != null && printconfig.SysConfig.DefaultEye.Length != 0)
         {
             try
             {
                 this.txtLeftEye.Text = this.txtRightEye.Text = printconfig.SysConfig.DefaultEye;
             }
             catch (System.Exception exe)
             {
             }
         }
         this.txtDescription.KeyDown -= new KeyEventHandler(FormHelper.EnterToTab);
         this.InitAllAddress();
     }
 }
Ejemplo n.º 7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                AllPrinterConfig config = AllPrinterConfig.GetPrinterConfig();
                config.ApplyConfig.Up              = (int)this.numApplyUp.Value;
                config.ApplyConfig.Down            = (int)this.numApplyDown.Value;
                config.ApplyConfig.Left            = (int)this.numApplyLeft.Value;
                config.ApplyConfig.Right           = (int)this.numApplyRight.Value;
                config.ApplyConfig.PrintProfile    = this.cbApplyProfile.Checked;
                config.ApplyConfig.Allow2Dimension = this.cbApply2Dimension.Checked;
                config.ApplyConfig.PrintXiangCun   = this.cbPrintXiangCun.Checked;
                config.ApplyConfig.PrintApplyDate  = this.cbPrintApplyDate.Checked;
                config.ApplyConfig.IsBodyCheck     = this.cbApplyBodyCheck.Checked;
                config.ApplyConfig.NameDown        = (int)this.numApplyNameDown.Value;
                config.ApplyConfig.NameLeft        = (int)this.numApplyNameLeft.Value;

                config.ApplyConfig.CarDown  = (int)this.numApplyDownCar.Value;
                config.ApplyConfig.CarUp    = (int)this.numApplyUpCar.Value;
                config.ApplyConfig.CarLeft  = (int)this.numApplyLeftCar.Value;
                config.ApplyConfig.CarRight = (int)this.numApplyRightCar.Value;

                config.ApplyConfig.GouDown  = (int)this.numGouDown.Value;
                config.ApplyConfig.GouUp    = (int)this.numGouUp.Value;
                config.ApplyConfig.GouLeft  = (int)this.numGouLeft.Value;
                config.ApplyConfig.GouRight = (int)this.numGouRight.Value;


                config.F2Config.Up        = (int)this.numF2Up.Value;
                config.F2Config.Down      = (int)this.numF2Down.Value;
                config.F2Config.Left      = (int)this.numF2Left.Value;
                config.F2Config.Right     = (int)this.numF2Right.Value;
                config.F2Config.CheckC1   = this.cbF2CheckC1.Checked;
                config.F2Config.PrintDate = this.cbF2PrintDate.Checked;

                config.F3Config.Up           = (int)this.numF3Up.Value;
                config.F3Config.Down         = (int)this.numF3Down.Value;
                config.F3Config.Left         = (int)this.numF3Left.Value;
                config.F3Config.Right        = (int)this.numF3Right.Value;
                config.F3Config.PrintProfile = this.cbF3Profile.Checked;


                config.F4Config.Up        = (int)this.numF4Up.Value;
                config.F4Config.Down      = (int)this.numF4Down.Value;
                config.F4Config.Left      = (int)this.numF4Left.Value;
                config.F4Config.Right     = (int)this.numF4Right.Value;
                config.F4Config.CheckC1   = this.cbF4CheckC1.Checked;
                config.F4Config.PrintDate = this.cbF4PrintDate.Checked;

                config.F6Config.Up           = (int)this.numF6Up.Value;
                config.F6Config.Down         = (int)this.numF6Down.Value;
                config.F6Config.Left         = (int)this.numF6Left.Value;
                config.F6Config.Right        = (int)this.numF6Right.Value;
                config.F6Config.ExamIdPrefix = this.txtExamIdPrefix.Text.Trim();
                config.F6Config.PrintCompany = this.cbPrintCompany.Checked;
                config.F6Config.ExamAddress  = this.txtExamAddress.Text.Trim();
                config.F6Config.CheckC1      = this.cbF6CheckC1.Checked;

                config.SysConfig.ApplySkin  = this.cbApplySkin.Checked;
                config.SysConfig.UseIDCard  = this.cbUseIDCard.Checked;
                config.SysConfig.Ip         = this.txtIp.Text.Trim();
                config.SysConfig.DbName     = this.txtDbName.Text.Trim();
                config.SysConfig.UID        = this.txtUID.Text.Trim();
                config.SysConfig.Pwd        = this.txtPwd.Text.Trim();
                config.SysConfig.DbType     = this.cbDbType.Text.Trim();
                config.SysConfig.DefaultEye = this.txtSysDefaultEye.Text.Trim();

                if (config.ShareConfig == null)
                {
                    config.ShareConfig = new ShareDbConfig();
                }
                config.ShareConfig.Ip = this.txtShareDbIp.Text.Trim();

                AllPrinterConfig.Save();
                MessageBoxHelper.Show("保存配置成功!");
            }
            catch (Exception ex)
            {
                MessageBoxHelper.Show("保存配置失败,错误:" + ex.Message);
            }
        }
Ejemplo n.º 8
0
        private void PrintSettingForm_Load(object sender, EventArgs e)
        {
            AllPrinterConfig config = AllPrinterConfig.GetPrinterConfig();

            this.numApplyUp.Value          = config.ApplyConfig.Up;
            this.numApplyDown.Value        = config.ApplyConfig.Down;
            this.numApplyLeft.Value        = config.ApplyConfig.Left;
            this.numApplyRight.Value       = config.ApplyConfig.Right;
            this.cbApplyProfile.Checked    = config.ApplyConfig.PrintProfile;
            this.cbApply2Dimension.Checked = config.ApplyConfig.Allow2Dimension;
            this.cbPrintXiangCun.Checked   = config.ApplyConfig.PrintXiangCun;
            this.cbPrintApplyDate.Checked  = config.ApplyConfig.PrintApplyDate;
            this.cbApplyBodyCheck.Checked  = config.ApplyConfig.IsBodyCheck;
            this.numApplyNameDown.Value    = config.ApplyConfig.NameDown;
            this.numApplyNameLeft.Value    = config.ApplyConfig.NameLeft;
            this.numApplyDownCar.Value     = config.ApplyConfig.CarDown;
            this.numApplyUpCar.Value       = config.ApplyConfig.CarUp;
            this.numApplyLeftCar.Value     = config.ApplyConfig.CarLeft;
            this.numApplyRightCar.Value    = config.ApplyConfig.CarRight;

            this.numGouDown.Value  = config.ApplyConfig.GouDown;
            this.numGouUp.Value    = config.ApplyConfig.GouUp;
            this.numGouLeft.Value  = config.ApplyConfig.GouLeft;
            this.numGouRight.Value = config.ApplyConfig.GouRight;

            this.numF2Up.Value         = config.F2Config.Up;
            this.numF2Down.Value       = config.F2Config.Down;
            this.numF2Left.Value       = config.F2Config.Left;
            this.numF2Right.Value      = config.F2Config.Right;
            this.cbF2CheckC1.Checked   = config.F2Config.CheckC1;
            this.cbF2PrintDate.Checked = config.F2Config.PrintDate;

            this.numF3Up.Value       = config.F3Config.Up;
            this.numF3Down.Value     = config.F3Config.Down;
            this.numF3Left.Value     = config.F3Config.Left;
            this.numF3Right.Value    = config.F3Config.Right;
            this.cbF3Profile.Checked = config.F3Config.PrintProfile;

            this.numF4Up.Value         = config.F4Config.Up;
            this.numF4Down.Value       = config.F4Config.Down;
            this.numF4Left.Value       = config.F4Config.Left;
            this.numF4Right.Value      = config.F4Config.Right;
            this.cbF4CheckC1.Checked   = config.F4Config.CheckC1;
            this.cbF4PrintDate.Checked = config.F4Config.PrintDate;

            this.numF6Up.Value          = config.F6Config.Up;
            this.numF6Down.Value        = config.F6Config.Down;
            this.numF6Left.Value        = config.F6Config.Left;
            this.numF6Right.Value       = config.F6Config.Right;
            this.txtExamIdPrefix.Text   = config.F6Config.ExamIdPrefix;
            this.cbPrintCompany.Checked = config.F6Config.PrintCompany;
            this.txtExamAddress.Text    = config.F6Config.ExamAddress;
            this.cbF6CheckC1.Checked    = config.F6Config.CheckC1;

            this.cbUseIDCard.Checked   = config.SysConfig.UseIDCard;
            this.cbApplySkin.Checked   = config.SysConfig.ApplySkin;
            this.txtIp.Text            = config.SysConfig.Ip;
            this.txtDbName.Text        = config.SysConfig.DbName;
            this.txtUID.Text           = config.SysConfig.UID;
            this.cbDbType.Text         = config.SysConfig.DbType;
            this.txtPwd.Text           = config.SysConfig.Pwd;
            this.txtSysDefaultEye.Text = config.SysConfig.DefaultEye;

            if (config.ShareConfig != null)
            {
                this.txtShareDbIp.Text = config.ShareConfig.Ip;
            }
        }
Ejemplo n.º 9
0
 private void btnRestore_Click(object sender, EventArgs e)
 {
     AllPrinterConfig.Restore();
 }
Ejemplo n.º 10
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     AllPrinterConfig.BackUp();
 }
Ejemplo n.º 11
0
        public static void Load()
        {
            string path = Application.StartupPath + "/config/" + FileName;

            instance = (AllPrinterConfig)SerializeHelper.DeserializeFromFile(path);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 直接打印
        /// </summary>
        public void PrintExcel(bool saveInk)
        {
            GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();


            if (!saveInk)
            {
                string strExcelTemplateFile = Application.StartupPath + "/template/" + "驾驶证申请表";
                strExcelTemplateFile += "-" + this.Student.LearnType + ".xlt";
                //System.IO.Path.GetFullPath(@"驾驶证申请表.xlt");
                excel.Open(strExcelTemplateFile);
            }//用模板文件
            else
            {
                string strExcelTemplateFile = Application.StartupPath + "/template/" + "套打-驾驶证申请表";
                //System.IO.Path.GetFullPath(@"驾驶证申请表.xlt");
                strExcelTemplateFile += "-" + this.Student.LearnType + ".xlt";
                excel.Open(strExcelTemplateFile);
                //excel.Open();
            }
            excel.IsVisibledExcel = false;

            Code39 code39 = new Code39();

            code39.WidthCU    = 2;
            code39.LineHeight = 20;
            try
            {
                //SizeF titleSize = MyGraphics.MeasureString("1", code39.titleFont);
                code39.Height = code39.topHeight + code39.LineHeight + (int)20;//定义图片高度
                Bitmap map        = code39.CreateBarCode(Student.IdCard);
                string pathcode39 = Application.StartupPath + "/tempcode39.jpg";
                ImageHelper.SaveCoderPic(map, pathcode39);
                // map.Save(pathcode39, System.Drawing.Imaging.ImageFormat.Jpeg);
                excel.InsertPicture(3, 1, pathcode39, 155, 26, 0);
            }
            catch (Exception ex)
            {
                //LogFactoryWrapper.Debug("由于证件号码有汉字,不支持code39编码!");
            }

            //excel.SetCellText(1, 24, 1, 30, "驾校:" + Fm.Windows.Forms.CompanyInfoForm.Info.NickName);
            //excel.SetCellText(2, 24, 2, 30, "驾校-" + Fm.Windows.Forms.CompanyInfoForm.Info.NickName);
            // excel.SetCellText(1, 1, "  " + this.name);
            // excel.SetCellText(1, 20, "  " + this.name);
            //excel.SetCellText(1, 21, "  " + this.name);
            CompanyInfo comp = StaticCacheManager.GetConfig <CompanyInfo>();

            excel.SetCellText(1, 22, "驾校:" + comp.NickName);
            //excel.SetCellText(1, 23, "  " + this.name);
            // excel.SetCellText(2, 24, 2, 30, "  " + this.name);

            excel.SetCellText(4, 3, 4, 11, "  " + Student.Name);

            excel.SetCellText(4, 14, 4, 15, Student.Sex);
            excel.SetCellText(4, 19, 4, 24, Student.Birthday);
            excel.SetCellText(4, 27, 4, 30, Student.Nation);
            excel.SetCellText(5, 3, 5, 4, Student.IdCardType);
            if (Student.IdCardType.Length < IdCardTypeMaxLen)
            {
                excel.SetFont(5, 3, 6, 4, new Font("宋体", 15f));
            }


            for (int i = 0; i < Student.IdCard.Length; i++)
            {
                excel.SetCellText(5, 7 + i, Student.IdCard[i].ToString());
            }
            if (Student.TempId.Length > 0)
            {
                excel.SetCellText(6, 3, 6, 4, "暂住证");

                for (int i = 0; i < Student.TempId.Length; i++)
                {
                    excel.SetCellText(6, 7 + i, Student.TempId[i].ToString());
                }
            }
            excel.SetCellText(7, 3, 7, 24, "  " + Student.RegAddress);
            string connadd = this.GetConnAddress();

            excel.SetCellText(8, 3, 8, 24, "  " + connadd);
            if (connadd.Length < ConnAddressMaxLen)
            {
                excel.SetFont(8, 3, 8, 24, new Font("宋体", 15f));
            }

            excel.SetCellText(9, 3, 9, 13, "  " + Student.Phone);
            excel.SetCellText(9, 18, 9, 24, Student.PostCode);
            excel.SetCellText(10, 11, 10, 17, Student.NewCarType);
            DateTime regDate = System.DateTime.Now;

            if (AllPrinterConfig.GetPrinterConfig().ApplyConfig.PrintApplyDate)
            {
                excel.SetCellText(35, 25, 36, 30, regDate.Year + " 年 " + regDate.Month + " 月 " + regDate.Day + "日");
            }
            string path = Application.StartupPath + "/temp.jpg";

            if (Student.LearnType == "初学")
            {
                if (AllPrinterConfig.GetPrinterConfig().ApplyConfig.Allow2Dimension)
                {
                    //this.GetQRImage(Student.Dimension).Save(path, System.Drawing.Imaging.ImageFormat.Jpeg);
                    ImageHelper.SaveCoderPic(this.GetQRImage(Student.Dimension), path);
                    //excel.InsertPicture(25, 23, path, 110, 110, 5);
                    excel.InsertPicture(27, 16, path, 100, 100, 5);
                }
            }
            else
            {
                excel.SetCellText(10, 25, 10, 30, Student.OldCarType);
                if (AllPrinterConfig.GetPrinterConfig().ApplyConfig.PrintProfile)
                {
                    excel.SetCellText(3, 25, 3, 30, Student.Profile);
                }
            }


            /*if (this.LearnTypeString == "初学")
             * {
             *  if (!this.saveInk)
             *  {
             *      excel.SetCellText(10, 3, "□初次申领");
             *  }
             *  else
             *  {
             *      excel.SetCellText(10, 3, "√");
             *  }
             *
             * }
             * else
             * {
             *  if (!this.saveInk)
             *  {
             *      excel.SetCellText(11, 3, "□增加准驾车型");
             *  }
             *  else
             *  {
             *      excel.SetCellText(11, 3, "√");
             *  }
             *  excel.SetCellText(10, 25, 10, 30, this.HaveCarType);
             * }
             */
            GlobalPrintSetting printSetting = StaticCacheManager.GetConfig <GlobalPrintSetting>();

            if (printSetting.PrintModel == "直接打")
            {
                excel.Print();
            }
            else
            {
                excel.PrintPreview();
            }


            excel.Close();
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 验证输入
        /// </summary>
        /// <returns></returns>
        private bool CheckRegAddress()
        {
            if (this.cbNation.SelectedValue == null)
            {
                MessageBoxHelper.Show("国籍只能选择,不能手输!");
                this.tabControl1.SelectedIndex = 0;
                this.cbNation.Focus();
                return(false);
            }
            if (this.cbRegProvince.SelectedValue == null)
            {
                MessageBoxHelper.Show("请选择完整的证件省份!");
                this.tabControl1.SelectedIndex = 0;
                this.cbRegProvince.Focus();
                return(false);
            }
            if (this.cbRegCity.SelectedValue == null)
            {
                MessageBoxHelper.Show("请选择完整的证件市区!");
                this.tabControl1.SelectedIndex = 0;
                this.cbRegCity.Focus();
                return(false);
            }
            if (this.cbRegArea.SelectedValue == null)
            {
                MessageBoxHelper.Show("请选择完整的证件县区!");
                this.tabControl1.SelectedIndex = 0;
                this.cbRegArea.Focus();
                return(false);
            }

            if (!this.CheckBirthDay(18, 70))
            {
                MessageBoxHelper.Show("申请驾驶证的年龄必须在18岁到70岁之间!");
                this.tabControl1.SelectedIndex = 0;
                this.dateBirthday.Focus();
                return(false);
            }

            int height = 0;
            AllPrinterConfig config = AllPrinterConfig.GetPrinterConfig();

            if (config.ApplyConfig.IsBodyCheck)
            {
                try
                {
                    height = int.Parse(this.txtHeight.Text.ToString());
                    if (height == 0)
                    {
                        MessageBoxHelper.Show("身高必须大于0!");
                        this.tabControl1.SelectedIndex = 1;
                        this.txtHeight.Focus();
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    height = 0;
                    MessageBoxHelper.Show("身高必须是整数!");
                    this.tabControl1.SelectedIndex = 1;
                    this.txtHeight.Focus();
                    return(false);
                }
            }

            string car = this.cbNewCarType.Text;

            if (car == "C1" || car == "C2" || car == "F")
            {
                if (!this.CheckBirthDay(18, 70))
                {
                    MessageBoxHelper.Show("申请车型C1、C2、F时,年龄必须在18至70周岁之间!");

                    this.tabControl1.SelectedIndex = 0;
                    this.cbNewCarType.Focus();
                    return(false);
                }
            }
            if (car == "C3" || car == "C4" || car == "D" || car == "E" || car == "M")
            {
                if (!this.CheckBirthDay(18, 60))
                {
                    MessageBoxHelper.Show("申请车型C3、C4、D、E、M时,年龄必须在18至60周岁之间!");
                    this.tabControl1.SelectedIndex = 0;
                    this.cbNewCarType.Focus();
                    return(false);
                }
            }
            if (car == "B1" || car == "B2" || car == "A3" || car == "N" || car == "P")
            {
                if (!this.CheckBirthDay(21, 50))
                {
                    MessageBoxHelper.Show("申请车型B1、B2、A3、N、P时,年龄必须在21至50周岁之间!");
                    this.tabControl1.SelectedIndex = 0;
                    this.cbNewCarType.Focus();
                    return(false);
                }
            }
            if (car == "A2")
            {
                if (!this.CheckBirthDay(24, 50))
                {
                    MessageBoxHelper.Show("申请车型A2时,年龄必须在24至50周岁之间!");
                    this.tabControl1.SelectedIndex = 0;
                    this.cbNewCarType.Focus();
                    return(false);
                }
            }
            if (car == "A1")
            {
                if (!this.CheckBirthDay(26, 50))
                {
                    MessageBoxHelper.Show("申请车型A1时,年龄必须在26至50周岁之间!");
                    this.tabControl1.SelectedIndex = 0;
                    this.cbNewCarType.Focus();
                    return(false);
                }
            }
            decimal stature;

            if (config.ApplyConfig.IsBodyCheck)
            {
                try
                {
                    stature = height;
                    if (car == "A1" || car == "A2" || car == "A3" || car == "B2" || car == "N")
                    {
                        if (config.ApplyConfig.IsBodyCheck && stature < 155)
                        {
                            MessageBoxHelper.Show("申请车型A1、A2、A3、B2、N时,身高需在155厘米以上!");
                            this.tabControl1.SelectedIndex = 1;
                            this.txtHeight.Focus();
                            return(false);
                        }
                    }
                    if (car == "B1")
                    {
                        if (config.ApplyConfig.IsBodyCheck && stature < 150)
                        {
                            MessageBoxHelper.Show("申请车型B1时,身高需在150厘米以上!");
                            this.tabControl1.SelectedIndex = 1;
                            this.txtHeight.Focus();
                            return(false);
                        }
                    }
                }
                catch
                {
                    MessageBoxHelper.Show("身高必须为数字");
                    this.tabControl1.SelectedIndex = 1;
                    this.txtHeight.Focus();
                    return(false);
                }
            }

            if (config.ApplyConfig.IsBodyCheck)
            {
                double leftEye = 0;
                try
                {
                    leftEye = double.Parse(this.txtLeftEye.Text.ToString());
                }
                catch
                {
                    MessageBoxHelper.Show("左视力必须为数字");
                    this.tabControl1.SelectedIndex = 1;
                    this.txtLeftEye.Focus();
                    return(false);
                }
                double rightEye = 0;
                try
                {
                    rightEye = double.Parse(this.txtRightEye.Text.ToString());
                }
                catch
                {
                    MessageBoxHelper.Show("右视力必须为数字");
                    this.tabControl1.SelectedIndex = 1;
                    this.txtRightEye.Focus();
                    return(false);
                }
                int dec  = int.Parse(System.Configuration.ConfigurationManager.AppSettings["EyeDecimal"]);
                int temp = 1;
                if (dec == 0)
                {
                    temp *= 10;
                }
                if (car == "A1" || car == "A2" || car == "A3" || car == "B1" || car == "B2" || car == "N" || car == "P")
                {
                    if (leftEye < 5.0 * temp || rightEye < 5.0 * temp)
                    {
                        MessageBoxHelper.Show("申请车型" + car + "时,左右视力必须在" + 5.0 * temp + "以上");
                        this.tabControl1.SelectedIndex = 1;
                        this.txtLeftEye.Focus();
                        return(false);
                    }
                }
                else
                {
                    if (leftEye < 4.9 * temp || rightEye < 4.9 * temp)
                    {
                        MessageBoxHelper.Show("申请车型" + car + "时,左右视力必须在" + 4.9 * temp + "以上");
                        this.tabControl1.SelectedIndex = 1;
                        this.txtRightEye.Focus();
                        return(false);
                    }
                }
                if (this.cbLeftDownBody.SelectedIndex == 0 && this.cbNewCarType.Text != "C2")
                {
                    MessageBoxHelper.Show("左下肢不合格者只能申请C2!");
                    this.tabControl1.SelectedIndex = 1;
                    this.cbLeftDownBody.Focus();
                    return(false);
                }

                if (this.cbHospital.Text.Trim() == string.Empty)
                {
                    MessageBoxHelper.Show("必须输入体检医院!");
                    this.tabControl1.SelectedIndex = 1;
                    this.cbHospital.Focus();
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 14
0
 public static void Load()
 {
     string path = Application.StartupPath + "/config/" + FileName;
     instance=  (AllPrinterConfig)SerializeHelper.DeserializeFromFile(path);
 }
Ejemplo n.º 15
0
        private void PrintApply()
        {
            ApplyPrinterConfig config = AllPrinterConfig.GetPrinterConfig().ApplyConfig;
            int height = (config.Down - config.Up) * BaseStudentPrinter.PixelUnit + 140;
            //int sep = 35;
            int sep = 31;
            // int width = 132;
            int width = (config.Right - config.Left) * BaseStudentPrinter.PixelUnit + 90;

            //16,2
            //MyGraphics.DrawImage(this.GetQRImage(this.GetQRString()),new Point(620,860));
            //14,2
            if (Student.LearnType == "初学")
            {
                if (config.Allow2Dimension)
                {
                    string path = Application.StartupPath + "/temp.jpg";
                    //string path = Application.StartupPath + "/tempcode39.jpg";
                    log.Debug("要打印人的姓名:" + Student.Name);
                    log.Debug("要打印人的身份证号码:" + Student.IdCard);
                    log.Debug("要打印人的二维条码信息为:" + Student.Dimension);
                    ImageHelper.SaveCoderPic(this.GetQRImage(Student.Dimension), path);
                    // MyGraphics.DrawImage(Image.FromFile(path), new Rectangle(new Point(516 + width, 720 + height), new Size(150, 150)));
                    Image imagetest = Image.FromFile(path);

                    Image imagetmp = new System.Drawing.Bitmap(imagetest);


                    MyGraphics.DrawImage(imagetest, new Rectangle(new Point(356 + width, 790 + height), new Size(130, 130)));
                    imagetest.Dispose();
                    File.Delete(path);
                    imagetmp.Dispose();
                }
            }
            DateTime regDate = System.DateTime.Now;

            if (config.PrintApplyDate)
            {
                this.Draw10String(regDate.Year + "   " + regDate.Month + "  " + regDate.Day, new Point(width + 567, height + 920));
            }

            //MyGraphics.DrawImage(this.GetQRImage(this.GetQRString()), new Point(320, 460));
            //画出驾校简称
            //MyGraphics.DrawRectangle(blackPen, 600, 10, 680, 30);
            //this.DrawStringHor("驾校简称:" + Fm.Windows.Forms.CompanyInfoForm.Info.NickName,  new Point(605, 55));
            // this.Draw11String("驾校简称:" + Fm.Windows.Forms.CompanyInfoForm.Info.NickName, new Point(605,55));
            CompanyInfo comp = StaticCacheManager.GetConfig <CompanyInfo>();

            this.DrawStringHor("驾校:" + comp.NickName, new Font("黑体", 15), new Point(480 + width - config.NameLeft * BaseStudentPrinter.PixelUnit, height - 120 + config.NameDown * BaseStudentPrinter.PixelUnit));
            // 画出身份证明号码的一维条码



            Code39 code39 = new Code39();

            code39.WidthCU    = 2;
            code39.LineHeight = 20;
            try
            {
                SizeF titleSize = MyGraphics.MeasureString("1", code39.titleFont);
                code39.Height = code39.topHeight + code39.LineHeight + (int)titleSize.Height;//定义图片高度
                Bitmap map  = code39.CreateBarCode(Student.IdCard);
                string path = Application.StartupPath + "/tempcode39.jpg";
                ImageHelper.SaveCoderPic(map, path);
                Image imagetest2 = Image.FromFile(path);
                Image imagetmp2  = new System.Drawing.Bitmap(imagetest2);

                MyGraphics.DrawImage(imagetmp2, new RectangleF(width - 40, height - 46, 240, 30));
                imagetest2.Dispose();
                File.Delete(path);
                imagetmp2.Dispose();
            }
            catch (Exception ex)
            {
                //LogFactoryWrapper.Debug("由于证件号码有汉字,不支持code39编码!");
            }

            if (config.PrintProfile && Student.LearnType != "初学")
            {
                this.Draw15String(Student.Profile, new Point(width + 555, height - 34));//+75
            }


            this.Draw15String(Student.Name, new Point(width, height));//+75
            this.Draw15String(Student.Sex, new Point(319 + width, height));
            this.Draw15String(Student.Birthday, new Point(width + 436, height));
            this.Draw15String(Student.Nation, new Point(606 + width, height));



            height += sep - 2;
            if (Student.IdCardType.Length < IdCardTypeMaxLen)
            {
                this.Draw15String(Student.IdCardType, new Point(width, height + 5));
            }
            else
            {
                this.Draw9String(Student.IdCardType, new Point(width, height + 5));
            }

            //画身份证号码
            StringFormat stringFormat = new StringFormat();

            stringFormat.LineAlignment = StringAlignment.Center;
            stringFormat.Alignment     = StringAlignment.Center;
            for (int i = 0; i < Student.IdCard.Length; i++)
            {
                //MyGraphics.DrawString(idCard[i].ToString(), body11Font, blackBrush, new RectangleF(332 + 17 * i+(i/2)*1, height - 7, 17, 35), stringFormat);


                MyGraphics.DrawString(Student.IdCard[i].ToString(), body15Font, blackBrush, new RectangleF(width + 165 + 22 * i + (i / 6) * 1, height - 7, 22, 35), stringFormat);
                // MyGraphics.DrawRectangle(blackPen, 332 + 17 * i + (i / 2) * 1, height - 7, 17, 36);
                // this.Draw11String(idCard[i].ToString(), new Point(334 + i * tempIdSep, height));
            }

            this.PrintSelfPhoto();
            height += sep - 3;
            //画暂住证明

            if (Student.TempId != null && Student.TempId != string.Empty)
            {
                this.Draw15String("暂住证", new Point(width, height + 5));


                for (int i = 0; i < Student.TempId.Length; i++)
                {
                    MyGraphics.DrawString(Student.TempId[i].ToString(), body15Font, blackBrush, new RectangleF(width + 165 + 21 * i + (i / 2) * 1, height - 5, 21, 35), stringFormat);
                }
            }
            height += sep + 5;
            //string connadd = this.GetConnAddress();
            // string connadd = Student.RegAddress;
            string connadd = Student.ConnAddress;

            if (connadd.Length < ConnAddressMaxLen)
            {
                this.Draw15String(connadd, new Point(width, height));
            }
            else
            {
                this.Draw12String(connadd, new Point(width, height));
            }
            //this.Draw15String(Student.RegAddress, new Point(width, height));

            height += sep + 5;
            this.Draw15String(Student.Phone, new Point(width, height));
            this.Draw15String(Student.Description, new Point(410 + 100, height));

            height += sep + 6;
            this.Draw15String(Student.Mobile, new Point(width, height));
            this.Draw15String(Student.PostCode, new Point(410 + 100, height));

            height += sep + 10;
            //this.Draw11String(this.allowCar, new Point(470, height));
            this.Draw15String(Student.NewCarType, new Point(width + 170 + (config.CarRight - config.CarLeft) * BaseStudentPrinter.PixelUnit, (config.CarDown - config.CarUp) * BaseStudentPrinter.PixelUnit + height + 50));
            //为增驾或者初学打钩
            Font check = new Font("宋体", 20);

            if (Student.LearnType == "初学")
            {
                // this.Draw11String("√", new Point(width+18, height+2));
                this.DrawStringHor("√", check, new Point(width - 58 + (config.GouDown - config.GouUp) * BaseStudentPrinter.PixelUnit, height - 5 + (config.GouRight - config.GouLeft) * BaseStudentPrinter.PixelUnit));
            }
            else
            {
                //this.Draw11String("√", new Point(width+18, height+sep-1));
                this.DrawStringHor("√", check, new Point(width - 58 + (config.GouDown - config.GouUp) * BaseStudentPrinter.PixelUnit, height + sep - 6 + (config.GouRight - config.GouLeft) * BaseStudentPrinter.PixelUnit));
                //this.Draw15String(Student.OldCarType, new Point(568 + width, height));
            }
        }
Ejemplo n.º 16
0
        /*
         * 套打-全部6张(F1)
         * 套打-机动车驾驶培训记录*3(F2)
         * 套打-机动车驾驶人身体条件证明(F3)
         * 套打-机动车驾驶员培训学员登记表(F4)
         * 套打-机动车学习驾驶员登记表(F5)
         * 套打-科目三考试成绩表(F6)
         * 套打-机动车驾驶人档案(F7)
         */
        protected void PrintF2()
        {
            F2PrinterConfig config = AllPrinterConfig.GetPrinterConfig().F2Config;
            int             height = (config.Left - config.Right) * PixelUnit - 690;
            int             width  = (config.Down - config.Up) * PixelUnit + 900;
            int             sep    = 47;


            //驾校简称
            this.DrawStringVerAndHor("驾校:" + this.GetNickName(), new Font("黑体", 15), new Point(width, height - 50));


            height += sep;
            //姓名
            this.DrawStringVerAndHor(Student.Name, body15Font, new Point(width - 670, height));
            //性别
            this.DrawStringVerAndHor(Student.Sex, body15Font, new Point(width - 500, height));

            //身份证明号码
            this.DrawStringVerAndHor(Student.IdCard, body15Font, new Point(width - 350, height));

            //入学时间
            if (config.PrintDate)
            {
                this.DrawStringVerAndHor(Convert.ToDateTime(Student.BaoMingDate).ToString("yyyy-MM-dd"), body14Font, new Point(width - 70, height));
            }

            height += sep;
            //家庭住址
            this.DrawStringVerAndHor(Student.RegAddress, body11Font, new Point(width - 670, height));

            // 联系方式
            this.DrawStringVerAndHor(Student.Mobile, body15Font, new Point(width - 260, height));

            height += sep + 10;
            int  len   = allowCars.Length;
            Font check = new Font("宋体", 20);

            width -= 660;
            //申请车型
            if (config.CheckC1 && student.NewCarType.ToUpper() == "C1")
            {
                if (Student.NewCarStyle.IndexOf("轿") != -1)
                {
                    this.DrawStringVerAndHor("J", check, new Point(width + 50 * (5), height));
                }
                else if (Student.NewCarStyle.IndexOf("货") != -1)
                {
                    this.DrawStringVerAndHor("H", check, new Point(width + 50 * (5), height));
                }
            }
            else
            {
                for (int i = 0; i < len; i++)
                {
                    if (Student.NewCarType == allowCars[i])
                    {
                        // "√"
                        this.DrawStringVerAndHor("√", check, new Point(width + 48 * (i) - (i / 2) * 6, height));
                        //this.DrawImageVerAndHor(Gou, new Point(width + 48 * (i) - (i / 2) * 6, height));
                        break;
                    }
                }
            }
        }
Ejemplo n.º 17
0
        protected void PrintF4()
        {
            F4PrinterConfig config = AllPrinterConfig.GetPrinterConfig().F4Config;
            int             height = (config.Down - config.Up) * PixelUnit + 130;
            int             width  = (config.Right - config.Left) * PixelUnit + 170;
            int             sep    = 55;

            //this.Draw13String(Fm.Windows.Forms.CompanyInfoForm.Info.NickName, new System.Drawing.Point(width + 70, height - 5));
            this.DrawTitle(new System.Drawing.Point(width + 70, height - 5));
            height += sep;
            this.Draw15String(Student.Name, new Point(width, height));
            this.Draw15String(Student.Sex, new Point(width + 200, height));
            DateTime date = Convert.ToDateTime(Student.Birthday);

            this.Draw15String(date.Year.ToString(), new Point(width + 350, height));
            this.Draw15String(date.Month.ToString(), new Point(width + 412, height));

            height += sep;
            this.Draw15String(Student.IdCard, new Point(width, height));
            height += sep;

            if (Student.RegAddress.Length >= ConnAddressMaxLen)
            {
                this.Draw9String(Student.RegAddress, new Point(width, height));
            }
            else
            {
                this.Draw15String(Student.RegAddress, new Point(width, height));
            }


            height += sep;
            this.Draw15String(Student.Mobile, new Point(width, height));

            // height += sep;
            if (student.LearnType == "增驾")
            {
                this.Draw15String(Student.OldCarType, new Point(width + 300, height));
            }
            height += sep - 15;
            //车辆类型打钩
            //申请车型

            Font check = new Font("宋体", 20);

            if (config.CheckC1 && student.NewCarType.ToUpper() == "C1")
            {
                Point tmp = new Point(width + 211, height + 35);
                if (Student.NewCarStyle.IndexOf("轿") != -1)
                {
                    this.DrawStringHor("J", check, tmp);
                }
                else if (Student.NewCarStyle.IndexOf("货") != -1)
                {
                    this.DrawStringHor("H", check, tmp);
                }
            }
            else
            {
                for (int i = 0; i < allowCars.Length; i++)
                {
                    if (Student.NewCarType == allowCars[i])
                    {
                        // "√"
                        this.DrawStringHor("√", check, new Point(width + 211 + 65 * (i % 5), height + 35 * (i / 5)));
                        //MyGraphics.DrawImageUnscaled(Image.FromFile(Gou), new Point(width + 211 + 65 * (i % 5), height + 35 * (i / 5)));
                        break;
                    }
                }
            }

            //this.DrawStringHor("√", check, new Point(width + 60, height + 50));
            //MyGraphics.DrawImage(Image.FromFile(Gou), new Point(width + 60, height + 50));
            DateTime regDate = Convert.ToDateTime(Student.BaoMingDate);

            height = 700;
            if (config.PrintDate)
            {
                this.Draw15String(regDate.Year.ToString(), new Point(width, height));
                this.Draw15String(regDate.Month.ToString(), new Point(width + 90, height));
                this.Draw15String(regDate.Day.ToString(), new Point(width + 140, height));
            }
        }