Exemplo n.º 1
0
    protected void BA_Click(object sender, EventArgs e)
    {
        DateTime?schedule = null;
        string   dat      = Request.Form[TxtBoxSchdule.UniqueID];

        if (dat == "")
        {
            schedule = null;
        }
        else if (dat != "")
        {
            schedule = DateTime.ParseExact(Request.Form[TxtBoxSchdule.UniqueID],
                                           "M/d/yyyy",
                                           System.Globalization.CultureInfo.InvariantCulture);
        }

        change_id = Convert.ToInt16(Session["id"]);
        input1.BAChange(Convert.ToInt16(Session["User_ID"]), Convert.ToInt16(Session["id"]), "BA_Qualified", Convert.ToInt16(DropDownList1.SelectedValue), schedule);
        //  change_id = Convert.ToInt16(Session["id"]);

        if (FileUpload1.HasFile)
        {
            HttpFileCollection hfc = Request.Files;


            string time1         = DateTime.Now.ToString();
            string directoryPath = Server.MapPath(string.Format("~/File_Uploads/" + change_id + "/"));
            if (!System.IO.Directory.Exists(directoryPath))
            {
                System.IO.Directory.CreateDirectory(@directoryPath);
            }
            else
            {
            }

            for (int i = 0; i < hfc.Count; i++)
            {
                HttpPostedFile hpf = hfc[i];
                if (hpf.ContentLength > 0)
                {
                    string file_name = hpf.FileName;
                    hpf.SaveAs(directoryPath + "\\" + file_name);


                    string full_path = directoryPath + file_name;


                    input1.InsertFile(full_path, change_id, file_name);
                }
            }
        }



        Response.Redirect("~/BA_Pending_BA_1.aspx");
    }