Building









How do I use Building
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: PlayerBullet.cs Copy
29     void OnTriggerEnter(Collider col)
30     {
31         if (col.tag == "Building")
32         {
33             BulletIsOff();
34         }
35         else if (col.tag == "Enemy")
36         {
37             col.GetComponent().GetDamage();
38             BulletIsOff();
39         }
40     }
File name: PatientInformation.cs Copy
37         private void button1_Click(object sender, EventArgs e)
38         {
39             SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=F:\Sem.4\C# Projects\Trials\HospitalManagementSystemCSharp\HospitalManagementSystemCSharp\hospital.mdf;Integrated Security=True");
40
41             con.Open();
42             if (textBox1.Text != "")
43             {
44                 try
45                 {
46                     string getCust = "select name,gen,age,date,cont,addr,disease,status,r_type,building,r_no,price from patient where id=" + Convert.ToInt32(textBox1.Text) + " ;";
47
48                     SqlCommand cmd = new SqlCommand(getCust, con);
49                     SqlDataReader dr;
50                     dr = cmd.ExecuteReader();
51                     if (dr.Read())
52                     {
53                         textBox2.Text = dr.GetValue(0).ToString();
54                         if (dr[1].ToString() == "Male")
55                         {
56                             radioButton1.Checked = true;
57                         }
58                         else
59                         {
60                             radioButton2.Checked = true;
61                         }
62                         textBox3.Text = dr.GetValue(2).ToString();
63                         textBox4.Text = dr.GetValue(3).ToString();
64                         textBox5.Text = dr.GetValue(4).ToString();
65                         textBox6.Text = dr.GetValue(5).ToString();
66                         textBox7.Text = dr.GetValue(6).ToString();
67                         textBox8.Text = dr.GetValue(7).ToString();
68                         textBox10.Text = dr.GetValue(8).ToString();
69                         textBox9.Text = dr.GetValue(9).ToString();
70                         textBox11.Text = dr.GetValue(10).ToString();
71                         textBox12.Text = dr.GetValue(11).ToString();
72
73                     }
74                     else
75                     {
76                         MessageBox.Show(" Sorry, This ID, " + textBox1.Text + " Staff is not Available. ");
77                         textBox1.Text = "";
78                     }
79                 }
80                 catch (SqlException excep)
81                 {
82                     MessageBox.Show(excep.Message);
83                 }
84                 con.Close();
85             }
86         }
File name: PatientInformation.cs Copy
88         private void button2_Click(object sender, EventArgs e)
89         {
90             SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=F:\Sem.4\C# Projects\Trials\HospitalManagementSystemCSharp\HospitalManagementSystemCSharp\hospital.mdf;Integrated Security=True");
91             con.Open();
92             string gen = string.Empty;
93             if (radioButton1.Checked)
94             {
95                 gen = "Male";
96             }
97             else
98             {
99                 gen = "Female";
100             }
101             try
102             {
103                 string str = " Update patient set name='" + textBox2.Text + "',gen='" + gen + "',age='" + textBox3.Text + "',date='" + textBox4.Text + "',cont='" + textBox5.Text + "',addr='" + textBox6.Text + "',disease='" + textBox7.Text + "',status='" + textBox8.Text + "',r_type='" + textBox10.Text + "',building='" + textBox9.Text + "',r_no='" + textBox11.Text + "',price='" + textBox12.Text + "' where id='" + textBox1.Text + "'";
104
105                 SqlCommand cmd = new SqlCommand(str, con);
106                 cmd.ExecuteNonQuery();
107
108                 string str1 = "select max(id) from patient;";
109
110                 SqlCommand cmd1 = new SqlCommand(str1, con);
111                 SqlDataReader dr = cmd1.ExecuteReader();
112                 if (dr.Read())
113                 {
114                     MessageBox.Show("" + textBox2.Text + "'s Details is Updated Successfully.. ", "Important Message");
115                     textBox2.Text = "";
116                     textBox4.Text = "";
117                     textBox5.Text = "";
118                     textBox6.Text = "";
119                     textBox7.Text = "";
120                     using (SqlConnection con1 = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=F:\Sem.4\C# Projects\Trials\HospitalManagementSystemCSharp\HospitalManagementSystemCSharp\hospital.mdf;Integrated Security=True"))
121                     {
122
123                         string str2 = "SELECT * FROM patient";
124                         SqlCommand cmd2 = new SqlCommand(str2, con1);
125                         SqlDataAdapter da = new SqlDataAdapter(cmd2);
126                         DataTable dt = new DataTable();
127                         da.Fill(dt);
128                         dataGridView1.DataSource = new BindingSource(dt, null);
129                     }
130                 }
131             }
132             catch (SqlException excep)
133             {
134                 MessageBox.Show(excep.Message);
135             }
136             con.Close();
137         }
File name: PatientRegistration.cs Copy
21         private void button1_Click(object sender, EventArgs e)
22         {
23             SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=F:\Sem.4\C# Projects\Trials\HospitalManagementSystemCSharp\HospitalManagementSystemCSharp\hospital.mdf;Integrated Security=True");
24             con.Open();
25             string gen = string.Empty;
26             if (radioButton1.Checked)
27             {
28                 gen = "Male";
29             }
30             else
31             {
32                 gen = "Female";
33             }
34             try
35             {
36                 string str = "INSERT INTO patient(name,gen,age,date,cont,addr,disease,status,r_type,building,r_no,price) VALUES('" + textBox2.Text + "','" + gen + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "','" + textBox10.Text + "','" + textBox9.Text + "','" + textBox11.Text + "','" + textBox12.Text + "'); ";
37
38                 SqlCommand cmd = new SqlCommand(str, con);
39                 cmd.ExecuteNonQuery();
40                 string str1 = "select max(Id) from patient;";
41
42                 SqlCommand cmd1 = new SqlCommand(str1, con);
43                 SqlDataReader dr = cmd1.ExecuteReader();
44                 if (dr.Read())
45                 {
46                     MessageBox.Show("Patient Information Saved Successfully..");
47                     textBox2.Text = "";
48                     textBox3.Text = "";
49                     textBox4.Text = "";
50                     textBox5.Text = "";
51                     textBox6.Text = "";
52                     textBox7.Text = "";
53                     textBox8.Text = "";
54                     textBox9.Text = "";
55                     textBox10.Text = "";
56                     textBox11.Text = "";
57                     textBox12.Text = "";
58
59                 }
60             }
61             catch (SqlException excep)
62             {
63                 MessageBox.Show(excep.Message);
64             }
65             con.Close();
66         }
File name: RoomInfo.cs Copy
37         private void button1_Click(object sender, EventArgs e)
38         {
39             SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=F:\Sem.4\C# Projects\Trials\HospitalManagementSystemCSharp\HospitalManagementSystemCSharp\hospital.mdf;Integrated Security=True");
40             con.Open();
41
42             try
43             {
44                 string str = "INSERT INTO room(building,r_type,r_no,no_bed,price,r_status) VALUES('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "'); ";
45
46                 SqlCommand cmd = new SqlCommand(str, con);
47                 cmd.ExecuteNonQuery();
48                 string str1 = "select max(Id) from room;";
49
50                 SqlCommand cmd1 = new SqlCommand(str1, con);
51                 SqlDataReader dr = cmd1.ExecuteReader();
52                 if (dr.Read())
53                 {
54                     MessageBox.Show("room Information Saved Successfully..");
55                     textBox2.Text = "";
56                     textBox1.Text = "";
57                     textBox3.Text = "";
58                     textBox4.Text = "";
59                     textBox5.Text = "";
60                     textBox6.Text = "";
61                     using (SqlConnection con1 = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=F:\Sem.4\C# Projects\Trials\HospitalManagementSystemCSharp\HospitalManagementSystemCSharp\hospital.mdf;Integrated Security=True"))
62                     {
63
64                         string str2 = "SELECT * FROM room";
65                         SqlCommand cmd2 = new SqlCommand(str2, con1);
66                         SqlDataAdapter da = new SqlDataAdapter(cmd2);
67                         DataTable dt = new DataTable();
68                         da.Fill(dt);
69                         dataGridView1.DataSource = new BindingSource(dt, null);
70                     }
71                 }
72             }
73             catch (SqlException excep)
74             {
75                 MessageBox.Show(excep.Message);
76             }
77             con.Close();
78         }

Download file with original file name:Building

Building 107 lượt xem

Gõ tìm kiếm nhanh...