Esempio n. 1
0
        public void xemTour(String id)
        {
            System.Diagnostics.Debug.WriteLine("3");
            matour.Value = id;
            using (SqlConnection cnn = new SqlConnection(cnnString))
            {
                cnn.Open();
                SqlCommand cmd = new SqlCommand("sp_xemTourId", cnn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@idTour", id);
                SqlDataReader rd = cmd.ExecuteReader();
                if (rd.HasRows)
                {
                    while (rd.Read())
                    {
                        idt_.InnerHtml   = "<input type='hidden' id='matour_' value='" + rd["imatour"].ToString() + "'>";
                        txtMaTour.Value  = rd["imatour"].ToString();
                        txtTieuDe.Text   = rd["sTieuDe"].ToString();
                        txtMoTaTour.Text = rd["sMoTa"].ToString();
                        //String date = String.Format("{0:yyyy-MM-dd}", rd["dNgayKhoiHanh"]);
                        // txtNgayKhoiHanh1.Text = date;
                        txtSoNgayDi.Text          = rd["sTongThoiGian"].ToString();
                        txtSoCho.Text             = rd["iSoCho"].ToString();
                        txtGiaNLgiam.Text         = rd["igianlgiam"].ToString();
                        txtGIaNL.Text             = rd["igianl"].ToString();
                        txtGiaTE.Text             = rd["igiate"].ToString();
                        txtGiaTEgiam.Text         = rd["igiategiam"].ToString();
                        txtNoiKhoiHanh.Text       = rd["snoikhoihanh"].ToString();
                        ddlNhomtour.SelectedValue = rd["iMaNhomTour"].ToString();
                        txtHanGiamNL.Text         = DateTime.Parse(rd["hanGiamNL"].ToString()).ToString("yyyy-MM-dd");
                        txtHanGiamTE.Text         = DateTime.Parse(rd["hanGiamTE"].ToString()).ToString("yyyy-MM-dd");

                        // anhtour.Value = rd["sUrlAnh"].ToString();

                        /*string[] tokens = rd["sUrlAnh"].ToString().Split('/');
                         * // Label2.Text = "< button type = 'button' class='btn btn-primary'>Primary</button>";//;;tokens[0] + tokens.Length.ToString();
                         * // Label2.Text = tokens[0];
                         * //soAnh.Value = tokens.Length.ToString();
                         *
                         * DataTable dt = new DataTable();
                         * dt.Clear();
                         * dt.Columns.Add("url");
                         * dt.Columns.Add("id");
                         *
                         * for (int i = 0; i < tokens.Length; i++)
                         * {
                         *  DataRow row = dt.NewRow();
                         *  row["url"] = tokens[i];
                         *  row["id"] = i;
                         *  dt.Rows.Add(row);
                         * }
                         * //Repeater Rpt1 = Page.FindControl("rptDSanh") as Repeater;*/
                        DataTable dataHinHAnh = tourController.layHinhAnh(id);

                        rptDSanh.DataSource = dataHinHAnh;
                        rptDSanh.DataBind();
                    }
                }
            }
        }
Esempio n. 2
0
        public void xemTour(String id)
        {
            //System.Diagnostics.Debug.WriteLine("3");
            maTour_.Value          = id;
            matourhidden.InnerHtml = "<input type='hidden' id='txtMaTour_' value = '" + id + "'>";
            SqlDataReader rd = tourController.xemTour(id);

            if (rd.HasRows)
            {
                while (rd.Read())
                {
                    txtDanhGia.InnerHtml = "" + rd["soSao"] + "<i class='fa fa-star' style='font - size: 18px; color: #ffca08;'></i>";
                    txtNKH.InnerHtml     = rd["sNoiKhoiHanh"] + "";
                    txtTG.InnerHtml      = rd["stongthoigian"] + "";
                    //   txtTE.InnerHtml = "<strike style='color: red; display: inline;'>"+Convert.ToInt32(rd["igiate"].ToString()).ToString("#,##0") + "</strike>&nbsp&nbsp&nbsp<b style='color: green; display: inline;'>" + Convert.ToInt32(rd["igiategiam"].ToString()).ToString("#,##0") + "</b>VND";

                    // Debug.WriteLine("ss " + (DateTime.Parse(rd["hangiamte"].ToString()) > DateTime.Now) );

                    if (DateTime.Parse(rd["hangiamte"].ToString()) > DateTime.Now)          //Convert.ToInt32(rd["igiategiam"].ToString()) == 0 &&
                    {
                        txtTE.InnerHtml = "<strike style='color: red; display: inline;'>" + Convert.ToInt32(rd["igiate"].ToString()).ToString("#,##0") + "</strike>&nbsp&nbsp&nbsp<b style='color: green; display: inline;'>" + Convert.ToInt32(rd["igiategiam"].ToString()).ToString("#,##0") + "</b>VND";
                    }
                    else
                    {
                        txtTE.InnerHtml = "<p style='color: green;display: inline;'>" + Convert.ToInt32(rd["igiate"].ToString()).ToString("#,##0") + "</p>&nbsp&nbsp&nbsp<b style='color: green; display: inline;'>" + "</b>VND";
                    }

                    if (DateTime.Parse(rd["hangiamnl"].ToString()) > DateTime.Now)         //Convert.ToInt32(rd["igiategiam"].ToString()) == 0 &&
                    {
                        txtNL.InnerHtml = "<strike style='color: red;display: inline;'>" + Convert.ToInt32(rd["igianl"].ToString()).ToString("#,##0") + "</strike>&nbsp&nbsp&nbsp<b style='color: green; display: inline;'>" + Convert.ToInt32(rd["igianlgiam"].ToString()).ToString("#,##0") + "</b>VND";
                    }
                    else
                    {
                        txtNL.InnerHtml = "<p style='color: green;display: inline;'>" + Convert.ToInt32(rd["igianl"].ToString()).ToString("#,##0") + "</p>&nbsp&nbsp&nbsp<b style='color: green; display: inline;'>" + "</b>VND";
                    }

                    DataTable dataTable = tourController.layHinhAnh(id);
                    anhDD.InnerHtml = "<img src='../../Upload/" + dataTable.Rows[0]["sDuongDan"] + "' alt=' 'class='alignleft img-responsive'>";

                    dataTable.Rows[0].Delete();
                    rpt1.DataSource = dataTable;
                    rpt1.DataBind();
                    rpt2.DataSource = dataTable;
                    rpt2.DataBind();

                    txtNoiDung.Text = rd["sMoTa"].ToString();
                    // System.Diagnostics.Debug.WriteLine(rd["sMoTa"].ToString());
                    txtTieuDe.Text = rd["sTieuDe"].ToString();
                    int giaTE     = Convert.ToInt32(rd["igiate"]);//.ToString();
                    int giaTEgiam = Convert.ToInt32(rd["igiategiam"]);
                    int giaNL     = Convert.ToInt32(rd["igianl"]);
                    int giaNLgiam = Convert.ToInt32(rd["igianlgiam"]);


                    string htmlGia = "<input type='hidden' id='giaNL' value ='";
                    if (giaNLgiam == 0 || (DateTime.Parse(rd["hangiamnl"].ToString()) < DateTime.Now))
                    {
                        htmlGia += giaNL;
                    }
                    else
                    {
                        htmlGia += giaNLgiam;
                    }

                    if (giaTEgiam == 0 || (DateTime.Parse(rd["hangiamte"].ToString()) < DateTime.Now))
                    {
                        htmlGia += "' /><input type='hidden' id ='giaTE' value = '" + giaTE;
                    }
                    else
                    {
                        htmlGia += "' /><input type='hidden' id ='giaTE' value = '" + giaTEgiam;
                    }
                    gia.InnerHtml          = htmlGia + "' /> ";
                    hiddenIdTour.InnerHtml = "<input type='hidden' id='idTour' name='idTour' value='" + rd["iMaTour"].ToString() + "' />";
                }
            }
        }