Esempio n. 1
0
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            if (Membership.GetUser() != null)
            {
                try
                {
                    AssignmentModelClass a = new AssignmentModelClass();
                    a.AddNewMediaFile(tbTItle.Text, tbDescription.Text, ref FileUpload1);

                        lblResult.ForeColor = System.Drawing.Color.Green;
                        lblResult.Text = "The file has been added to the object store";
                        tbDescription.Text = "";
                        tbTItle.Text = "";
                        //Response.Redirect("http://warp.senecac.on.ca/bti420_121a29/Media/Default.aspx");

                }
                catch (Exception ex)
                {
                    lblResult.ForeColor = System.Drawing.Color.Red;
                    lblResult.Text = "Error! " + ex.Message;

                }
            }

        }
        else
        {
            lblResult.Text = "Error! Please Uplaod a file";
            lblResult.ForeColor = System.Drawing.Color.Red;

        }
    }