public void setEmployee() { int jobID = 0; if (Request.QueryString["jobID"] != "") { jobID = Int32.Parse(Request.QueryString["jobID"].Substring(Request.QueryString["jobID"].Length - 5)); } string UserID = ""; if (FileUpload1.HasFile) { if (FileUpload1.PostedFile.ContentType == "image/jpeg" || FileUpload1.PostedFile.ContentType == "image/jpg") { fileExtension = Path.GetExtension(FileUpload1.FileName); if (FileUpload1.PostedFile.ContentLength < 100000000) { string p = Path.GetFileName(FileUpload1.FileName); //check if vendor exist in folder if (Directory.Exists(Server.MapPath("~/images/profile_picture/" + UserID + "/ ")) == false) { DirectoryInfo di = Directory.CreateDirectory(Server.MapPath("~/images/profile_picture/" + UserID + "/ ")); } UniqueDateTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"); if (fileExtension.ToLower() == ".jpg") { FileUpload1.SaveAs(Server.MapPath("~/images/profile_picture/" + UserID + "/") + (FileUpload1.FileName.Replace(".jpg", "_" + UniqueDateTime + ".jpg"))); canPhoto = Server.MapPath("~/images/profile_picture/" + UserID + "/") + (FileUpload1.FileName.Replace(".jpg", "_" + UniqueDateTime + ".jpg")); } //FileUpload1.SaveAs(Server.MapPath("~/images/profile_picture" + FileUpload1.FileName)); lblimagestatus.Text = "File Uploaded..."; //canPhoto = "~/images/profile_picture" + FileUpload1.FileName; } else { lblimagestatus.Text = "Only JPEG files with max size 1000 KB are accepted.."; } } } else { lblimagestatus.Text = "Please select a file to upload..."; } if (fileupresume.HasFile) { fileExtension = Path.GetExtension(fileupresume.FileName); if (fileExtension.ToLower() != ".doc" && fileExtension.ToLower() != ".docx" && fileExtension.ToLower() != ".pdf" && fileExtension.ToLower() != ".rtf") { lblresumestatus.Text = "Only Files with .doc or .docx extension are allowed..."; lblresumestatus.ForeColor = System.Drawing.Color.White; } else { int filesize = fileupresume.PostedFile.ContentLength; if (filesize > 52428800) { lblresumestatus.Text = "Maximum file size(50 MB) exceeded"; lblresumestatus.ForeColor = System.Drawing.Color.White; } else { //check if vendor exist in folder if (Directory.Exists(Server.MapPath("~/Resume/" + Session["VendorID"] + "/")) == false) { DirectoryInfo di = Directory.CreateDirectory(Server.MapPath("~/Resume/" + Session["VendorID"] + "/")); } //check if jobid exists for that vendor for that resume if (Directory.Exists(Server.MapPath("~/Resume/" + Session["VendorID"] + "/" + Request.QueryString["jobID"])) == false) { DirectoryInfo di = Directory.CreateDirectory(Server.MapPath("~/Resume/" + Session["VendorID"] + "/" + Request.QueryString["jobID"])); } UniqueDateTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"); if (fileExtension.ToLower() == ".doc") { fileupresume.SaveAs(Server.MapPath("~/Resume/" + Session["VendorID"] + "/" + Request.QueryString["jobID"] + "/") + (fileupresume.FileName.Replace(".doc", "_" + UniqueDateTime + ".doc"))); canResume = Server.MapPath("~/Resume/" + Session["VendorID"] + "/" + Request.QueryString["jobID"] + "/") + (fileupresume.FileName.Replace(".doc", "_" + UniqueDateTime + ".doc")); } if (fileExtension.ToLower() == ".docx") { fileupresume.SaveAs(Server.MapPath("~/Resume/" + Session["VendorID"] + "/" + Request.QueryString["jobID"] + "/") + (fileupresume.FileName.Replace(".docx", "_" + UniqueDateTime + ".docx"))); canResume = Server.MapPath("~/Resume/" + Session["VendorID"] + "/" + Request.QueryString["jobID"] + "/") + (fileupresume.FileName.Replace(".docx", "_" + UniqueDateTime + ".docx")); } if (fileExtension.ToLower() == ".rtf") { fileupresume.SaveAs(Server.MapPath("~/Resume/" + Session["VendorID"] + "/" + Request.QueryString["jobID"] + "/") + (fileupresume.FileName.Replace(".rtf", "_" + UniqueDateTime + ".rtf"))); canResume = Server.MapPath("~/Resume/" + Session["VendorID"] + "/" + Request.QueryString["jobID"] + "/") + (fileupresume.FileName.Replace(".rtf", "_" + UniqueDateTime + ".rtf")); } if (fileExtension.ToLower() == ".pdf") { fileupresume.SaveAs(Server.MapPath("~/Resume/" + Session["VendorID"] + "/" + Request.QueryString["jobID"] + "/") + (fileupresume.FileName.Replace(".pdf", "_" + UniqueDateTime + ".pdf"))); canResume = Server.MapPath("~/Resume/" + Session["VendorID"] + "/" + Request.QueryString["jobID"] + "/") + (fileupresume.FileName.Replace(".pdf", "_" + UniqueDateTime + ".pdf")); } //fileupresume.SaveAs(Server.MapPath("~/Resume/4/JALS000019/") + fileupresume.FileName); lblresumestatus.Text = "File uploaded..."; lblresumestatus.ForeColor = System.Drawing.Color.White; } } } else { lblresumestatus.Text = "Please select a file to upload..."; lblresumestatus.ForeColor = System.Drawing.Color.White; } API.Service web = new API.Service(); //API.Service web = new API.Service(); XmlDocument dom1 = new XmlDocument(); UserID = Session["UserID"].ToString(); dom1.LoadXml("<XML>" + web.get_dates(Session["Email"].ToString(), Session["P@ss"].ToString(), jobID.ToString()).InnerXml + "</XML>"); XmlNodeList Response3 = dom1.SelectNodes("XML/RESPONSE"); string strat = Response3.Item(0).SelectSingleNode("CONTRACT_START_DATE").InnerText; string end = Response3.Item(0).SelectSingleNode("CONTRACT_END_DATE").InnerText; dom1.LoadXml("<XML>" + web.set_employee(Session["Email"].ToString(), Session["P@ss"].ToString(), txtfistname.Value, txtmiddle.Value, txtlastname.Value, txtemail.Text, txtphone.Value, txtdateofbirth.Value, txtsuite.Value, txtaddress1.Value, "", txtcity.Value, ddlprivince.SelectedValue, txtpostal.Value, sCountry, txtcomment.Text, canPhoto, txtavailable.Value, txtskype.Value, strat, end, jobID, Convert.ToInt32(Session["VendorID"]), Convert.ToInt32(Session["ClientID"]), txtlicence.Value, txtsinnumber.Value, txtstdpayf.Value).InnerXml + "</XML>"); //XmlNodeList Response1 = dom1.SelectNodes("XML/RESPONSE"); //string employeeID = ""; string employeeID = ""; try { if (conn.State == System.Data.ConnectionState.Closed) { conn.Open(); // Session["JobID"] = jobID.ToString(); //start, end and weeks string sqlGetLastInsertedEmployee = "select max(employee_id) as employee_id from ovms_employees where vendor_id = " + Session["VendorID"].ToString() + " and client_id = " + Session["ClientID"].ToString() + " and job_id = " + jobID + " and active = 1"; SqlCommand cmdLastInsertedEmployee = new SqlCommand(sqlGetLastInsertedEmployee, conn); SqlDataReader readerInsertedEmployee = cmdLastInsertedEmployee.ExecuteReader(); if (readerInsertedEmployee.HasRows == true) { while (readerInsertedEmployee.Read()) { employeeID = readerInsertedEmployee["employee_id"].ToString(); } } //close readerInsertedEmployee.Close(); cmdLastInsertedEmployee.Dispose(); } } catch (Exception ex) { // } finally { if (conn.State == System.Data.ConnectionState.Open) { conn.Close(); } } // employeeID = Response1.Item(0).SelectSingleNode("EMPLOYEE_ID").InnerText; dom1.LoadXml("<XML>" + web.insert_resume(Session["Email"].ToString(), Session["P@ss"].ToString(), canResume, jobID.ToString(), employeeID, UserID, Session["VendorId"].ToString()).InnerXml + "</XML>"); XmlNodeList Response2 = dom1.SelectNodes("XML/RESPONSE"); if (txtemprating1 != null) { dom1.LoadXml("<XML>" + web.Insert_emp_ratings(Session["Email"].ToString(), Session["P@ss"].ToString(), employeeID, Session["VendorID"].ToString(), Session["ClientID"].ToString(), txtemprating1.Text, txtemprating2.Text, txtemprating3.Text, txtemprating4.Text, txtemprating5.Text, Session["UserID"].ToString(), jobID.ToString()).InnerXml + "</XML>"); } XmlNodeList Response6 = dom1.SelectNodes("XML/RESPONSE"); if (Response6.Item(0).SelectSingleNode("DATA").InnerText != "") { lblTableData.Text = "New worker Added succcessfully"; } Response.Redirect("Preview_Workers.aspx?empid=" + employeeID + "&jobID=" + Request.QueryString["jobID"]); }