<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Configuration" %>
<%@ Import Namespace="System.Collections" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Web.UI.WebControls.WebParts" %>
<%@ Import Namespace="System.Web.UI.HtmlControls" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.XPath" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Text.RegularExpressions" %>
<script Language = "C#" runat ="server">
public string Strsql, Strsql1, Strsql2, Strsql3, Ecsql, str_refresh, AdvertiserName, AdvertiserType, SenderReference, DisplayReference, Classification, Position;
public string Description, Description1, Short_Description1, Short_Description, expn, Country, Location, Area, PostalCode, ApplicationURL, DescriptionURL, Language;
public string ContactName, EmploymentType, StartDate, Duration, WorkHours, SalaryCurrency, SalaryMinimum, SalaryMaximum, SalaryPeriod, SalaryAdditional, JobSource;
public string VideoLinkURL;
dynamic TempCategory_Id;
SqlCommand MyCommand, MyCommand1, MyCommand2, MyCommand3;
SqlDataReader MyReader;
protected void Page_Load(object sender, EventArgs e)
{
try
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ToString());
con.Open();
str_refresh = "Delete from Feed_Webspidermount where Delete_Flag=1 or Delete_Flag=2";
SqlCommand cmd = new SqlCommand(str_refresh, con);
cmd.ExecuteNonQuery();
con.Close();
XPathDocument doc = new XPathDocument(Server.MapPath("Jobs.xml"));
XPathDocument doc1 = new XPathDocument(Server.MapPath("Jobs1.xml"));
XPathDocument doc2 = new XPathDocument(Server.MapPath("Jobs2.xml"));
foreach (XPathNavigator child in doc.CreateNavigator().Select("Jobs/*"))
{
AdvertiserName = null;
if (child.LocalName == "job")
{
AdvertiserName = child.SelectSingleNode("AdvertiserName").Value;
}
AdvertiserType = null;
if (child.LocalName == "job")
{
AdvertiserType = child.SelectSingleNode("AdvertiserType").Value;
}
SenderReference = null;
if (child.LocalName == "job")
{
SenderReference = child.SelectSingleNode("SenderReference").Value;
}
DisplayReference = null;
if (child.LocalName == "job")
{
DisplayReference = child.SelectSingleNode("DisplayReference").Value;
}
Classification = null;
if (child.LocalName == "job")
{
Classification = child.SelectSingleNode("Classification").Value;
}
Position = null;
if (child.LocalName == "job")
{
Position = child.SelectSingleNode("Position").Value;
}
expn = "<.*?>";
if (child.LocalName == "job")
{
Description1 = child.SelectSingleNode("Description1").Value;
Description = Regex.Replace(Description1, "'", "'");
Short_Description1 = Regex.Replace(Description, expn, String.Empty);
Short_Description1 = Description.Substring(0, 250);
}
Country = null;
if (child.LocalName == "job")
{
Country = child.SelectSingleNode("Country").Value;
}
Location = null;
if (child.LocalName == "job")
{
Location = child.SelectSingleNode("Location").Value;
}
Area = null;
if (child.LocalName == "job")
{
Area = child.SelectSingleNode("Area").Value;
}
PostalCode = null;
if (child.LocalName == "job")
{
PostalCode = child.SelectSingleNode("PostalCode").Value;
}
ApplicationURL = null;
if (child.LocalName == "job")
{
ApplicationURL = child.SelectSingleNode("ApplicationURL").Value;
}
DescriptionURL = null;
if (child.LocalName == "job")
{
DescriptionURL = child.SelectSingleNode("DescriptionURL").Value;
}
Language = null;
if (child.LocalName == "job")
{
Language = child.SelectSingleNode("Language").Value;
}
ContactName = null;
if (child.LocalName == "job")
{
ContactName = child.SelectSingleNode("ContactName").Value;
}
EmploymentType = null;
if (child.LocalName == "job")
{
EmploymentType = child.SelectSingleNode("EmploymentType").Value;
}
StartDate = null;
if (child.LocalName == "job")
{
StartDate = child.SelectSingleNode("StartDate").Value;
}
Duration = null;
if (child.LocalName == "job")
{
Duration = child.SelectSingleNode("Duration").Value;
}
WorkHours = null;
if (child.LocalName == "job")
{
WorkHours = child.SelectSingleNode("WorkHours").Value;
}
SalaryCurrency = null;
if (child.LocalName == "job")
{
SalaryCurrency = child.SelectSingleNode("SalaryCurrency").Value;
}
SalaryMinimum = null;
if (child.LocalName == "job")
{
SalaryMinimum = child.SelectSingleNode("SalaryMinimum").Value;
}
SalaryMaximum = null;
if (child.LocalName == "job")
{
SalaryMaximum = child.SelectSingleNode("SalaryMaximum").Value;
}
SalaryPeriod = null;
if (child.LocalName == "job")
{
SalaryPeriod = child.SelectSingleNode("SalaryPeriod").Value;
}
SalaryAdditional = null;
if (child.LocalName == "job")
{
SalaryAdditional = child.SelectSingleNode("SalaryAdditional").Value;
}
JobSource = null;
if (child.LocalName == "job")
{
JobSource = child.SelectSingleNode("JobSource").Value;
}
VideoLinkURL = null;
if (child.LocalName == "job")
{
VideoLinkURL = child.SelectSingleNode("VideoLinkURL").Value;
}
try
{
SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ToString());
con1.Open();
Strsql = "Select JobG8_Id from JobG8 where SenderReference='" + SenderReference + "'";
SqlCommand cmd1 = new SqlCommand(Strsql, con1);
TempCategory_Id = cmd1.ExecuteScalar();
if (TempCategory_Id > 0)
{
Strsql1 = "Insert into JobG8(AdvertiserName,AdvertiserType,SenderReference,DisplayReference,Classification,Position,Description,Country,Location,Area,PostalCode,ApplicationURL,DescriptionURL,Language,ContactName,EmploymentType,StartDate,Duration,WorkHours,SalaryCurrency,SalaryMinimum,SalaryMaximum,SalaryPeriod,SalaryAdditional,JobSource,VideoLinkURL,Delete_Flag,Short_Description) Values('" + AdvertiserName + "','" + AdvertiserType + "','" + SenderReference + "','" + DisplayReference + "','" + Classification + "','" + Position + "','" + Description + "','" + Country + "','" + Location + "','" + Area + "','" + PostalCode + "','" + ApplicationURL + "','" + DescriptionURL + "','" + Language + "','" + ContactName + "','" + EmploymentType + "','" + StartDate + "','" + Duration + "','" + WorkHours + "','" + SalaryCurrency + "','" + SalaryMinimum + "','" + SalaryMaximum + "','" + SalaryPeriod + "','" + SalaryAdditional + "','" + JobSource + "','" + VideoLinkURL + "','0','" + Short_Description + "')";
SqlCommand cmd2 = new SqlCommand(Strsql1, con1);
cmd2.ExecuteNonQuery();
}
con1.Close();
}
catch (Exception ex1)
{
Response.Write(ex1);
}
}
}
catch (Exception ex)
{
Response.Write(ex);
}
}
</script>
Hi,
Here i attached my code,
in this code i fetched the information from the jobs.xml.
its working fine
My requirement is i want to fetch the info from jobs1.xml and jobs2.xml .I dont want to repeat the process again.I want to do it in same time.What to do