using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
using System.Text;
using System.Web.Mail;
using System.Collections.Generic;
using System.Net;
using System.IO;
public partial class SearchDomain : System.Web.UI.Page
{
//SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["con"]);
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString);
string smsMessage = "";
string Search;
SqlDataAdapter daSearch = null;
DataTable dt = null;
DataTable dtHost = null;
protected void Page_Load(object sender, EventArgs e)
{
lblError.Text = "";
//grdSearch.Visible = false;
//grdHostSearch.Visible = false;
tblLOG.Visible = false;
tbl_sms.Visible = false;
tbl_email.Visible = false;
}
string year, month;
int Days;
DateTime Date;
string strDate;
static string str1 = "";
static string str2 = "";
static string str3 = "";
int j;
string log = "";
SqlDataAdapter dalog = null;
DataTable dtLogs = null;
SqlDataAdapter dalog1 = null;
DataTable dtLogs1 = null;
Functions csF = new Functions();
protected void btnSearch_Click(object sender, EventArgs e)
{
year = DateTime.Today.Year.ToString();
month = DateTime.Today.Month.ToString();
Date = DateTime.Today;
if (txtClient.Text != "")
{
str1 = " and c.ClientName like '" + txtClient.Text + "%'";
}
if (txtExpired.Text != "")
{
int prevdate = Convert.ToInt32(txtExpired.Text);
double prevdate1 = -+prevdate;
strDate = Date.AddDays(prevdate1).ToString();
//strDate = Date.Subtract;
str2 = " and DExpDate between '" + strDate + "' and '" + Date + "' ";
str3 = " and HExpDate between '" + strDate + "' and '" + Date + "' ";
}
if (txtExpDays.Text != "")
{
strDate = Date.AddDays(Convert.ToInt32(txtExpDays.Text)).ToString();
str2 = " and DExpDate between '" + Date + "' and '" + strDate + "' ";
str3 = " and HExpDate between '" + Date + "' and '" + strDate + "' ";
}
if (txtStartdate.Text != "" && txtEndDate.Text != "")
{
str2 = " and DRegDate between '" + txtStartdate.Text + "' and '" + txtEndDate.Text + "' ";
str3 = " and HRegDate between '" + txtStartdate.Text + "' and '" + txtEndDate.Text + "' ";
}
bind();
if (ddlProduct.SelectedItem.Text == "Domain Registration")
{
lblHostingDetails.Visible = false;
grdHostSearch.Visible = false;
}
if (ddlProduct.SelectedItem.Text == "Hosting Registration")
{
lblDomainDetails.Visible = false;
grdSearch.Visible = false;
}
}
protected void bind()
{
if (ddlProduct.SelectedValue != "0")
{
//-----------------------DOMAIN---------------------------
//if (ddlProduct.SelectedValue != "0" && txtStartdate.Text == "" && txtEndDate.Text == "" && ddlProduct.SelectedItem.Text == "Domain Registration")
if (txtStartdate.Text == "" && txtEndDate.Text == "" && txtExpDays.Text != "" && (ddlProduct.SelectedItem.Text == "Domain Registration" || ddlProduct.SelectedItem.Text == "All"))
{
//select t.Id,t.DomainName as DomId,Convert(varchar(11),t.DRegDate,103) as DRegDate,Convert(varchar(11),t.DExpDate,103) as DExpDate,d.DomainName from tbl_DomainHosting t,tbl_DomainMaster d where t.DomainName=d.Id and DRegDate between '7/25/2010' and '10/29/2010'
Search = "select t.Id,t.DomainName as DomId,Convert(varchar(11),t.DRegDate,101) as DRegDate,Convert(varchar(11),t.DExpDate,101) as DExpDate,d.DomainName,c.ClientName,c.ContactP,c.Email,c.Mobile from tbl_DomainHosting t,tbl_DomainMaster d,tbl_ClientMaster c where t.DomainName=d.Id and c.Id = d.ClientName " + str2 + " " + str1;
daSearch = new SqlDataAdapter(Search, con);
dt = new DataTable();
daSearch.Fill(dt);
if (dt.Rows.Count == 0)
{
lblError.Text = "No Domain Records Present";
grdSearch.Visible = false;
}
else
{
grdSearch.Visible = true;
grdSearch.DataSource = dt;
grdSearch.DataBind();
lblDomainDetails.Visible = true;
bindLog();
}
}
else if (txtStartdate.Text != "" && txtEndDate.Text != "" && (ddlProduct.SelectedItem.Text == "Domain Registration" || ddlProduct.SelectedItem.Text == "All"))
{
//select Id,DomainName,Convert(varchar(11),DRegDate,103) as DRegDate,Convert(varchar(11),DExpDate,103) as DExpDate from dbo.tbl_DomainHosting where DRegDate between '2010/08/01' and '2010/08/04'
Search = "select t.Id,t.DomainName as DomId,Convert(varchar(11),t.DRegDate,103) as DRegDate,Convert(varchar(11),t.DExpDate,103) as DExpDate,d.DomainName,c.ClientName,c.ContactP,c.Email,c.Mobile from tbl_DomainHosting t,tbl_DomainMaster d,tbl_ClientMaster c where t.DomainName=d.Id and c.Id = d.ClientName " + str2 + " " + str1;
daSearch = new SqlDataAdapter(Search, con);
dt = new DataTable();
daSearch.Fill(dt);
if (dt.Rows.Count == 0)
{
lblError.Text = "No Domain Records Present";
grdSearch.Visible = false;
}
else
{
grdSearch.Visible = true;
grdSearch.DataSource = dt;
grdSearch.DataBind();
lblDomainDetails.Visible = true;
bindLog();
}
}
else if (ddlProduct.SelectedValue != "0" && txtStartdate.Text == "" && txtEndDate.Text == "" && txtExpired.Text != "" && (ddlProduct.SelectedItem.Text == "Domain Registration" || ddlProduct.SelectedItem.Text == "All"))
{
//select t.Id,t.DomainName as DomId,Convert(varchar(11),t.DRegDate,103) as DRegDate,Convert(varchar(11),t.DExpDate,103) as DExpDate,d.DomainName from tbl_DomainHosting t,tbl_DomainMaster d where t.DomainName=d.Id and DRegDate between '7/25/2010' and '10/29/2010'
Search = "select t.Id,t.DomainName as DomId,Convert(varchar(11),t.DRegDate,101) as DRegDate,Convert(varchar(11),t.DExpDate,101) as DExpDate,d.DomainName,c.ClientName,c.ContactP,c.Email,c.Mobile from tbl_DomainHosting t,tbl_DomainMaster d,tbl_ClientMaster c where t.DomainName=d.Id and c.Id = d.ClientName " + str2 + " " + str1;
daSearch = new SqlDataAdapter(Search, con);
dt = new DataTable();
daSearch.Fill(dt);
if (dt.Rows.Count == 0)
{
lblError.Text = "No Domain Records Present";
grdSearch.Visible = false;
}
else
{
grdSearch.Visible = true;
grdSearch.DataSource = dt;
grdSearch.DataBind();
lblDomainDetails.Visible = true;
bindLog();
}
}
else if (txtClient.Text != "" && (ddlProduct.SelectedItem.Text == "Domain Registration" || ddlProduct.SelectedItem.Text == "All"))
{
//select Id,DomainName,Convert(varchar(11),DRegDate,103) as DRegDate,Convert(varchar(11),DExpDate,103) as DExpDate from dbo.tbl_DomainHosting where DRegDate between '2010/08/01' and '2010/08/04'
Search = "select t.Id,t.DomainName as DomId,Convert(varchar(11),t.DRegDate,103) as DRegDate,Convert(varchar(11),t.DExpDate,103) as DExpDate,d.DomainName,c.ClientName,c.ContactP,c.Email,c.Mobile from tbl_DomainHosting t,tbl_DomainMaster d,tbl_ClientMaster c where t.DomainName=d.Id and c.Id = d.ClientName " + str2 + " " + str1;
daSearch = new SqlDataAdapter(Search, con);
dt = new DataTable();
daSearch.Fill(dt);
if (dt.Rows.Count == 0)
{
lblError.Text = "No Domain Records Present";
grdSearch.Visible = false;
}
else
{
grdSearch.Visible = true;
grdSearch.DataSource = dt;
grdSearch.DataBind();
lblDomainDetails.Visible = true;
bindLog();
}
}
//-----------------------HOSTING---------------------------
if (txtStartdate.Text == "" && txtEndDate.Text == "" && txtExpDays.Text != "" && (ddlProduct.SelectedItem.Text == "Hosting Registration" || ddlProduct.SelectedItem.Text == "All"))
{
//select t.Id,t.DomainName as DomId,Convert(varchar(11),t.DRegDate,103) as DRegDate,Convert(varchar(11),t.DExpDate,103) as DExpDate,d.DomainName from tbl_DomainHosting t,tbl_DomainMaster d where t.DomainName=d.Id and DRegDate between '7/25/2010' and '10/29/2010'
Search = "select t.Id,t.DomainName as DomId,Convert(varchar(11),t.HRegDate,101) as HRegDate,Convert(varchar(11),t.HExpDate,101) as HExpDate,d.DomainName,c.ClientName,c.ContactP,c.Email,c.Mobile from tbl_HostingDetails t,tbl_DomainMaster d,tbl_ClientMaster c where t.DomainName=d.Id and c.Id = d.ClientName " + str3 + " " + str1;
daSearch = new SqlDataAdapter(Search, con);
dtHost = new DataTable();
daSearch.Fill(dtHost);
if (dtHost.Rows.Count == 0)
{
lblError.Text = "No Hosting Records Present";
grdHostSearch.Visible = false;
}
else
{
grdHostSearch.Visible = true;
grdHostSearch.DataSource = dtHost;
grdHostSearch.DataBind();
lblHostingDetails.Visible = true;
bindHostLog();
}
}
else if (txtStartdate.Text != "" && txtEndDate.Text != "" && (ddlProduct.SelectedItem.Text == "Hosting Registration" || ddlProduct.SelectedItem.Text == "All"))
{
//select Id,DomainName,Convert(varchar(11),DRegDate,103) as DRegDate,Convert(varchar(11),DExpDate,103) as DExpDate from dbo.tbl_DomainHosting where DRegDate between '2010/08/01' and '2010/08/04'
Search = "select t.Id,t.DomainName as DomId,Convert(varchar(11),t.HRegDate,101) as HRegDate,Convert(varchar(11),t.HExpDate,101) as HExpDate,d.DomainName,c.ClientName,c.ContactP,c.Email,c.Mobile from tbl_HostingDetails t,tbl_DomainMaster d,tbl_ClientMaster c where t.DomainName=d.Id and c.Id = d.ClientName " + str3 + " " + str1;
daSearch = new SqlDataAdapter(Search, con);
dtHost = new DataTable();
daSearch.Fill(dtHost);
if (dtHost.Rows.Count == 0)
{
lblError.Text = "No Hosting Records Present";
grdHostSearch.Visible = false;
}
else
{
grdHostSearch.Visible = true;
grdHostSearch.DataSource = dtHost;
grdHostSearch.DataBind();
lblHostingDetails.Visible = true;
bindHostLog();
}
}
else if (txtStartdate.Text == "" && txtEndDate.Text == "" && txtExpired.Text != "" && (ddlProduct.SelectedItem.Text == "Hosting Registration" || ddlProduct.SelectedItem.Text == "All"))
{
//select t.Id,t.DomainName as DomId,Convert(varchar(11),t.DRegDate,103) as DRegDate,Convert(varchar(11),t.DExpDate,103) as DExpDate,d.DomainName from tbl_DomainHosting t,tbl_DomainMaster d where t.DomainName=d.Id and DRegDate between '7/25/2010' and '10/29/2010'
Search = "select t.Id,t.DomainName as DomId,Convert(varchar(11),t.HRegDate,101) as HRegDate,Convert(varchar(11),t.HExpDate,101) as HExpDate,d.DomainName,c.ClientName,c.ContactP,c.Email,c.Mobile from tbl_HostingDetails t,tbl_DomainMaster d,tbl_ClientMaster c where t.DomainName=d.Id and c.Id = d.ClientName " + str3 + " " + str1;
daSearch = new SqlDataAdapter(Search, con);
dtHost = new DataTable();
daSearch.Fill(dtHost);
if (dtHost.Rows.Count == 0)
{
lblError.Text = "No Hosting Records Present";
grdHostSearch.Visible = false;
}
else
{
grdHostSearch.Visible = true;
grdHostSearch.DataSource = dtHost;
grdHostSearch.DataBind();
lblHostingDetails.Visible = true;
bindHostLog();
}
}
else if (txtClient.Text != "" && (ddlProduct.SelectedItem.Text == "Hosting Registration" || ddlProduct.SelectedItem.Text == "All"))
{
//select Id,DomainName,Convert(varchar(11),DRegDate,103) as DRegDate,Convert(varchar(11),DExpDate,103) as DExpDate from dbo.tbl_DomainHosting where DRegDate between '2010/08/01' and '2010/08/04'
Search = "select t.Id,t.DomainName as DomId,Convert(varchar(11),t.HRegDate,101) as HRegDate,Convert(varchar(11),t.HExpDate,101) as HExpDate,d.DomainName,c.ClientName,c.ContactP,c.Email,c.Mobile from tbl_HostingDetails t,tbl_DomainMaster d,tbl_ClientMaster c where t.DomainName=d.Id and c.Id = d.ClientName " + str3 + " " + str1;
daSearch = new SqlDataAdapter(Search, con);
dtHost = new DataTable();
daSearch.Fill(dtHost);
if (dtHost.Rows.Count == 0)
{
lblError.Text = "No Hosting Records Present";
grdHostSearch.Visible = false;
}
else
{
grdHostSearch.Visible = true;
grdHostSearch.DataSource = dtHost;
grdHostSearch.DataBind();
lblHostingDetails.Visible = true;
bindHostLog();
}
}
}
else
{
lblError.Text = "Please Select Product";
grdSearch.Visible = false;
grdHostSearch.Visible = false;
lblDomainDetails.Visible = false;
lblHostingDetails.Visible = false;
}
}
void bindLog()
{
for (j = 0; j < dt.Rows.Count; j++)
{
string stlog = "select LogID from tbl_mailLog where DomID='" + dt.Rows[j]["DomId"] + "' and DomHost='Domain'";
dalog = new SqlDataAdapter(stlog, con);
dtLogs = new DataTable();
dalog.Fill(dtLogs);
if (dtLogs.Rows.Count != 0)
{
ImageButton imgLOgg = (ImageButton)grdSearch.Rows[j].FindControl("imgMail");
imgLOgg.Visible = true;
}
string stlog1 = "select Smsid from SMS_log where DomId='" + dt.Rows[j]["DomId"] + "' and DomHost='Domain'";
dalog1 = new SqlDataAdapter(stlog1, con);
dtLogs1 = new DataTable();
dalog1.Fill(dtLogs1);
if (dtLogs1.Rows.Count != 0)
{
ImageButton imgSmsLogg = (ImageButton)grdSearch.Rows[j].FindControl("imgSms");
imgSmsLogg.Visible = true;
}
}
}
void bindHostLog()
{
for (j = 0; j < dtHost.Rows.Count; j++)
{
string stlog = "select LogID from tbl_HostMailLog where DomID='" + dtHost.Rows[j]["DomId"] + "'";
dalog = new SqlDataAdapter(stlog, con);
dtLogs = new DataTable();
dalog.Fill(dtLogs);
if (dtLogs.Rows.Count != 0)
{
ImageButton imgLOgg = (ImageButton)grdHostSearch.Rows[j].FindControl("imgMailHost");
imgLOgg.Visible = true;
}
string stlog1 = "select Smsid from SMS_Hostlog where DomId='" + dtHost.Rows[j]["DomId"] + "'";
dalog1 = new SqlDataAdapter(stlog1, con);
dtLogs1 = new DataTable();
dalog1.Fill(dtLogs1);
if (dtLogs1.Rows.Count != 0)
{
ImageButton imgSmsLogg = (ImageButton)grdHostSearch.Rows[j].FindControl("imgSmsHost");
imgSmsLogg.Visible = true;
}
}
}
//----------------------EMAIL DOMAIN----------------------------
Label lblContact, Email, DomID, PDate, ExpiresOn;
LinkButton Domain;
protected void lnkSendMail_Click(object sender, EventArgs e)
{
LinkButton lb = (LinkButton)sender;
GridViewRow gr = (GridViewRow)lb.NamingContainer;
int row = gr.RowIndex;
lblContact = (Label)grdSearch.Rows[row].FindControl("lblContact");
Email = (Label)grdSearch.Rows[row].FindControl("lblEmail");
Domain = (LinkButton)grdSearch.Rows[row].FindControl("lblDomain");
DomID = (Label)grdSearch.Rows[row].FindControl("lblDomId");
PDate = (Label)grdSearch.Rows[row].FindControl("lblDate");
ExpiresOn = (Label)grdSearch.Rows[row].FindControl("lblExpiresOn");
Sendemail();
}
protected void btnSendMail_Click(object sender, EventArgs e)
{
if (txtEmailID.Text != "")
{
Label1.Text = txtEmailID.Text;
insertMail();
bind();
tbl_email.Visible = false;
}
}
protected void insertMail()
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
string mailLog = "insert into tbl_MailLog values('" + DomID.Text + "','" + DateTime.Now + "','" + Session["AdminAuth"] + "','Domain','" + Label1.Text + "')";
SqlCommand cmdlog = new SqlCommand(mailLog, con);
cmdlog.ExecuteNonQuery();
}
//----------------------EMAIL HOSTING----------------------------
protected void lnkSendMailHost_Click(object sender, EventArgs e)
{
LinkButton lb = (LinkButton)sender;
GridViewRow gr = (GridViewRow)lb.NamingContainer;
int row = gr.RowIndex;
lblContact = (Label)grdHostSearch.Rows[row].FindControl("lblContactHost");
Email = (Label)grdHostSearch.Rows[row].FindControl("lblEmailHost");
Domain = (LinkButton)grdHostSearch.Rows[row].FindControl("lblDomainHost");
DomID = (Label)grdHostSearch.Rows[row].FindControl("lblDomIdHost");
PDate = (Label)grdHostSearch.Rows[row].FindControl("lblDateHost");
ExpiresOn = (Label)grdHostSearch.Rows[row].FindControl("lblExpiresOnHost");
SendemailHost();
}
protected void btnSendMailHost_Click(object sender, EventArgs e)
{
if (txtEmailIDHost.Text != "")
{
Label1.Text = txtEmailIDHost.Text;
insertMailHost();
bind();
tbl_EmailHost.Visible = false;
}
}
protected void insertMailHost()
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
string mailLog = "insert into tbl_HostMailLog values('" + DomID.Text + "','" + DateTime.Now + "','" + Session["AdminAuth"] + "','" + Label1.Text + "')";
SqlCommand cmdlog = new SqlCommand(mailLog, con);
cmdlog.ExecuteNonQuery();
}
//--------------------SENDING MAIL-----------------------
protected void Sendemail()
{
#region sending mail domain
System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage();
StringBuilder sb = new StringBuilder();
sb.Append("");
sb.Append("
");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
//sb.Append("Registration");
sb.Append("");
sb.Append(" | ");
sb.Append("
");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append(" ");
sb.Append(" | ");
sb.Append(" ");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("Dear " + lblContact.Text);
sb.Append(" ");
sb.Append(" The following domain names and services in your account are scheduled to expire soon and will be Discontinued if not renewed:");
sb.Append("");
sb.Append("");
sb.Append(" | ");
sb.Append(" ");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
// details of domain(head)
sb.Append("");
sb.Append("");
sb.Append("Domain Name");
sb.Append(" | ");
sb.Append("");
sb.Append("Purchase Date");
sb.Append(" | ");
sb.Append("");
sb.Append("Expires on");
sb.Append(" | ");
sb.Append(" ");
//details of domain (body)
sb.Append("");
sb.Append("");
sb.Append(Domain.Text);
sb.Append(" | ");
sb.Append("");
sb.Append(PDate.Text);
sb.Append(" | ");
sb.Append("");
sb.Append(ExpiresOn.Text);
sb.Append(" | ");
sb.Append(" ");
sb.Append("");
sb.Append(" ");
sb.Append("");
sb.Append(" | ");
sb.Append(" ");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("All dates are in MM-DD-YYYY format");
sb.Append(" ");
sb.Append("Please be aware that if your domain name or service is discontinued, any email, website, or other services ");
sb.Append("that were associated with it may be affected.");
sb.Append(" ");
sb.Append(" ");
sb.Append("You can extend your domains and services by doing the following:");
sb.Append(" ");
sb.Append(" ");
sb.Append("You may Simply drop in an email on info@ajconit.com confirming your Action");
sb.Append(" ");
sb.Append(" ");
sb.Append("Payment to be made in advance as per the Quotation Attached with this Letter.");
sb.Append(" ");
sb.Append(" ");
sb.Append("Bank Details are as follows :-");
sb.Append(" ");
sb.Append(" ");
sb.Append("Axis Bank (Shivaji Park Branch)");
sb.Append(" ");
sb.Append("Name: - Ajcon IT.com limited");
sb.Append(" ");
sb.Append("A/c No: -341010200001038");
sb.Append(" ");
sb.Append(" ");
sb.Append("After setting your domains and services to renew, we will process the renewal order and attempt to extend the domains and services for you.");
sb.Append("");
sb.Append(" | ");
sb.Append(" ");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("In case you have any queries please feel free to send us an email at info@ajconit.com");
sb.Append(" ");
sb.Append(" ");
sb.Append("Thanks & Regards");
sb.Append(" ");
sb.Append("Support Team.");
sb.Append("");
sb.Append("");
sb.Append(" ");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append(" | ");
sb.Append(" ");
sb.Append("");
sb.Append(" ");
sb.Append(" | ");
sb.Append("
");
sb.Append("");
sb.Append("
");
sb.Append("");
sb.Append("");
#endregion
try
{
if (Email.Text != "")
{
string _to = Email.Text;
Label1.Text = Email.Text;
//string _to = "shruti@ajconit.com";
string _subject = "Domain Expiring Soon";
string _body = sb.ToString();
Boolean m = csF.Mail(ref _to, ref _subject, ref _body);
insertMail();
bind();
}
else
{
lblError.Text = "Email Id not avaliable...";
tbl_email.Visible = true;
grdSearch.Visible = true;
}
}
catch (Exception ex)
{
lblError.Text = ex.Message;
}
}
protected void SendemailHost()
{
#region sending mail Host
StringBuilder sb = new StringBuilder();
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
//sb.Append("Registration");
sb.Append("");
sb.Append(" | ");
sb.Append("
");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append(" ");
sb.Append(" | ");
sb.Append(" ");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("Dear " + lblContact.Text);
sb.Append(" ");
sb.Append(" The following domain names and services in your account are scheduled to expire soon and will be Discontinued if not renewed:");
sb.Append("");
sb.Append("");
sb.Append(" | ");
sb.Append(" ");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("");
// details of domain(head)
sb.Append("");
sb.Append("");
sb.Append("Domain Name");
sb.Append(" | ");
sb.Append("");
sb.Append("Purchase Date");
sb.Append(" | ");
sb.Append("");
sb.Append("Expires on");
sb.Append(" | ");
sb.Append(" ");
//details of domain (body)
sb.Append("");
sb.Append("");
sb.Append(Domain.Text);
sb.Append(" | ");
sb.Append("");
sb.Append(PDate.Text);
sb.Append(" | ");
sb.Append("");
sb.Append(ExpiresOn.Text);
sb.Append(" | ");
sb.Append(" ");
sb.Append("");
sb.Append(" ");
sb.Append("");
sb.Append(" | ");
sb.Append(" ");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("All dates are in MM-DD-YYYY format");
sb.Append(" ");
sb.Append("Please be aware that if your domain name or service is discontinued, any email, website, or other services ");
sb.Append("that were associated with it may be affected.");
sb.Append(" ");
sb.Append(" ");
sb.Append("You can extend your domains and services by doing the following:");
sb.Append(" ");
sb.Append(" ");
sb.Append("You may Simply drop in an email on info@ajconit.com confirming your Action");
sb.Append(" ");
sb.Append(" ");
sb.Append("Payment to be made in advance as per the Quotation Attached with this Letter.");
sb.Append(" ");
sb.Append(" ");
sb.Append("Bank Details are as follows :-");
sb.Append(" ");
sb.Append(" ");
sb.Append("Axis Bank (Shivaji Park Branch)");
sb.Append(" ");
sb.Append("Name: - Ajcon IT.com limited");
sb.Append(" ");
sb.Append("A/c No: -341010200001038");
sb.Append(" ");
sb.Append(" ");
sb.Append("After setting your domains and services to renew, we will process the renewal order and attempt to extend the domains and services for you.");
sb.Append("");
sb.Append(" | ");
sb.Append(" ");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append("In case you have any queries please feel free to send us an email at info@ajconit.com");
sb.Append(" ");
sb.Append(" ");
sb.Append("Thanks & Regards");
sb.Append(" ");
sb.Append("Support Team.");
sb.Append("");
sb.Append("");
sb.Append(" ");
sb.Append("");
sb.Append("");
sb.Append("");
sb.Append(" | ");
sb.Append(" ");
sb.Append("");
sb.Append(" ");
sb.Append(" | ");
sb.Append("
");
sb.Append("");
sb.Append("
");
#endregion
try
{
if (Email.Text != "")
{
//string _to = "sruthysivan@gmail.com";
string _to = Email.Text;
Label1.Text = Email.Text;
string _subject = "Hosting Expiring Soon";
string _body = sb.ToString();
Boolean m = csF.Mail(ref _to, ref _subject, ref _body);
//Response.Write("Done");
insertMailHost();
bind();
}
}
catch (Exception ex)
{
lblError.Text = ex.Message;
tbl_EmailHost.Visible = true;
}
}
//--------------------SMS DOMAIN--------------------------------
Label Sms, mobile;
protected void lnkSendSMS_Click(object sender, EventArgs e)
{
LinkButton lb = (LinkButton)sender;
GridViewRow gr = (GridViewRow)lb.NamingContainer;
int row = gr.RowIndex;
//lblContact = (Label)grdSearch.Rows[row].FindControl("lblContact");
//Email = (Label)grdSearch.Rows[row].FindControl("lblEmail");
//Domain = (Label)grdSearch.Rows[row].FindControl("lblDomain");
Sms = (Label)grdSearch.Rows[row].FindControl("lblSMS");
DomID = (Label)grdSearch.Rows[row].FindControl("lblDomId");
//mobile = (Label)grdSearch.Rows[row].FindControl("lblMobile");
Label2.Text = DomID.Text;
Label1.Text = Sms.Text;
//Label3.Text = mobile.Text;
//PDate = (Label)grdSearch.Rows[row].FindControl("lblDate");
//ExpiresOn = (Label)grdSearch.Rows[row].FindControl("lblExpiresOn");
if (Sms.Text != "")
{
smsto();
smsMessage = "Your Domain is Expiring Soon";
bind();
}
else
{
lblError.Text = "Mobile Number not avaliable";
tbl_sms.Visible = true;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (txtSms.Text != "")
{
Label1.Text = txtSms.Text;
smsto();
insertSms();
tbl_sms.Visible = false;
}
}
protected void insertSms()
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
string mailLog = "insert into SMS_log values('" + Label2.Text + "','" + Label1.Text + "','" + Session["AdminAuth"] + "','" + DateTime.Now + "','Domain')";
SqlCommand cmdlog = new SqlCommand(mailLog, con);
cmdlog.ExecuteNonQuery();
}
//-----------------SMS HOST--------------------------------
protected void lnkSendSMSHost_Click(object sender, EventArgs e)
{
LinkButton lb = (LinkButton)sender;
GridViewRow gr = (GridViewRow)lb.NamingContainer;
int row = gr.RowIndex;
Sms = (Label)grdHostSearch.Rows[row].FindControl("lblSMS");
DomID = (Label)grdHostSearch.Rows[row].FindControl("lblDomId");
Label2.Text = DomID.Text;
Label1.Text = Sms.Text;
if (Sms.Text != "")
{
smsto();
smsMessage = "Your Hosting is Expiring Soon";
bind();
}
else
{
lblError.Text = "Mobile Number not avaliable";
tbl_smsHost.Visible = true;
}
}
protected void Button2_Click(object sender, EventArgs e)
{
if (txtSmsHost.Text != "")
{
Label1.Text = txtSmsHost.Text;
smsto();
insertSmsHost();
txtSmsHost.Visible = false;
}
}
protected void insertSmsHost()
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
string mailLog = "insert into SMS_Hostlog values('" + Label2.Text + "','" + Label1.Text + "','" + Session["AdminAuth"] + "','" + DateTime.Now + "')";
SqlCommand cmdlog = new SqlCommand(mailLog, con);
cmdlog.ExecuteNonQuery();
}
//----------------SENDING SMS------------------------------
void smsto()
{
string result = "";
WebRequest request = null;
HttpWebResponse response = null;
String userid = "2000020932";
String passwd = "123456";
try
{
//String sendToPhoneNumber = "9220640713";
//String test = Label1.Text;
String sendToPhoneNumber = Label1.Text;
string msg = smsMessage;
//string msg = "Your Domain is Expiring Soon";
String url = "http://enterprise.smsgupshup.com/GatewayAPI/rest?method=sendMessage&send_to=" + sendToPhoneNumber + "&msg=" + msg + "&userid=" + userid + "&password=" + passwd + "&v=1.1&msg_type=TEXT&auth_scheme=PLAIN&mask=AJCONIT";
request = WebRequest.Create(url);
response = (HttpWebResponse)request.GetResponse();
Stream stream = response.GetResponseStream();
Encoding ec = System.Text.Encoding.GetEncoding("utf-8");
StreamReader reader = new System.IO.StreamReader(stream, ec);
result = reader.ReadToEnd();
Console.WriteLine(result);
lblError.Text = " Message Send Successfully";
reader.Close();
stream.Close();
insertSms();
bind();
//gv_sms.Visible = false;
}
catch (Exception ex)
{
lblError.Text = "Message Sending Failed";
}
finally
{
if (response != null)
response.Close();
}
}
//---------------LOG DOMAIN---------------------------------
protected void imgMail_Click(object sender, ImageClickEventArgs e)
{
ImageButton imglogDetails = (ImageButton)sender;
GridViewRow gr = (GridViewRow)imglogDetails.NamingContainer;
int rowindex = gr.RowIndex;
Label DomID1 = (Label)grdSearch.Rows[rowindex].FindControl("lblDomId");
LinkButton Domain1 = (LinkButton)grdSearch.Rows[rowindex].FindControl("lblDomain");
string strLog = "select Convert(varchar(15),SentDate,101) as SentDate,EntryBy,MailId from tbl_MailLog where DomID='" + DomID1.Text + "' and DomHost='Domain'";
SqlDataAdapter dalogDetail = new SqlDataAdapter(strLog, con);
DataTable dtLogDetail = new DataTable();
dalogDetail.Fill(dtLogDetail);
grdSearch.Visible = true;
grdLog.DataSource = dtLogDetail;
grdLog.DataBind();
tblLOG.Visible = true;
lblDomainName1.Text = Domain1.Text;
}
protected void imgSms_Click(object sender, ImageClickEventArgs e)
{
ImageButton imglogDetails = (ImageButton)sender;
GridViewRow gr = (GridViewRow)imglogDetails.NamingContainer;
int rowindex = gr.RowIndex;
Label DomID1 = (Label)grdSearch.Rows[rowindex].FindControl("lblDomId");
LinkButton Domain1 = (LinkButton)grdSearch.Rows[rowindex].FindControl("lblDomain");
string strLog1 = "select Convert(varchar(15),EntryDate,101) as EntryDate,EntryBy,PhoneNo from SMS_log where DomID='" + DomID1.Text + "' and DomHost='Domain'";
SqlDataAdapter dalogDetail1 = new SqlDataAdapter(strLog1, con);
DataTable dtLogDetail1 = new DataTable();
dalogDetail1.Fill(dtLogDetail1);
grdSearch.Visible = true;
grdSmsLOg.DataSource = dtLogDetail1;
grdSmsLOg.DataBind();
tblLOG.Visible = true;
lblDomainName1.Text = Domain1.Text;
}
//---------------LOG HOSTING-------------------------------------
protected void imgMailHost_Click(object sender, ImageClickEventArgs e)
{
ImageButton imglogDetails = (ImageButton)sender;
GridViewRow gr = (GridViewRow)imglogDetails.NamingContainer;
int rowindex = gr.RowIndex;
Label DomID1 = (Label)grdHostSearch.Rows[rowindex].FindControl("lblDomIdHost");
LinkButton Domain1 = (LinkButton)grdHostSearch.Rows[rowindex].FindControl("lblDomainHost");
string strLog = "select Convert(varchar(15),SentDate,101) as SentDate,EntryBy,MailId from tbl_HostMailLog where DomID='" + DomID1.Text + "'";
//string strLog = "select Convert(varchar(15),SentDate,101) as SentDate,EntryBy,MailId from tbl_MailLog where DomID='" + DomID1.Text + "' and DomHost='Domain'";
SqlDataAdapter dalogDetail = new SqlDataAdapter(strLog, con);
DataTable dtLogDetail = new DataTable();
dalogDetail.Fill(dtLogDetail);
grdHostSearch.Visible = true;
grdLogHost.DataSource = dtLogDetail;
grdLogHost.DataBind();
tblLOGHost.Visible = true;
lblDomainNameHost.Text = Domain1.Text;
}
protected void imgSmsHost_Click(object sender, ImageClickEventArgs e)
{
ImageButton imglogDetails = (ImageButton)sender;
GridViewRow gr = (GridViewRow)imglogDetails.NamingContainer;
int rowindex = gr.RowIndex;
Label DomID1 = (Label)grdHostSearch.Rows[rowindex].FindControl("lblDomIdHost");
LinkButton Domain1 = (LinkButton)grdHostSearch.Rows[rowindex].FindControl("lblDomainHost");
string strLog1 = "select Convert(varchar(15),EntryDate,101) as EntryDate,EntryBy,PhoneNo from SMS_Hostlog where DomID='" + DomID1.Text + "'";
//string strLog1 = "select Convert(varchar(15),EntryDate,101) as EntryDate,EntryBy,PhoneNo from SMS_log where DomID='" + DomID1.Text + "' and DomHost='Domain'";
SqlDataAdapter dalogDetail1 = new SqlDataAdapter(strLog1, con);
DataTable dtLogDetail1 = new DataTable();
dalogDetail1.Fill(dtLogDetail1);
grdHostSearch.Visible = true;
grdSMSLogHost.DataSource = dtLogDetail1;
grdSMSLogHost.DataBind();
tblLOGHost.Visible = true;
lblDomainNameHost.Text = Domain1.Text;
}
}