Beispiel #1
0
    public void getdatarepeater()
    {
        DataTable dt = new DataTable();

        dt.Columns.Add("Quantity");
        dt.Columns.Add("Product");
        //dt.Columns.Add("ProductDetail");
        dt.Columns.Add("Price");
        //dt.Columns.Add("Checkin");
        //dt.Columns.Add("Checkout");
        //dt.Columns.Add("Quantity");
        dt.Columns.Add("Total");
        dt.Columns.Add("ProductOrderID");
        decimal total = 0;
        long    ID    = long.Parse(Request.QueryString["Id"]);

        CommonClassLibrary.CommonDataSet.ProductOrderDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.ProductOrderTableAdapter().GetDataByTicketOrder(ID);
        foreach (CommonClassLibrary.CommonDataSet.ProductOrderRow item in collection)
        {
            CommonClassLibrary.CommonDataSet.ProductDetailDataTable collection2 = new CommonClassLibrary.CommonDataSetTableAdapters.ProductDetailTableAdapter().GetDataByProductShowName(item.Product);
            foreach (CommonClassLibrary.CommonDataSet.ProductDetailRow item2 in collection2)
            {
                total += item.Total;
                dt.Rows.Add(item2.KeyValue, item.Price.ToString("#,###") + ".-", item.Quantity, item.Total.ToString("#,###") + ".-", item.Id);  // item.LastUpdated.ToString("dd-MM-yyyy") + "   " + item.LastUpdated.ToString("HH:mm" + " น.")
            }
        }

        this.DetailTicketOrderRepeater.DataSource = dt;
        this.DetailTicketOrderRepeater.DataBind();
        this.Total_Label.Text = total.ToString("#,###") + ".-";
    }
Beispiel #2
0
    public void GetDataPrint()
    {
        DataTable dt = new DataTable();

        dt.Columns.Add("Product");
        //dt.Columns.Add("ProductDetail");
        dt.Columns.Add("Price");
        dt.Columns.Add("Checkin");
        dt.Columns.Add("Checkout");
        dt.Columns.Add("Quantity");
        dt.Columns.Add("Total");
        dt.Columns.Add("ProductOrderID");
        decimal total = 0;
        long    ID    = long.Parse(Request.QueryString["Id"]);

        CommonClassLibrary.CommonDataSet.ProductOrderDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.ProductOrderTableAdapter().GetDataByTicket2(ID);
        foreach (CommonClassLibrary.CommonDataSet.ProductOrderRow item in collection)
        {
            CommonClassLibrary.CommonDataSet.ProductDetailDataTable collection2 = new CommonClassLibrary.CommonDataSetTableAdapters.ProductDetailTableAdapter().GetDataByProductShowName(item.Product);
            foreach (CommonClassLibrary.CommonDataSet.ProductDetailRow item2 in collection2)
            {
                string name = "";
                CommonClassLibrary.CommonDataSet.TextContentDataTable dt1 = new CommonClassLibrary.CommonDataSetTableAdapters.TextContentTableAdapter().GetDataById(long.Parse(item2.KeyValue));
                name   = dt1.Rows[0]["Thai"].ToString();
                total += item.Total;
                dt.Rows.Add(name, item.Price.ToString("#,###") + ".-", item.CreatedDate.ToString("dd-MM-yyyy") + "   " + item.CreatedDate.ToString("HH:mm" + " น."), item.LastUpdated.ToString("dd-MM-yyyy") + "   " + item.LastUpdated.ToString("HH:mm" + " น."), item.Quantity, item.Total.ToString("#,###") + ".-", item.Id);
            }
        }
        Repeater1.DataSource = dt;
        Repeater1.DataBind();
        Label3.Text    = total.ToString("#,###") + ".-";
        DateLabel.Text = DateTime.Now.ToString();
        IDT.Text       = ID.ToString();
    }
