public void LoadDropDown() { DataTable dt = new DataTable(); dt = DataAccess.GetInstance().TPA_Get_Approved_TPA_Info(); if (dt.Rows.Count > 0) { DropDownTPA.DataSource = dt; DropDownTPA.DataTextField = "TPA_Name"; DropDownTPA.DataValueField = "TPA_Id"; DropDownTPA.DataBind(); } ListItem item = new ListItem("--Select--", "-1"); DropDownTPA.Items.Insert(0, item); }
protected void BtnSubmit_Click(object sender, EventArgs e) { string FileName = TxtFileName.Text.Trim(); uploadF up = new uploadF(); string UploadFile = up.savefile(FileUp); int TPA = Convert.ToInt32(DropDownTPA.SelectedValue); string Key = GetKeyGenerate(9); string fileName = Path.GetFileNameWithoutExtension(UploadFile); string fileExtension = Path.GetExtension(UploadFile); //Build the File Path for the original (input) and the encrypted (output) file. string input = Server.MapPath("~/temp/") + fileName + fileExtension; string output = Server.MapPath("~/temp/") + fileName + "_enc" + fileExtension; //Save the Input File, Encrypt it and save the encrypted file in output path. FileUp.SaveAs(input); this.Encrypt(input, output, Key); string uploadFilepath = fileName + "_enc" + fileExtension; string User = Session["Email"].ToString(); if (DataAccess.GetInstance().Files_add_File(User, TPA, FileName, uploadFilepath, Key)) { Utils.ShowAlertMessage("File Uploaded Successfully"); TxtFileName.Text = ""; DropDownTPA.ClearSelection(); } else { Utils.ShowAlertMessage("Server Down Try Later"); } if (input != null || input != string.Empty) { if ((System.IO.File.Exists(input))) { System.IO.File.Delete(input); } } }