protected void btnCheck_Click(object sender, EventArgs e)
{
WebClient client = new WebClient();
byte[] datasize = null;
try
{
datasize = client.DownloadData("http://www.google.com");
}
catch (Exception ex)
{
}
if (datasize != null && datasize.Length > 0)
{
var List = DB.tbl_Contact.Where(p => p.IsOnline == false).ToList();
foreach (Database.tbl_Contact item1 in List)
{
var objtbl_Contact = DB.tbl_Contact.SingleOrDefault(p => p.ID == item1.ID);
objtbl_Contact.IsOnline = true;
DB.SaveChanges();
}
foreach (Database.tbl_Contact item in List)
{
OnlineDB.tbl_Contact objtbl_Contact = new OnlineDB.tbl_Contact();
objtbl_Contact.Name = item.Name;
objtbl_Contact.Address = item.Address;
objtbl_Contact.Description = item.Description;
objtbl_Contact.EmailID = item.EmailID;
objtbl_Contact.MobileNo = item.MobileNo;
objtbl_Contact.City = item.City;
objtbl_Contact.State = item.State;
objtbl_Contact.CompanyName = item.CompanyName;
objtbl_Contact.WebSite = item.WebSite;
//if (Image.HasFile)
//{
// Image.SaveAs(Server.MapPath("../Gallery/") + Image.FileName);
// objtbl_Contact.Avtar = Image.FileName;
//}
objtbl_Contact.Remainder = DateTime.Now;
objtbl_Contact.IsOnline = true;
objtbl_Contact.Deleted = true;
objtbl_Contact.DateTime = DateTime.Now;
objtbl_Contact.CreatedBy = 1;
DB1.tbl_Contact.AddObject(objtbl_Contact);
DB1.SaveChanges();
lbltxt.ForeColor = System.Drawing.Color.Green;
lbltxt.Text = List.Count() + " Records Uploaded Successfully !!";
//ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('Uploaded Successfully !!');", true);
}
}
else
{
lbltxt.ForeColor = System.Drawing.Color.Red;
lbltxt.Text = "Internet Connection Not Available.";
}
}
{
WebClient client = new WebClient();
byte[] datasize = null;
try
{
datasize = client.DownloadData("http://www.google.com");
}
catch (Exception ex)
{
}
if (datasize != null && datasize.Length > 0)
{
var List = DB.tbl_Contact.Where(p => p.IsOnline == false).ToList();
foreach (Database.tbl_Contact item1 in List)
{
var objtbl_Contact = DB.tbl_Contact.SingleOrDefault(p => p.ID == item1.ID);
objtbl_Contact.IsOnline = true;
DB.SaveChanges();
}
foreach (Database.tbl_Contact item in List)
{
OnlineDB.tbl_Contact objtbl_Contact = new OnlineDB.tbl_Contact();
objtbl_Contact.Name = item.Name;
objtbl_Contact.Address = item.Address;
objtbl_Contact.Description = item.Description;
objtbl_Contact.EmailID = item.EmailID;
objtbl_Contact.MobileNo = item.MobileNo;
objtbl_Contact.City = item.City;
objtbl_Contact.State = item.State;
objtbl_Contact.CompanyName = item.CompanyName;
objtbl_Contact.WebSite = item.WebSite;
//if (Image.HasFile)
//{
// Image.SaveAs(Server.MapPath("../Gallery/") + Image.FileName);
// objtbl_Contact.Avtar = Image.FileName;
//}
objtbl_Contact.Remainder = DateTime.Now;
objtbl_Contact.IsOnline = true;
objtbl_Contact.Deleted = true;
objtbl_Contact.DateTime = DateTime.Now;
objtbl_Contact.CreatedBy = 1;
DB1.tbl_Contact.AddObject(objtbl_Contact);
DB1.SaveChanges();
lbltxt.ForeColor = System.Drawing.Color.Green;
lbltxt.Text = List.Count() + " Records Uploaded Successfully !!";
//ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('Uploaded Successfully !!');", true);
}
}
else
{
lbltxt.ForeColor = System.Drawing.Color.Red;
lbltxt.Text = "Internet Connection Not Available.";
}
}
PHP Graphics
ReplyDeletePHP secure password
How to display PDF file in PHP
PHP File Upload MIME Type Validation
PHP Emoji Characters