Beispiel #3
0
    protected void Confirmorder_Button_Click(object sender, EventArgs e)
    {
        long      ID = long.Parse(Request.QueryString["Id"]);
        DataTable dt = new DataTable();

        dt.Columns.Add("Product");
        //dt.Columns.Add("ProductDetail");
        dt.Columns.Add("Price");
        dt.Columns.Add("Quantity");
        dt.Columns.Add("Total");
        dt.Columns.Add("ProductOrderID");
        decimal total = 0;

        CommonClassLibrary.CommonDataSet.ProductOrderDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.ProductOrderTableAdapter().GetDataByTicketOrder(ID);
        foreach (CommonClassLibrary.CommonDataSet.ProductOrderRow item in collection)
        {
            CommonClassLibrary.CommonDataSet.ProductDetailDataTable collection2 = new CommonClassLibrary.CommonDataSetTableAdapters.ProductDetailTableAdapter().GetDataByProductShowName(item.Product);
            foreach (CommonClassLibrary.CommonDataSet.ProductDetailRow item2 in collection2)
            {
                total += item.Price * item.Quantity;
                dt.Rows.Add(item2.KeyValue, item.Price.ToString("#,###.00"), item.Quantity.ToString("#,###.00"), (item.Price * item.Quantity).ToString("#,###") + ".-", item.Id);
            }
        }
        //Session["aaa"] = dt;
        //Session["bb"] = total.ToString("#,###") + ".-";
        if (new CommonClassLibrary.CommonDataSetTableAdapters.TicketOrderTableAdapter().UpdateQuery(DateTime.Now, DateTime.Now, 3, ID) == 1)
        {
            if (new CommonClassLibrary.CommonDataSetTableAdapters.ProductOrderTableAdapter().UpdateQueryStatus2(ID) != 0)
            {
                this.SuccessPanel.Visible = true;
                this.SuccessLabel.Text    = "บันทึกข้อมูลสำเร็จ";
                this.ErrorPanel.Visible   = false;
                showbutton();
                //Bill();
            }
            else
            {
                this.SuccessPanel.Visible = false;
                this.ErrorPanel.Visible   = true;
                this.ErrorLabel.Text      = "บันทึกข้อมูลไม่สำเร็จ";
            }
            getdatarepeater1();


            this.DetailTicketOrderRepeater.DataSource = dt;
            this.DetailTicketOrderRepeater.DataBind();
            this.Total_Label.Text = total.ToString("#,###") + ".-";

            // print
            Repeater1.DataSource = dt;
            Repeater1.DataBind();
            Label3.Text    = total.ToString("#,###") + ".-";
            DateLabel.Text = DateTime.Now.ToString();
            IDT.Text       = ID.ToString();
            //ConfirmOrderPrintPanel.Visible = true;
            // Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "PrintConfirmDiv()", true);
            //Button1_Click(sender, e);
        }
    }
Beispiel #4
0
    protected void Payment_Button_Click(object sender, EventArgs e)
    {
        long      ID = long.Parse(Request.QueryString["Id"]);
        DataTable dt = new DataTable();

        dt.Columns.Add("Product");
        //dt.Columns.Add("ProductDetail");
        dt.Columns.Add("Price");
        dt.Columns.Add("Quantity");
        dt.Columns.Add("Total");
        dt.Columns.Add("ProductOrderID");
        decimal total = 0;

        CommonClassLibrary.CommonDataSet.ProductOrderDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.ProductOrderTableAdapter().GetDataByTicketOrder(ID);
        foreach (CommonClassLibrary.CommonDataSet.ProductOrderRow item in collection)
        {
            CommonClassLibrary.CommonDataSet.ProductDetailDataTable collection2 = new CommonClassLibrary.CommonDataSetTableAdapters.ProductDetailTableAdapter().GetDataByProductShowName(item.Product);
            foreach (CommonClassLibrary.CommonDataSet.ProductDetailRow item2 in collection2)
            {
                total += item.Price * item.Quantity;
                dt.Rows.Add(item2.KeyValue, item.Price.ToString("#,###.00"), item.Quantity.ToString("#,###.00"), (item.Price * item.Quantity).ToString("#,###") + ".-", item.Id);
            }
        }

        // Session["aaa"] = dt;
        // Session["bb"] = total.ToString("#,###") + ".-";

        HttpCookie cookie = Request.Cookies[Resources.Resource.CookieName];

        if (new CommonClassLibrary.CommonDataSetTableAdapters.PaymentTableAdapter().InsertQuery(ID, "-", DateTime.Now, DateTime.Now, 0, int.Parse(cookie.Values["Id"])) == 1)
        {
            this.SuccessPanel.Visible = true;
            this.SuccessLabel.Text    = "ชำระเงินสำเร็จ";
            this.ErrorPanel.Visible   = false;

            //ConfirmOrderPrintPanel.Visible = true;
            Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "PrintConfirmDiv()", true);

            showbutton();
        }
        else
        {
            this.SuccessPanel.Visible = false;
            this.ErrorPanel.Visible   = true;
            this.ErrorLabel.Text      = "ชำระเงินไม่สำเร็จ";
        }
    }