Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dt;
        string    code = Request["code"];

        string[] ary = code.Split('-');
        code = ary[0] + "-" + ary[1] + "-" + ary[2];

        if (code == null || code == "")
        {
            msg = "無編號";
        }

        else
        {
            LessonLib.JoinData l = LessonLib.Web.Get_ord_JoinData(ary[0]);
            if (l.Id == 0)
            {
                msg = "報名資料不存在";
            }
            else
            {
                string strsql           = "select * from  tbl_joindetail where joinid=@joinid ";
                NameValueCollection nvc = new NameValueCollection
                {
                    { "joinid", ary[1] },
                };
                strsql = "select * from tbl_joinlog where checkcode=@checkcode ";
                nvc.Clear();
                nvc = new NameValueCollection
                {
                    { "checkcode", code },
                };
                dt = DbControl.Data_Get(strsql, nvc);
                if (dt.Rows.Count > 0)
                {
                    msg = "已報到過!";
                }
                else
                {
                    strsql = "insert into tbl_joinlog (checkcode) values (@checkcode)";
                    DbControl.Data_add(strsql, nvc);
                    msg = "報到成功!";
                }
                msg += "<br>訂單編號:" + l.Ord_code + "<br>";
                msg += "付款方式:" + OrderLib.getPaymode(l.OrderData.Paymode) + "<br>";
                msg += "訂單狀態:" + OrderLib.get_ord_status(l.OrderData.Status) + "<br>";
            }
        }
    }
