zoukankan      html  css  js  c++  java
  • 诺亚方舟售票系统V4版本了

    没啥说的闲的没事搞了个卖票的.大家没事给自己的亲朋友好都搞个票玩玩吧.

    先上图吧

    买票前

    买票后

    主要代码

     public class TicketGenerater
        {
            static TicketGenerater()
            {
                try
                {
                    if (File.Exists("index.db"))
                    {
                        using (var sw = new StreamReader("index.db"))
                        {
                            string index = sw.ReadLine();
                            Index = int.Parse(index);
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
    
            private static readonly Font drawFont = new Font("宋体", 16, FontStyle.Bold);
    
            private static readonly SolidBrush drawBrush = new SolidBrush(Color.FromArgb(234, 255, 255));
            private static readonly SolidBrush strBrush = new SolidBrush(Color.FromArgb(0, 0, 100));
    
            private static int _index = 1;
    
            private static readonly Random R = new Random();
    
            private static int Index
            {
                get { return _index; }
                set { _index = value; }
            }
    
    
            private static string Name { get; set; }
    
            private static string IdCode { get; set; }
    
    
            private static string Berth { get; set; }
    
    
            private static string WindowNum { get; set; }
    
            private static string Code { get; set; }
    
            public static Image Preview(string name, string idCode)
            {
                isGenerate = false;
    
                Name = name;
                IdCode = idCode;
                Berth = string.Format("CH-{0}", Index.ToString().PadLeft(4, '0'));
                WindowNum = R.Next(1, 100).ToString();
            
                Code= Guid.NewGuid().ToString().ToUpper().Substring(4);
    
                Bitmap tmp = GenerateTicket();
    
    
                return tmp;
            }
    
            static bool isGenerate = false;
            public static Image Generate()
            {
                if (string.IsNullOrEmpty(Name)) return Resources.船票;
                isGenerate = true;
                Bitmap tmp = GenerateTicket();
    
    
                Index++;
    
                try
                {
                    using (var sw = new StreamWriter("index.db"))
                    {
                        sw.WriteLine(Index);
                    }
                }
                catch (Exception)
                {
                }
                return tmp;
    
            }
    
            private static Bitmap GenerateTicket()
            {
                Bitmap tmp = new Bitmap(Resources.船票);
    
                using (Graphics g = Graphics.FromImage(tmp))
                {
                    g.DrawString(Name, drawFont, drawBrush, new PointF(410, 120));
    
                    g.DrawString(Berth, drawFont, drawBrush, new PointF(760, 120));
    
                    g.DrawString(IdCode, drawFont, drawBrush, new PointF(435, 165));
    
                    g.DrawString(WindowNum, drawFont, drawBrush, new PointF(760, 165));
    
                    g.DrawString(Code, drawFont, strBrush, new PointF(20, 370));
                    if (isGenerate)
                    {
                        g.DrawImage(Resources.章, new PointF(400, 180));
                    }
                    
                }
                return tmp;
            }
        }

     修改了下发布V2版本

    加入了二维码生成功能,你可以用手机试试生成的二维码里是什么东东。

    应一些朋友要示给N多朋友卖票的需求,加入了批量导入功能

    还加了个RP系数.

    30%机会是站票..

    20%机会是三等舱..

    20%机会是二等舱..

    20%机会是一等舱..

    10%机会是豪华舱

    导入格式为

    姓名,身份识别

    姓名

    保存为txt文件就行了

    例如

    张三,zs-1212313

    李三

    王三,ws-1sfs2313

      

    【登舱点】:西藏卓明谷秘密基地

    2012诺亚方舟船票

    【使用方法】:   

    我们将在登船前15天向您发出登船指令。请按时乘坐一切可以乘坐的交通工具,来到西藏。

    在珠峰大本营入口处,对着天空大喊三声:我要上船!!!   

    国内票都为中文口令版,需购其他语言版本,必须在自己国家境内购买,请勿占用中国的宝贵名额。   

    收到指令后,便会有工作人员前来引导您上船。

     **********************************

    源代码 下载

    可执行程序  下载

     **********************************

    源代码 V2版本 下载

    可执行程序 V2版本 下载

    **********************************

    源代码 V4版本 下载

    可执行程序 V4版本 下载

    **********************************

  • 相关阅读:
    null in ABAP and nullpointer in Java
    SAP ABAP SM50事务码和Hybris Commerce的线程管理器
    Hybris service layer和SAP CRM WebClient UI架构的横向比较
    SAP ABAP和Linux系统里如何检查网络传输的数据量
    SAP CRM WebClient UI和Hybris的controller是如何被调用的
    SAP CRM和Cloud for Customer订单中的业务伙伴的自动决定机制
    SAP CRM WebClient UI和Hybris CommerceUI tag的渲染逻辑
    SAP BSP和JSP页面里UI元素的ID生成逻辑
    微信jsapi支付
    微信jsapi退款操作
  • 原文地址:https://www.cnblogs.com/guozk/p/2814107.html
Copyright © 2011-2022 走看看