예제 #1
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void lnk_setup_Click(object sender, EventArgs e)
    {
        st = "insert into tbl_hoteldetails(hotel_name,sub_title,admin_emailid,password,hotel_address) output inserted.hotel_id values('" + txt_hotelname.Text + "','" + txt_subtittle.Text + "','" + txt_emailid.Text + "','" + txt_pwd.Text + "','" + txt_address.Text + "')";
        int x = db.return_affectedID(st);

        if (x > 0)
        {
            st = "insert into tbl_admin(emailid,admin_password,is_superadmin,is_active,created_by) output inserted.admin_id values('" + txt_emailid.Text + "','" + txt_pwd.Text + "',1,1,0)";
            Session["admin_id"] = db.return_affectedID(st);
            Response.Redirect("default.aspx");
        }
    }
    /// <summary>
    /// Save the selected song to the database, songs will be saved in songs folder in project with random name
    /// </summary>
    protected void lnk_save_Click(object sender, EventArgs e)
    {
        if (fu_songs.HasFile)
        {
            string ext = Path.GetExtension(fu_songs.PostedFile.FileName).ToLower();
            if (ext == ".mp3")
            {
                string filepath = "";

                filepath = Guid.NewGuid().ToString() + ext;
                fu_songs.SaveAs(Server.MapPath("~/songs/") + filepath);
                st = "insert into tbl_songs (song_name,song_url) output inserted.song_id values('" + txt_name.Text + "','" + filepath + "')";
                int song_id = db.return_affectedID(st);
                if (song_id > 0)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('success','Song added successfully.');", true);
                    fill_data();
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Only MP3 files allowed.');", true);
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Please select file to upload.');", true);
        }
    }