Beispiel #2
0
        public static string Get_JoinData(string ord_code)
        {
            string htmldetail = "";
            string htmlstr;

            LessonLib.JoinData o = LessonLib.Web.Get_ord_JoinData(ord_code);

            htmlstr    = unity.classlib.GetTextString(HttpContext.Current.Server.MapPath(" /templates/Lessondata0.html"));
            htmldetail = unity.classlib.GetTextString(HttpContext.Current.Server.MapPath("/templates/classdetail.html"));
            htmlstr    = htmlstr.Replace("@subject@", o.LessonData.MainData.Subject);
            htmlstr    = htmlstr.Replace("@pic@", o.LessonData.MainData.Pic);
            htmlstr    = htmlstr.Replace("@totalprice@", o.OrderData.TotalPrice.ToString());
            htmlstr    = htmlstr.Replace("@classdate@", o.LessonData.StartDay.ToShortDateString() + "~" + o.LessonData.EndDay.ToShortDateString());
            htmlstr    = htmlstr.Replace("@address@", o.LessonData.Address);
            htmlstr    = htmlstr.Replace("@ord_code@", o.Ord_code);
            htmlstr    = htmlstr.Replace("@DeliveryPrice@", o.OrderData.ShipPrice.ToString());
            htmlstr    = htmlstr.Replace("@ordername@", o.OrderData.Ordname);
            htmlstr    = htmlstr.Replace("@ordermail@", o.OrderData.Ordemail);
            htmlstr    = htmlstr.Replace("@orderphone@", o.OrderData.Ordphone);
            htmlstr    = htmlstr.Replace("@shipname@", o.OrderData.Ordname);
            htmlstr    = htmlstr.Replace("@shipphone@", o.OrderData.Ordphone);
            htmlstr    = htmlstr.Replace("@shipaddress@", o.OrderData.Ordaddress);
            htmlstr    = htmlstr.Replace("@TotalPrice@", "NT$:" + o.OrderData.TotalPrice.ToString());
            htmlstr    = htmlstr.Replace("@paymode@", OrderLib.getPaymode(o.OrderData.Paymode));
            htmlstr    = htmlstr.Replace("@ShipPrice@", o.OrderData.ShipPrice.ToString());
            htmlstr    = htmlstr.Replace("@delivery_kind@", OrderLib.getdelivery_kind(o.OrderData.Delivery_kind));
            htmlstr    = htmlstr.Replace("@ticketname@", o.LessonData.MainData.Subject);
            htmlstr    = htmlstr.Replace("@StartDay@", o.LessonData.MainData.Lesson.StartDay.ToString("yyyy/MM/dd"));
            htmlstr    = htmlstr.Replace("@EndDay@", o.LessonData.MainData.Lesson.EndDay.ToString("yyyy/MM/dd"));
            htmlstr    = htmlstr.Replace("@Lessontime@", o.LessonData.MainData.Lesson.Lessontime);
            htmlstr    = htmlstr.Replace("@paymode@", OrderLib.getPaymode(o.OrderData.Paymode));
            htmlstr    = htmlstr.Replace("@paystatus@", OrderLib.get_ord_status(o.OrderData.Status));
            SpGatewayHelper.Models.TradeInfoLog log = OrderLib.Get_Tradelog(ord_code);
            string payinfo = "";

            if (log.Result.TradeNo != "")
            {
                payinfo += "<tr><td  colspan=\"4\">轉帳資訊:<br>";
                payinfo += "銀行代碼:" + log.Result.BankCode + "<br>";
                payinfo += "帳號:" + log.Result.CodeNo + "<br></td></tr>";
            }
            //  string payinfo = "";
            htmlstr = htmlstr.Replace("@payinfo@", payinfo);

            string temp  = "";
            string temp1 = "";

            foreach (article.LessonDetail d in o.LessonData.LessonDetail)
            {
                var data = o.JoinDetail.Find(y => y.LessonId == d.LessonId);

                // var data = o.LessonData.LessonDetail.FindAll  (y => y.LessonId == d.LessonId).Sum(c => d.Sellprice );
                //  var data = o.LessonData.LessonDetail.FindAll.Where(x => x.ID).Sum(c => c.price)
                if (data != null)
                {
                    temp1 += "<tr><td>" + o.LessonData.MainData.Subject + "</td>";
                    temp1 += "<td  colspan=\"2\">" + d.Description + "</td>";
                    temp1 += "<td  class='text-right'>";
                    temp1 += "NT$" + d.Sellprice + "</td></tr>";
                }
            }
            foreach (LessonLib.JoinDetail d in o.JoinDetail)
            {
                string QrCode = o.Ord_code + "-" + d.JoinId.ToString() + "-" + d.LessonId;
                string url    = "http://www.culturelaunch.net/lib/checkjoin.aspx?code=" + QrCode;
                temp += htmldetail;
                temp  = temp.Replace("@secno@", d.JoinId.ToString());
                temp  = temp.Replace("@ticketno@", QrCode);
                temp  = temp.Replace("@name@", d.Name.ToString());
                temp  = temp.Replace("@email@", d.Email.ToString());
                temp  = temp.Replace("@phone@", d.Phone.ToString());
                temp  = temp.Replace("@qrcode@", QrCode);
                temp  = temp.Replace("@orderno@", ord_code);
                QR_Encode qr = new QR_Encode();
                qr.BackColor = Color.White;
                qr.ForeColor = Color.Black;
                int i = qr.EncodeData(1, 0, true, -1, 5, url, HttpContext.Current.Server.MapPath("upload/" + QrCode + ".gif"), false, 255, 255);
                //Bitmap b = qr.GetBMP; //輸出至前端
                //Response.ContentType = "image/jpeg";
                //b.Save(Response.OutputStream, ImageFormat.Gif);
                //b.Dispose();
            }
            htmlstr = htmlstr.Replace("@detail@", temp1);
            htmlstr = htmlstr.Replace("@classdetail@", temp);
            return(htmlstr);
        }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userid"] == null || Session["Backmenu"] == null || Session["Backmenu"].ToString() == "")
        {
            Response.Redirect("~/account/login.aspx?ReturnUrl=" + Request.RawUrl.ToString());
            Response.End();
        }
        string articleid        = Request.QueryString["articleid"];
        string strsql           = @"select *  FROM        tbl_Joindata  where articleid=@articleid";
        NameValueCollection nvc = new NameValueCollection
        {
            { "articleid", articleid }
        };
        DataTable dt = DbControl.Data_Get(strsql, nvc);
        List <LessonLib.JoinData> JoinData = new List <LessonLib.JoinData>();

        foreach (DataRow dr in dt.Rows)
        {
            LessonLib.JoinData j = LessonLib.Web.Get_ord_JoinData(dr["ord_code"].ToString());
            JoinData.Add(j);
        }
        dt.Dispose();
        int i     = 0;
        int total = 0;

        foreach (LessonLib.JoinData j in JoinData)
        {
            foreach (LessonLib.JoinDetail d in j.JoinDetail)
            {
                var    data = j.LessonData.LessonDetail.Find(y => y.LessonId == d.LessonId);
                string qr   = j.Ord_code + "-" + d.JoinId + "-" + d.LessonId;
                total++;
                html += "<tr>";
                html += "<td>";
                html += "<button type=\"button\"class=\"btn btn-primary\"  data-ord_code=\"" + j.Ord_code + "\" data-toggle=\"modal\" data-target=\"#exampleModal\">";
                html += j.Ord_code + "</button></td>";
                html += "<td>" + OrderLib.getPaymode(j.OrderData.Paymode) + "</td>";
                html += "<td>" + OrderLib.get_ord_status(j.OrderData.Status) + "</td>";
                html += "<td>" + d.Name + "</td>";
                html += "<td>" + d.Email + "</td>";
                html += "<td>" + d.Phone + "</td>";
                html += "<td>" + d.Unitname + "</td>";
                html += "<td>" + d.Postion + "</td>";
                html += "<td>" + d.checkin + "</td>";
                html += "</tr>" + "\r\n";
                if (d.checkin == "Y")
                {
                    i++;
                }

                //string QrCode = j.Ord_code + "-" + d.JoinId.ToString() + "-" + d.LessonId;
                //string url = "http://www.culturelaunch.net/lib/checkjoin.aspx?code=" + QrCode;


                //QR_Encode qr = new QR_Encode
                //{
                //    BackColor = Color.White,
                //    ForeColor = Color.Black
                //};
                //qr.EncodeData(1, 0, true, -1, 5, url, HttpContext.Current.Server.MapPath("/upload/" + QrCode + ".gif"), false, 255, 255);
            }
        }
        //html += "<Tr><td></td><td>總報名人數</td><td>" + total + "</td>";
        //html += "<td>已報到人數</td><td>" + i + "</td>";
        //html += "<td><a href=\"javascript:window.print();\">列印</a></td><td></td><td></td><td></td></tr>";
        ////html += "</table>";

        JoinData = null;
    }