Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie userCookie;

        userCookie = Request.Cookies["Preferences"];

        if (userCookie != null || Session["login"] != null)
        {
            Button4.Text = "logout";
            if (userCookie == null && Session["login"] != null)
            {
                Label1.Text = Session["login"].ToString();
            }
            else
            {
                Label1.Text = userCookie["username"];
            }
        }
        else
        {
            Button4.Text   = "login";
            Label1.Visible = false;
        }
        DataSet DS = new DataSet();
        string  strPhysicalPath = Server.MapPath("countries.xml");

        DS.ReadXml(strPhysicalPath);
        DropDownCountry.DataTextField = "countryName";
        DropDownCountry.DataSource    = DS;
        DropDownCountry.DataBind();
    }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         test = new konrad.CourierService();
         string[] st = test.getCountries();
         DropDownCountry.DataSource = st;
         DropDownCountry.DataBind();
         changeDistricts();
     }
 }
Ejemplo n.º 3
0
 public void Country()
 {
     cn.Open();
     using (SqlCommand cmd = new SqlCommand("select CountryName,CountryId from Country", cn))
     {
         using (SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection))
         {
             DropDownCountry.DataSource = dr;
             DropDownCountry.Items.Clear();
             DropDownCountry.Items.Add("Please Select Country");
             DropDownCountry.DataTextField  = "CountryName";
             DropDownCountry.DataValueField = "CountryId";
             DropDownCountry.DataBind();
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        con = new SqlConnection(ConfigurationManager.AppSettings["con"]);
        if (Page.IsPostBack == false)
        {
            da = new SqlDataAdapter("select * from Hotel_Details order by H_Id desc", con);
            dt = new DataTable();
            da.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                GridViewHotelDetails.DataSource = dt;
                GridViewHotelDetails.DataBind();
            }
            else
            {
                GridViewHotelDetails.DataSource = "";
                GridViewHotelDetails.DataBind();
            }
        }
        if (Page.IsPostBack == false)
        {
            da = new SqlDataAdapter("select distinct CountryName from CountryCityMaster order by CountryName", con);
            dt = new DataTable();
            da.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                DropDownCountry.DataSource    = dt;
                DropDownCountry.DataTextField = "CountryName";
                DropDownCountry.DataBind();

                DropDownCountry.Items.Insert(0, "Select Country");
                DropDownCountry.Items.Insert(dt.Rows.Count + 1, "Other Country");
            }
        }
        if (Page.IsPostBack == false)
        {
            da = new SqlDataAdapter("select RoomCategory from  RoomCategory", con);
            dt = new DataTable();
            da.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                DropdownCategory.DataSource    = dt;
                DropdownCategory.DataTextField = "RoomCategory";
                DropdownCategory.DataBind();

                DropdownCategory.Items.Insert(0, "Select Room");
                DropdownCategory.Items.Insert(dt.Rows.Count + 1, "Other Room");
            }
        }
        if (Request.QueryString["P"] == "AMP")
        {
            hiderow6.Visible             = false;
            hiderow1.Visible             = true;
            hiderow2.Visible             = true;
            hiderow3.Visible             = true;
            hiderow4.Visible             = true;
            SubmitButton.Visible         = true;
            Button1.Visible              = false;
            titleLabel.Text              = "Insert Hotel Detail";
            GridViewHotelDetails.Visible = true;
        }
        else if (Request.QueryString["P"] == "UMP")
        {
            hiderow6.Visible             = true;
            hiderow1.Visible             = false;
            hiderow2.Visible             = false;
            hiderow3.Visible             = false;
            hiderow4.Visible             = false;
            SubmitButton.Visible         = false;
            Button1.Visible              = true;
            titleLabel.Text              = "Search Hotel";
            GridViewHotelDetails.Visible = false;
        }
        else
        {
            hiderow6.Visible             = true;
            hiderow1.Visible             = false;
            hiderow2.Visible             = false;
            hiderow3.Visible             = false;
            hiderow4.Visible             = false;
            SubmitButton.Visible         = false;
            Button1.Visible              = true;
            titleLabel.Text              = "Search Hotel";
            GridViewHotelDetails.Visible = false;
        }
    }