private void ward_Click(object sender, EventArgs e)
        {
            ward ob = new ward();

            ob.Show();
            this.Hide();
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            connection sv = new connection();

            sv.thisConnection.Open();

            OracleDataAdapter thisAdapter = new OracleDataAdapter("SELECT * FROM ward_allocation", sv.thisConnection);

            OracleCommandBuilder thisBuilder = new OracleCommandBuilder(thisAdapter);

            DataSet thisDataSet = new DataSet();

            thisAdapter.Fill(thisDataSet, "ward_allocation");

            DataRow thisRow = thisDataSet.Tables["ward_allocation"].NewRow();

            try
            {
                thisRow["ward_no"]    = textBox1.Text;
                thisRow["total_bed"]  = "0";
                thisRow["bed_free"]   = "0";
                thisRow["empty_ward"] = "0";

                thisDataSet.Tables["ward_allocation"].Rows.Add(thisRow);

                thisAdapter.Update(thisDataSet, "ward_allocation");
                MessageBox.Show("Submitted");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            sv.thisConnection.Close();
            this.Hide();
            ward ss = new ward();

            ss.Show();
        }
Example #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            connection sv = new connection();

            sv.thisConnection.Open();

            OracleCommand thisCommand = sv.thisConnection.CreateCommand();

            thisCommand.CommandText =
                "SELECT * FROM ward_allocation where ward_no= '" + textBox3.Text + "'";

            OracleDataReader thisReader = thisCommand.ExecuteReader();

            while (thisReader.Read())
            {
                string cmd1 = thisReader["total_bed"].ToString();
                int    cc   = Convert.ToInt32(cmd1);
                string cmd2 = thisReader["bed_free"].ToString();
                int    cc2  = Convert.ToInt32(cmd2);
                int    text = Convert.ToInt32(textBox2.Text);
                result = (text - cc) + cc2;
                res    = result.ToString();
                if (cc2 != 0 || Convert.ToInt32(textBox3.Text) != 0)
                {
                    thisCommand.CommandText =
                        "update ward_allocation set  empty_ward = ward_no where ward_no= '" + textBox3.Text + "'";

                    OracleDataReader thisReader2 = thisCommand.ExecuteReader();
                }

                try
                {
                    // string filePath = thisReader["picture"].ToString();
                    // this.pb_profilepics.Image = Image.FromFile(filePath);
                }
                catch
                { MessageBox.Show("Failure"); }
            }


            // OracleCommand thisCommand = sv.thisConnection.CreateCommand();

            thisCommand.CommandText =
                "update ward_allocation set  Total_bed = '" + textBox2.Text + "', " +
                "bed_free='" + res + "' where ward_no= '" + textBox3.Text + "'";

            thisCommand.Connection  = sv.thisConnection;
            thisCommand.CommandType = CommandType.Text;

            //For Insert Data Into Oracle//
            try
            {
                thisCommand.ExecuteNonQuery();
                MessageBox.Show("Updated");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }



            sv.thisConnection.Close();
            this.Hide();
            ward ob = new ward();

            ob.Show();
        }