Exemplo n.º 1
0
    public static void RegenerateTR_ListPic()
    {
        SqlConnection con = new SqlConnection();
        con.ConnectionString = ConfigurationManager.ConnectionStrings["deepcavi_hdb1"].ConnectionString;
        SqlCommand cmdRegenerate = new SqlCommand("dbo.RegenerateListPic", con);
        con.Open();
        cmdRegenerate.CommandType = CommandType.StoredProcedure;
        cmdRegenerate.ExecuteNonQuery();
        con.Close();
        string[] tracks = new string[System.IO.Directory.GetDirectories(HttpContext.Current.Server.MapPath("~/Images/")).Length];
        for (int i = 0; i < tracks.Length; i++)
            tracks[i] = "";
        tracks = System.IO.Directory.GetDirectories(HttpContext.Current.Server.MapPath("~/Images/"));
        TR_ListPicTableAdapter adapt = new TR_ListPicTableAdapter();
        Main.TR_ListPicDataTable table = new Main.TR_ListPicDataTable();

            for (int i = 0; i < tracks.Length; i++)
            {
                string[] strSplit = tracks[i].Split('\\');
                tracks[i] = strSplit[strSplit.Length-1];
            }
            foreach (string t in tracks)
            {
                adapt.InsertQueryByTrackName(t);
                string[] pics = new string[10];
                for (int i = 0; i < pics.Length; i++)
                    pics[i] = "";
                pics = System.IO.Directory.GetFiles(HttpContext.Current.Server.MapPath("~/Images/" + t + "/Thumb/"));
                Array.Resize(ref pics, 10);
                for (int i = 0; i < pics.Length; i++)
                {
                    if (pics[i] == null)
                        pics[i] = "";
                }

                string[] strSplit = new string[10];
                for (int i = 0; i < 10; i++)
                    strSplit[i] = "";
                for (int i = 0; i < pics.Length; i++)
                {
                    strSplit = pics[i].Split('\\');
                    pics[i] = strSplit[strSplit.Length-1];
                }
                for (int i = pics.Length; i < 10; i++)
                    pics[i]="";
                adapt.UpdatePic1(pics[0], t);
                adapt.UpdatePic2(pics[1], t);
                adapt.UpdatePic3(pics[2], t);
                adapt.UpdatePic4(pics[3], t);
                adapt.UpdatePic5(pics[4], t);
                adapt.UpdatePic6(pics[5], t);
                adapt.UpdatePic7(pics[6], t);
                adapt.UpdatePic8(pics[7], t);
                adapt.UpdatePic9(pics[8], t);
                adapt.UpdatePic10(pics[9], t);
            }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //***
        //string s = Request.Url.AbsolutePath;
        //***

        TR_ListPicTableAdapter adapt = new TR_ListPicTableAdapter();
        Main.TR_ListPicDataTable table = new Main.TR_ListPicDataTable();
        table = adapt.GetData();
        try
        {
            string trackName = table.Rows[3].ItemArray[0].ToString();
            Response.Redirect("~/VideoPages/" + trackName + ".aspx" + "?TrackName=" + trackName);
        }
        catch (Exception)
        {
            //Response.Redirect("~/Default.aspx");
        }
    }