public void fillmainpac(DropDownList name)
    {
        //dbCOnnect db = new dbCOnnect();
        DbConnect db = new DbConnect();
        String qry = "select name ,package_id from mainpackege";
        DataTable dt = db.selectIt(qry);

        int count = dt.Rows.Count;

        for (int i = 0; i < count; i++)
        {
            name.Items.Add(dt.Rows[i][0].ToString());
        }
    }
    public void filldays()
    {
        //dbCOnnect db = new dbCOnnect();
         DbConnect db = new DbConnect();

         String qry=" select d.day_no from days_ d , subPackege s , mainPackege p  where s.packge_ID=p.package_id and d.subPcgId=s.subPack_ID and s.subPacge_Name='"+ddsub_day.Text+"' and p.name='"+ddmain_day.Text+"' ";
         DataTable dt = db.selectIt(qry);

         int c = dt.Rows.Count;

         for (int i = 0; i < c; i++)
         {
         ddday_no.Items.Add(dt.Rows[i][0].ToString());
         }
    }
    public void fillsubpack(DropDownList subname,DropDownList main)
    {
        //dbCOnnect db = new dbCOnnect();
            DbConnect db = new DbConnect();

            String qry = "select s.subPacge_name,subPack_ID from subPackege s , mainPackege p where s.packge_ID=p.package_id and p.name='"+main.Text+"'";
            DataTable dt = db.selectIt(qry);

            subname.DataValueField = "subPack_ID";
            int c = dt.Rows.Count;

            for (int i = 0; i < c; i++)
            {
                subname.Items.Add(dt.Rows[i][0].ToString());
            }
    }
    protected void btn_edit_days_Click(object sender, EventArgs e)
    {
        //dbCOnnect db = new dbCOnnect();
         DbConnect db = new DbConnect();

         string qry1 = "select Package_id from mainPackege where name='" + ddmain_day.Text + "'";
         DataTable dt = db.selectIt(qry1);
         string package_id = dt.Rows[0][0].ToString();

         string qry2 = "select subPack_ID from subPackege where subPacge_name='" + ddsub_day.Text + "'";
         DataTable dt2 = db.selectIt(qry2);
         string subpackage_id = dt2.Rows[0][0].ToString();

         if (CheckBox2.Checked)
         {
         FileUpload2.Visible = true;

         FileUpload2.SaveAs(Server.MapPath("tour_main/" + FileUpload2.PostedFile.FileName));
         String url = "tour_main/" + FileUpload2.PostedFile.FileName;

         String qry = "update days_  set days_image='" + url + "',accomodation='" + txtday_accomodation.Text + "',description='" + txtdescription_days.Text + "' where day_no='" + ddday_no.Text + "' and subPcgId='" + subpackage_id + "' and packge_ID='" + package_id + "'";
         bool conf = db.insertIt(qry);

         if (conf == true)
         {
             lblday_edit.Text = "Successfully edited";
             filldaysTours();
         }
         else
         {
             lblday_edit.Text = "Cannot be edited";
         }
         }
         else
         {
         String qry = "update days_  set accomodation='" + txtday_accomodation.Text + "',description='" + txtdescription_days.Text + "' where day_no='" + ddday_no.Text + "' and subPcgId='" + subpackage_id + "' and packge_ID='" + package_id + "'";
         bool conf = db.insertIt(qry);

         if (conf == true)
         {
             lblday_edit.Text = "Successfully edited";
             filldaysTours();
         }
         else
         {
             lblday_edit.Text = "Cannot be edited";
         }

         }
    }
    protected void btn_edit_sub_Click(object sender, EventArgs e)
    {
        //dbCOnnect db = new dbCOnnect();

         DbConnect db = new DbConnect();

         String qry1 = "select Package_id from mainPackege where name='" + ddmain_sub.Text + "'";
         DataTable dt = db.selectIt(qry1);
         string package_id=dt.Rows[0][0].ToString();

         String qry2 = "update subPackege  set noofdays='" + txtnoofdays.Text + "',price='" + txtprice.Text + "' where  subPacge_Name='" + ddsubtour.Text + "' and packge_ID='"+package_id+ "'";

         bool conf = db.insertIt(qry2);

         if (conf == true)
         {
         lblsub_edit.Text = "Successfully edited";
         }
         else
         {
         lblsub_edit.Text = "Cannot be edited";
         }
    }