Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(this.textBox1.Text) || string.IsNullOrWhiteSpace(this.textBox2.Text) || string.IsNullOrWhiteSpace(this.textBox3.Text) || string.IsNullOrWhiteSpace(this.textBox5.Text) || string.IsNullOrWhiteSpace(this.textBox5.Text) || string.IsNullOrWhiteSpace(this.textBox6.Text) || string.IsNullOrWhiteSpace(this.richTextBox1.Text))
            {
                MessageBox.Show("Fill all the requierd field correctly", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                try
                {
                    string mgf   = comboBox1.GetItemText(this.comboBox1.SelectedItem);
                    string grp   = comboBox1.GetItemText(this.comboBox1.SelectedItem);
                    string mtype = comboBox3.GetItemText(this.comboBox3.SelectedItem);
                    conn.Open();
                    string        sqlq = "UPDATE MED_INFO SET MED_NAME='" + textBox1.Text + "',MED_STG='" + textBox6.Text + "',MED_MGF='" + mgf + "',MED_BATCH='" + textBox3.Text + "',MED_GROUP='" + grp + "',MED_TYPE='" + mtype + "',COST_PRICE='" + textBox4.Text + "',SELL_PRICE='" + textBox2.Text + "',NOTES='" + richTextBox1.Text + "' WHERE MED_ID='" + nid + "'";
                    OracleCommand cmd  = new OracleCommand(sqlq, conn);
                    int           i    = cmd.ExecuteNonQuery();

                    if (i > 0)
                    {
                        //MessageBox.Show("Information Uploaded...");

                        cmd.Dispose();
                        conn.Close();
                        this.Hide();
                        MedInfoView miv = new MedInfoView(nid);
                        miv.Show();
                    }
                }
                catch (Exception exc)
                {
                    MessageBox.Show(exc.Message);
                }
            }
        }
Ejemplo n.º 2
0
 private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     string pid=null;
     if(e.RowIndex>=0)
     {
         DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex];
         pid = row.Cells["ID"].Value.ToString();
     }
     MedInfoView miv = new MedInfoView(pid);
     miv.ShowDialog();
 }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string mgfnm = comboBox1.GetItemText(this.comboBox1.SelectedItem);
            string grp   = comboBox2.GetItemText(this.comboBox2.SelectedItem);
            string mtype = comboBox3.GetItemText(this.comboBox3.SelectedItem);
            string nid   = MedIDgen.IdGenrator(mgfnm);
            string mnm   = textBox1.Text;
            string mbt   = textBox3.Text;
            string mcp   = textBox4.Text;
            string msp   = textBox2.Text;
            string mnt   = richTextBox1.Text;
            string stg   = textBox6.Text;

            conn.Open();
            try
            {
                OracleCommand cmd = new OracleCommand("INSERT INTO MED_INFO(MED_ID,MED_NAME,MED_STG,MED_MGF,MED_BATCH,MED_GROUP,MED_TYPE,COST_PRICE,SELL_PRICE,NOTES) VALUES('" + nid + "','" + mnm + "','" + stg + "','" + mgfnm + "','" + mbt + "','" + grp + "','" + mtype + "','" + mcp + "','" + msp + "','" + mnt + "')", conn);
                int           i   = cmd.ExecuteNonQuery();
                if (i > 0)
                {
                    MessageBox.Show("DONE");

                    cmd.Dispose();
                    this.Hide();
                }
            }
            catch (Exception exe) {
                MessageBox.Show(exe.Message);
            }


            try
            {
                OracleCommand cmd = new OracleCommand("INSERT INTO MED_STORE(MED_ID,MED_NAME,MED_QNTY,DAM_QNTY,RE_LEVEL) VALUES('" + nid + "','" + mnm + "','" + 0 + "','" + 0 + "','" + 0 + "')", conn);
                int           j   = cmd.ExecuteNonQuery();
                if (j > 0)
                {
                    cmd.Dispose();
                    this.Hide();


                    adminControls adm = new adminControls();
                    adm.Show();
                    MedInfoView miv = new MedInfoView(nid);
                    miv.Show();
                }
            }
            catch (Exception exe)
            {
                MessageBox.Show(exe.Message);
            }

            conn.Close();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string mgfnm = comboBox1.GetItemText(this.comboBox1.SelectedItem);
            string grp = comboBox2.GetItemText(this.comboBox2.SelectedItem);
            string mtype = comboBox3.GetItemText(this.comboBox3.SelectedItem);
            string nid = MedIDgen.IdGenrator(mgfnm);
            string mnm = textBox1.Text;
            string mbt = textBox3.Text;
            string mcp = textBox4.Text;
            string msp = textBox2.Text;
            string mnt = richTextBox1.Text;
            string stg = textBox6.Text;
            conn.Open();
            try
            {

                OracleCommand cmd = new OracleCommand("INSERT INTO MED_INFO(MED_ID,MED_NAME,MED_STG,MED_MGF,MED_BATCH,MED_GROUP,MED_TYPE,COST_PRICE,SELL_PRICE,NOTES) VALUES('" + nid + "','" + mnm + "','"+stg+"','" + mgfnm + "','" + mbt + "','" + grp + "','" + mtype + "','" + mcp + "','" + msp + "','" + mnt + "')", conn);
                int i = cmd.ExecuteNonQuery();
                if (i > 0)
                {
                    MessageBox.Show("DONE");

                    cmd.Dispose();
                    this.Hide();
                }
            }
            catch(Exception exe){
                MessageBox.Show(exe.Message);
            }

            try
            {

                OracleCommand cmd = new OracleCommand("INSERT INTO MED_STORE(MED_ID,MED_NAME,MED_QNTY,DAM_QNTY,RE_LEVEL) VALUES('" + nid + "','" + mnm + "','" + 0 + "','" + 0 + "','" + 0 + "')", conn);
                int j = cmd.ExecuteNonQuery();
                if (j > 0)
                {
                    cmd.Dispose();
                    this.Hide();

                    adminControls adm = new adminControls();
                    adm.Show();
                    MedInfoView miv = new MedInfoView(nid);
                    miv.Show();
                }
            }
            catch (Exception exe)
            {
                MessageBox.Show(exe.Message);
            }

            conn.Close();
        }
