protected void UploadButton_Click(object sender, EventArgs e)
    {
        String savePath = @"~/files/";

        try
        {
            foreach (RepeaterItem item in rptVrijstellingen.Items)
            {
                FileUpload file = (FileUpload)item.FindControl("FileUpload1");

                if (file.HasFile)
                {
                    TextBox      EVK         = (TextBox)item.FindControl("EVK");
                    TextBox      SP          = (TextBox)item.FindControl("SP");
                    DropDownList dropRapport = (DropDownList)item.FindControl("dropRapport");
                    HiddenField  hiddenid    = (HiddenField)item.FindControl("hiddenid");

                    String fileName = file.FileName;
                    savePath += fileName;
                    file.SaveAs(Server.MapPath(savePath + fileName));

                    ExternVak ev = new ExternVak();
                    ev.externvakNaam       = EVK.Text;
                    ev.externvakStudiepunt = SP.Text;
                    studenten.insertExternvak(ev);
                    insertid = ev.pk_externvakID;

                    Bijlage bij = new Bijlage();
                    System.Threading.Thread.Sleep(3000);

                    bij.fk_externvakID = insertid;
                    bij.pk_bijlageID   = Convert.ToInt16(dropRapport.SelectedValue);
                    studenten.update(bij);

                    Bijlage s = new Bijlage();
                    s.bijlageTitel   = fileName;
                    s.bijlageURL     = savePath;
                    s.bijlageType    = "2";
                    s.fk_externvakID = insertid;
                    studenten.insertFile(s);

                    Evk ek = new Evk();
                    ek.fk_vakID       = Convert.ToInt16(hiddenid.Value);
                    ek.fk_externvakID = insertid;
                    ek.fk_studentID   = studentid;
                    studenten.updateEVK(ek);
                }
                else
                {
                    throw new Exception("Gelieve bij alle vakken een file toe te voegen of gegeven aan mevrouw Van Orlé aan te vinken en een afspraak te maken.");
                }
            }
            Response.Redirect("s_upload_bijlagen.aspx");
        }

        catch (Exception ex)
        {
            UploadStatusLabel.Text = ex.Message;
        }
    }
Ejemplo n.º 2
0
    protected void UploadButton_Click(object sender, EventArgs e)
    {
        String savePath = @"~/files/";

        try
        {
            foreach (RepeaterItem item in rptVrijstellingen.Items)
            {
                FileUpload  file = (FileUpload)item.FindControl("FileUpload1");
                HiddenField uid  = (HiddenField)item.FindControl("hiddenid");
                CheckBox    ch   = (CheckBox)item.FindControl("CBupload");
                if (ch.Checked)
                {
                    Response.Write("checked");
                }
                else
                {
                    if (file.HasFile)
                    {
                        String fileName = file.FileName;
                        savePath += fileName;
                        file.SaveAs(Server.MapPath(savePath + fileName));
                        Bijlage s = new Bijlage();
                        s.bijlageTitel   = fileName;
                        s.bijlageURL     = savePath;
                        s.bijlageType    = "1";
                        s.fk_externvakID = Convert.ToInt16(uid.Value);
                        BLLstudent.insertFile(s);
                    }
                    else
                    {
                        throw new Exception("Gelieve bij alle vakken een file toe te voegen of gegeven aan mevrouw Van Orlé aan te vinken en een afspraak te maken.");
                    }
                }
            }

            Response.Redirect("s_student_Ovrijstellingen.aspx");
        }

        catch (Exception ex)
        {
            UploadStatusLabel.Text = ex.Message;
        }
    }
Ejemplo n.º 3
0
    protected void btnNext_goedkeuring_Click(object sender, EventArgs e)
    {
        String savePath = @"~/files/";

        try
        {
            BLLbijlage BLLbijlage = new BLLbijlage();
            BLLstudent studenten  = new BLLstudent();

            foreach (RepeaterItem item in _rptStudieverloop.Items)
            {
                FileUpload   _FileUpload   = (FileUpload)item.FindControl("_FileUpload");
                DropDownList _dropJaar     = (DropDownList)item.FindControl("_dropJaar");
                TextBox      _txtSchool    = (TextBox)item.FindControl("_txtSchool");
                TextBox      _txtOpleiding = (TextBox)item.FindControl("_txtOpleiding");


                String fileName = _FileUpload.FileName;
                savePath += fileName;
                _FileUpload.SaveAs(Server.MapPath(savePath + fileName));

                Bijlage b = new Bijlage();
                b.bijlageTitel           = fileName;
                b.bijlageSchoolJaar      = _dropJaar.SelectedValue;
                b.bijlageSchoolGegevens  = _txtSchool.Text;
                b.bijlageSchoolOpleiding = _txtOpleiding.Text;
                b.bijlageURL             = savePath;
                b.bijlageType            = "rapport";
                b.fk_studentID           = studentid;
                studenten.insertFile(b);
            }
        }
        catch (Exception ex)
        {
            _lblFeedback.Text = ex.Message;
        }
    }
Ejemplo n.º 4
0
    protected void btnNext_goedkeuring_Click(object sender, EventArgs e)
    {
        String savePath = @"~/files/";

        try
        {
            BLLbijlage BLLbijlage = new BLLbijlage();
            BLLstudent studenten = new BLLstudent();

            foreach (RepeaterItem item in _rptStudieverloop.Items)
            {
                FileUpload _FileUpload = (FileUpload)item.FindControl("_FileUpload");
                DropDownList _dropJaar = (DropDownList)item.FindControl("_dropJaar");
                TextBox _txtSchool = (TextBox)item.FindControl("_txtSchool");
                TextBox _txtOpleiding = (TextBox)item.FindControl("_txtOpleiding");

                    String fileName = _FileUpload.FileName;
                    savePath += fileName;
                    _FileUpload.SaveAs(Server.MapPath(savePath + fileName));

                    Bijlage b = new Bijlage();
                    b.bijlageTitel = fileName;
                    b.bijlageSchoolJaar = _dropJaar.SelectedValue;
                    b.bijlageSchoolGegevens = _txtSchool.Text;
                    b.bijlageSchoolOpleiding = _txtOpleiding.Text;
                    b.bijlageURL = savePath;
                    b.bijlageType = "rapport";
                    b.fk_studentID = studentid;
                    studenten.insertFile(b);
            }
        }
        catch (Exception ex)
        {
            _lblFeedback.Text = ex.Message;
        }
    }