using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using System.Web.Mail; public partial class RenewDomain : System.Web.UI.Page { SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString); //SqlConnection con = new SqlConnection(ConfigurationSettings.AppSettings["con"]); DateTime DExpDate; GetValue objgetval = new GetValue(); String msgbody; String strCName, strCEmail, strPhone, strAdd; String strDName, strDRegDt, strDExpDt; protected void Page_Load(object sender, EventArgs e) { lblId.Text = Request.QueryString["Id"]; Get_DomainRecords(); } void Get_DomainRecords() { try { if ((con.State == ConnectionState.Open)) { con.Close(); } SqlDataAdapter da = new SqlDataAdapter("Select Id,DomainName,ClientName,DPeriod,CompanyName,convert(varchar(11),DExpDate,101)as DExpDate,convert(varchar(11),DRegDate,101)as DRegDate from dbo.VW_RenewDomHos Where Id=" + lblId.Text + "", con); DataSet ds = new DataSet(); da.Fill(ds, "data"); DataTable dt = new DataTable(); dt = ds.Tables[0]; lblDomId.Text = dt.Rows[0].ItemArray[0].ToString(); lblDomainName.Text = dt.Rows[0].ItemArray[1].ToString(); lblClientName.Text = dt.Rows[0].ItemArray[2].ToString(); lblRegFor.Text = dt.Rows[0].ItemArray[3].ToString() + " Year"; lblDRegby.Text = dt.Rows[0].ItemArray[4].ToString(); lblDExpdt.Text = dt.Rows[0].ItemArray[5].ToString(); lblDRegDt.Text = dt.Rows[0].ItemArray[6].ToString(); if (lblDRegDt.Text == "" && lblDExpdt.Text == "") { lblDRegDt.Text = ""; lblDExpdt.Text = ""; } } catch (Exception ex) { lblerr.Text = "Error :" + ex.Message; } finally { con.Close(); } } protected void btnSubmit_Click(object sender, ImageClickEventArgs e) { if (DDDExpdt.SelectedItem.Value == "0") { lblerr.Text = "Alert : Please select Renew by no of years"; } else { Renew(); } } void Renew() { try { SqlCommand cmd = new SqlCommand("SpRenewDomainName", con); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@Id", lblId.Text)); // cmd.Parameters.Add(new SqlParameter("@DomainId", lblId.Text)); // cmd.Parameters.Add(new SqlParameter("@ReNewItem", lblDomainName.Text)); cmd.Parameters.Add(new SqlParameter("@ReNewFor", DDDExpdt.SelectedItem.Value)); cmd.Parameters.Add(new SqlParameter("@DExpDt", Convert.ToDateTime(lblExpon.Text))); cmd.Parameters.Add(new SqlParameter("@EntryBy", Session["AdminAuth"])); cmd.Parameters.Add(new SqlParameter("@EntryDate", DateTime.Today)); con.Open(); cmd.ExecuteNonQuery(); lblerr.Text = "Domain Name Renew successfull"; } catch (Exception exp) { lblerr.Text = ("Renew Alert! : " + exp.Message); } finally { con.Close(); } } protected void DDDExpdt_SelectedIndexChanged(object sender, EventArgs e) { DateTime DExpDate; if (DDDExpdt.SelectedItem.Value != "0") { DExpDate = Convert.ToDateTime(lblDExpdt.Text); DExpDate = DExpDate.AddYears(Convert.ToInt32(DDDExpdt.SelectedItem.Value)); lblExpon.Text = Convert.ToString(DExpDate.Month + "/" + DExpDate.Day + "/" + DExpDate.Year); } else if (DDDExpdt.SelectedItem.Value == "0") { lblExpon.Text = ""; } } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (DDDExpdt.SelectedItem.Value == "0") { lblerr.Text = "Alert : Please select Renew by no of years"; } else { Renew(); get_maildata(); } } //Mail ------------------------------------------------------------ void get_maildata() { objgetval.get_clientData(ref lblClientName, ref lblClientEmail, ref lblPhone, ref lblAdd, lblDomId.Text, ref lblerr); strCName = lblClientName.Text; strCEmail = lblClientEmail.Text; strPhone = lblPhone.Text; strAdd = lblAdd.Text; strDName = lblDomainName.Text; strDRegDt = Convert.ToString(DateTime.Today.Month + "/" + DateTime.Today.Day + "/" + DateTime.Today.Year); strDExpDt = lblExpon.Text; msgbody = "