Ejemplo n.º 5
0
        private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            string pid = null;

            if (e.RowIndex >= 0)
            {
                DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex];
                pid = row.Cells["ID"].Value.ToString();
            }
            MedInfoView miv = new MedInfoView(pid);

            miv.ShowDialog();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(this.textBox1.Text) || string.IsNullOrWhiteSpace(this.textBox2.Text) || string.IsNullOrWhiteSpace(this.textBox3.Text) || string.IsNullOrWhiteSpace(this.textBox5.Text) || string.IsNullOrWhiteSpace(this.textBox5.Text) || string.IsNullOrWhiteSpace(this.textBox6.Text) || string.IsNullOrWhiteSpace(this.richTextBox1.Text))
            {
                MessageBox.Show("Fill all the requierd field correctly", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {

                try
                {
                    string mgf = comboBox1.GetItemText(this.comboBox1.SelectedItem);
                    string grp = comboBox1.GetItemText(this.comboBox1.SelectedItem);
                    string mtype = comboBox3.GetItemText(this.comboBox3.SelectedItem);
                    conn.Open();
                    string sqlq = "UPDATE MED_INFO SET MED_NAME='" + textBox1.Text + "',MED_STG='" + textBox6.Text + "',MED_MGF='" + mgf + "',MED_BATCH='" + textBox3.Text + "',MED_GROUP='" + grp + "',MED_TYPE='" + mtype + "',COST_PRICE='" + textBox4.Text + "',SELL_PRICE='" + textBox2.Text + "',NOTES='" + richTextBox1.Text + "' WHERE MED_ID='" + nid + "'";
                    OracleCommand cmd = new OracleCommand(sqlq, conn);
                    int i= cmd.ExecuteNonQuery();

                    if (i > 0)
                    {
                        //MessageBox.Show("Information Uploaded...");

                        cmd.Dispose();
                        conn.Close();
                        this.Hide();
                        MedInfoView miv = new MedInfoView(nid);
                        miv.Show();
                    }

                }
                catch (Exception exc)
                {
                    MessageBox.Show(exc.Message);
                }
            }
        }