protected void AjaxUploadAttech_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) { FileInfo fi = new FileInfo(e.FileName); string ext = fi.Extension; string[] data = HttpUtility.UrlDecode(Request.Cookies["asp_act"].Value.ToString()).Split('|'); if (data[1] == "2") { string fileID = Fn.ExenID("INSERT INTO tblEmpDocs (UploadedFor,EmpID,FileTitle, FileExt) VALUES ('EmpPensionDoc'," + data[0] + ", '" + fi.Name + "', '" + ext + "');select SCOPE_IDENTITY()"); string filePath = Server.MapPath("~") + "/Uploads/EmpDocuments/" + fileID + ext; AjaxUploadAttech.SaveAs(filePath); } else { Fn.Exec(@"UPDATE tblEmployee SET PhotoExtension='" + ext + "' WHERE EmpID=" + data[0]); string filePath = Server.MapPath("~") + "/Uploads/EmployeePhoto/" + data[0] + ext; AjaxUploadAttech.SaveAs(filePath); if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(filePath, 32, 32); string SaveAsThumbnail = System.IO.Path.Combine(HttpContext.Current.Server.MapPath("~") + "/Uploads/EmployeePhoto/", Convert.ToString(data[0]) + "A" + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(filePath, 75, 75); string SaveAsThumbnail = System.IO.Path.Combine(HttpContext.Current.Server.MapPath("~") + "/Uploads/EmployeePhoto/", Convert.ToString(data[0]) + "B" + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } } }
protected void AjaxUploadAttech_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) { FileInfo fi = new FileInfo(e.FileName); string ext = fi.Extension; string[] data = HttpUtility.UrlDecode(Request.Cookies["IDforDocument"].Value.ToString()).Split('|'); string CandiDateID = "0"; string tblCandidate_tblJobRequirementID = "0"; using (DBDataContext db = new DBDataContext()) { var c = db.tblCandidates.Where(v => v.CNIC == data[3].Split('½')[0]).FirstOrDefault(); if (c != null) { CandiDateID = Convert.ToString(c.tblCandidateID); } else { CandiDateID = Fn.ExenID(@"INSERT INTO tblCandidate (CNIC, Name, dtDOB, Gender, Religion, FatherName, City, District, CurrentAddress, PermanentAddress, Phone, Mobile, Domicile,Qualification , Experience,JobDescriptions) VALUES ('" + HttpUtility.UrlDecode(data[3]).Split('½')[0] + @"','" + HttpUtility.UrlDecode(data[3]).Split('½')[1] + @"',CONVERT(DATETIME,'" + HttpUtility.UrlDecode(data[3]).Split('½')[2] + @"',103),'" + HttpUtility.UrlDecode(data[3]).Split('½')[3] + @"','" + HttpUtility.UrlDecode(data[3]).Split('½')[4] + @"','" + HttpUtility.UrlDecode(data[3]).Split('½')[5] + @"','" + HttpUtility.UrlDecode(data[3]).Split('½')[6] + @"','" + HttpUtility.UrlDecode(data[3]).Split('½')[7] + @"','" + HttpUtility.UrlDecode(data[3]).Split('½')[8] + @"','" + HttpUtility.UrlDecode(data[3]).Split('½')[9] + @"','" + HttpUtility.UrlDecode(data[3]).Split('½')[10] + @"','" + HttpUtility.UrlDecode(data[3]).Split('½')[11] + @"','" + HttpUtility.UrlDecode(data[3]).Split('½')[12] + @"','" + WebUtility.HtmlEncode(HttpUtility.UrlDecode(data[3]).Split('½')[13]) + @"','" + WebUtility.HtmlEncode(HttpUtility.UrlDecode(data[3]).Split('½')[14]) + @"','" + WebUtility.HtmlEncode(HttpUtility.UrlDecode(data[3]).Split('½')[15]) + @"'); select SCOPE_IDENTITY()"); } var cj = db.tblCandidate_tblJobRequirements.Where(v => v.tblCandidateID == Convert.ToDecimal(CandiDateID) && v.tblJobRequirementID == Convert.ToDecimal(data[0])).FirstOrDefault(); if (cj != null) { tblCandidate_tblJobRequirementID = Convert.ToString(cj.tblCandidate_tblJobRequirementID); } else { tblCandidate_tblJobRequirementID = Fn.ExenID(@"INSERT INTO tblCandidate_tblJobRequirement (tblCandidateID, tblJobRequirementID) VALUES ('" + CandiDateID + @"','" + data[0] + @"'); select SCOPE_IDENTITY()"); } } string fileID = Fn.ExenID("INSERT INTO tblDocuments (FileTitle, FileExt, tblName, tblID, EnterByEmpID) VALUES ('" + fi.Name + "','" + ext + "', 'tblCandidate_tblJobRequirement', '" + tblCandidate_tblJobRequirementID + "','" + Convert.ToString(0) + "'); select SCOPE_IDENTITY()"); string filePath = Server.MapPath("~") + "/Uploads/AllDocuments/" + fileID + ext; AjaxUploadAttech.SaveAs(filePath); if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(filePath, 32, 32); string SaveAsThumbnail = System.IO.Path.Combine(HttpContext.Current.Server.MapPath("~") + "/Uploads/AllDocuments/", fileID + "A" + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(filePath, 75, 75); string SaveAsThumbnail = System.IO.Path.Combine(HttpContext.Current.Server.MapPath("~") + "/Uploads/AllDocuments/", fileID + "B" + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } }
protected void AjaxUploadAttech_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) { FileInfo fi = new FileInfo(e.FileName); string ext = fi.Extension; string[] data = HttpUtility.UrlDecode(Request.Cookies["IDforDocument"].Value.ToString()).Split('|'); string fileID = Fn.ExenID("INSERT INTO tblDocuments (FileTitle, FileExt, tblName, tblID, EnterByEmpID) VALUES ('" + fi.Name + "','" + ext + "', 'tblJobRequirement', '" + data[0] + "','" + Convert.ToString(Convert.ToString(((HttpCookie)HttpContext.Current.Request.Cookies["Emp_Id"]).Value)) + "'); select SCOPE_IDENTITY()"); string filePath = Server.MapPath("~") + "/Uploads/AllDocuments/" + fileID + ext; AjaxUploadAttech.SaveAs(filePath); if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(filePath, 32, 32); string SaveAsThumbnail = System.IO.Path.Combine(HttpContext.Current.Server.MapPath("~") + "/Uploads/AllDocuments/", fileID + "A" + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } if (fi.Extension.ToUpper() == ".JPEG" || fi.Extension.ToUpper() == ".JPG" || fi.Extension.ToUpper() == ".BMP" || fi.Extension.ToUpper() == ".PNG" || fi.Extension.ToUpper() == ".GIF") { Bitmap Thumbnail = CreateThumbnail(filePath, 75, 75); string SaveAsThumbnail = System.IO.Path.Combine(HttpContext.Current.Server.MapPath("~") + "/Uploads/AllDocuments/", fileID + "B" + fi.Extension); Thumbnail.Save(SaveAsThumbnail); } }