Hi all, After filling the form when i am clicking on submit button...nothing is happening i mean no events are performed. Pls help me... here is my code.. PatientProperty.cs
public class PatientProperty
{
private string Pdisease;
private string Pname;
private string Pcategory;
private string Paddr;
private DateTime Dateofjoining;
private int Page;
public string PNAME
{
get
{
return Pname;
}
set
{
Pname = value;
}
}
public string PADDRESS
{
get
{
return Paddr;
}
set
{
Paddr = value;
}
}
public int PAGE
{
get
{
return Page;
}
set
{
Page = value;
}
}
public string PDISEASE
{
get
{
return Pdisease;
}
set
{
Pdisease = value;
}
}
public string PCATEGORY
{
get
{
return Pcategory;
}
set
{
Pcategory = value;
}
}
public DateTime DATEOFJOINING
{
get
{
return Dateofjoining;
}
set
{
Dateofjoining = value;
}
}
}
PatientRegistration.cs
public class PatientRegistration
{
string str = ConfigurationManager.ConnectionStrings["HealthCare"].ConnectionString.ToString();
public void InsertPatient(PatientProperty obj)
{
using (var con = new SqlConnection(str))
{
using (var com = new SqlCommand("PatientRegister", con))
{
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue("Pname", obj.PNAME);
com.Parameters.AddWithValue("Paddr", obj.PADDRESS);
com.Parameters.AddWithValue("Page", obj.PAGE);
com.Parameters.AddWithValue("Pdisease", obj.PDISEASE);
com.Parameters.AddWithValue("Pcategory", obj.PCATEGORY);
com.Parameters.AddWithValue("Dateofjoining", obj.DATEOFJOINING); con.Open();
com.ExecuteNonQuery();
con.Close();
}
}
}
}
PatientRegistrationBussiness.cs
public class PatientRegistrationBussiness
{
public void AddPatient(PatientProperty obj)
{
PatientRegistration PR = new PatientRegistration();
PR.InsertPatient(obj);
}
}
protected void Button1_Click(object sender, System.EventArgs e)
{
string name = TextBox2.Text;
string address = TextBox3.Text;
string category = RadioButtonList1.Text;
int age =Convert.ToInt32(TextBox4.Text);
string disease = TextBox5.Text;
DateTime date =Convert.ToDateTime(TextBox6.Text);
PatientRegistrationBussiness obj = new PatientRegistrationBussiness();
try
{
PatientProperty PP = new PatientProperty();
PP.PNAME = name;
PP.PADDRESS = address;
PP.PAGE = age;
PP.PDISEASE = disease;
PP.PCATEGORY = category.ToString();
PP.DATEOFJOINING = date;
obj.AddPatient(PP);
Response.Write("Patient details have been successfully added");
TextBox2.Text = string.Empty;
TextBox3.Text = string.Empty;
TextBox4.Text = string.Empty;
TextBox5.Text = string.Empty;
TextBox6.Text = string.Empty;
RadioButtonList1.SelectedIndex = 0;
}
catch (Exception ex)
{
ex.Message.ToString();
}
finally
{
obj = null;
}
}