private void button1_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(this.textBox1.Text) || string.IsNullOrWhiteSpace(this.textBox2.Text) || string.IsNullOrWhiteSpace(richTextBox1.Text))
     {
         MessageBox.Show("Fill all the requierd field correctly", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         try
         {
             conn.Open();
             string        sqlquery = "INSERT INTO MFG_INFO(MGF_NAME,MFG_ADD,MFG_PHN) VALUES('" + textBox1.Text + "','" + richTextBox1.Text + "','" + textBox2.Text + "')";
             OracleCommand cmd      = new OracleCommand(sqlquery, conn);
             int           i        = cmd.ExecuteNonQuery();
             if (i > 0)
             {
                 cmd.Dispose();
                 this.Hide();
                 adminControls adc = new adminControls();
                 adc.Show();
             }
         }
         catch (Exception exe)
         {
             MessageBox.Show(exe.Message);
         }
     }
 }
        private void AddMgf_FormClosing(object sender, FormClosingEventArgs e)
        {
            adminControls adm = new adminControls();

            adm.Show();
            this.Hide();
        }
 private void button1_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(this.textBox1.Text) || string.IsNullOrWhiteSpace(this.textBox2.Text) || string.IsNullOrWhiteSpace(richTextBox1.Text))
     {
         MessageBox.Show("Fill all the requierd field correctly", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         try
         {
             conn.Open();
             string sqlquery = "INSERT INTO MFG_INFO(MGF_NAME,MFG_ADD,MFG_PHN) VALUES('" + textBox1.Text + "','" + richTextBox1.Text + "','" + textBox2.Text + "')";
             OracleCommand cmd = new OracleCommand(sqlquery,conn);
             int i = cmd.ExecuteNonQuery();
             if (i > 0)
             {
                 cmd.Dispose();
                 this.Hide();
                 adminControls adc = new adminControls();
                 adc.Show();
             }
         }
         catch (Exception exe)
         {
             MessageBox.Show(exe.Message);
         }
     }
 }
Beispiel #4
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();
        }
Beispiel #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                if (comboBox2.SelectedIndex == -1 || string.IsNullOrWhiteSpace(this.textBox8.Text) || string.IsNullOrWhiteSpace(this.textBox9.Text) || string.IsNullOrWhiteSpace(this.textBox10.Text) || string.IsNullOrWhiteSpace(this.textBox11.Text))
                {
                    MessageBox.Show("请填完所有信息", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    if (textBox10.Text != textBox11.Text)
                    {
                        MessageBox.Show("两次输入密码不一致", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        position = comboBox2.GetItemText(this.comboBox2.SelectedItem);
                        salary   = textBox8.Text;
                        unm      = textBox9.Text;
                        pass     = textBox10.Text;
                        conn.Open();
                        OracleParameter parm = new OracleParameter();
                        parm.OracleDbType = OracleDbType.Blob;
                        parm.Value        = imageBt;
                        OracleCommand cmd = new OracleCommand("INSERT INTO EMPLOYE_INFO(EMP_NAME,DOB,BLOOD,EMAIL,MOBILE,GENDER,NID,MAIL_ADD,PAR_ADD,JOIN_DATE,IMAGE,POSITION,SALARY) VALUES('" + nm + "',TO_DATE('" + dob + "', 'YYYYMMDD'), '" + bdg + "','" + eml + "','" + mbn + "','" + radio_value + "','" + nid + "','" + madd + "','" + padd + "',TO_DATE('" + jod + "', 'YYYYMMDD'),:1,'" + position + "','" + salary + "')", conn);

                        cmd.Parameters.Add(parm);


                        cmd.ExecuteNonQuery();
                        //   if (ni > 0)
                        //  {
                        //       MessageBox.Show("Information Uploaded...");
                        //   }
                        // cmd.Dispose();


                        if (position == "Manager")
                        {
                            cmd = new OracleCommand("INSERT INTO MANAGER_LOGIN(E_ID,U_NAME,PASSWORD) VALUES((SELECT MAX(EMP_ID) FROM EMPLOYE_INFO),'" + unm + "','" + pass + "')", conn);
                            int i = cmd.ExecuteNonQuery();
                            if (i > 0)
                            {
                                MessageBox.Show("信息已更新");
                            }
                        }
                        else
                        {
                            cmd = new OracleCommand("INSERT INTO STUFF_LOGIN(E_ID,U_NAME,PASSWORD) VALUES((SELECT MAX(EMP_ID) FROM EMPLOYE_INFO),'" + unm + "','" + pass + "')", conn);
                            int i = cmd.ExecuteNonQuery();
                            if (i > 0)
                            {
                                MessageBox.Show("信息已更新");
                                adminControls ad = new adminControls();
                                this.Hide();
                                ad.Show();
                            }
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
            conn.Close();
        }
Beispiel #7
0
        private void Store_FormClosing(object sender, FormClosingEventArgs e)
        {
            adminControls adm = new adminControls();

            adm.Show();
        }
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                if (comboBox2.SelectedIndex == -1 || string.IsNullOrWhiteSpace(this.textBox8.Text) || string.IsNullOrWhiteSpace(this.textBox9.Text) || string.IsNullOrWhiteSpace(this.textBox10.Text) || string.IsNullOrWhiteSpace(this.textBox11.Text))
                {
                    MessageBox.Show("Fill all the requierd field correctly", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    if (textBox10.Text != textBox11.Text)
                    {
                        MessageBox.Show("Password does not match..", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        position = comboBox2.GetItemText(this.comboBox2.SelectedItem);
                        salary = textBox8.Text;
                        unm = textBox9.Text;
                        pass = textBox10.Text;
                        conn.Open();
                        OracleParameter parm = new OracleParameter();
                        parm.OracleDbType = OracleDbType.Blob;
                        parm.Value = imageBt;
                        OracleCommand cmd = new OracleCommand("INSERT INTO EMPLOYE_INFO(EMP_NAME,F_NAME,M_NAME,DOB,BLOOD,EMAIL,MOBILE,GENDER,NID,MAIL_ADD,PAR_ADD,JOIN_DATE,IMAGE,POSITION,SALARY) VALUES('" + nm + "','" + fnm + "','" + mnm + "',TO_DATE('" + dob + "', 'DD/MM/YYYY'), '" + bdg + "','" + eml + "','" + mbn + "','" + radio_value + "','" + nid + "','" + madd + "','" + padd + "',TO_DATE('" + jod + "', 'DD/MM/YYYY'),:1,'" + position + "','" + salary + "')", conn);

                        cmd.Parameters.Add(parm);

                         cmd.ExecuteNonQuery();
                     //   if (ni > 0)
                      //  {
                     //       MessageBox.Show("Information Uploaded...");
                     //   }
                        // cmd.Dispose();

                         if (position == "Manager")
                         {
                             cmd = new OracleCommand("INSERT INTO MANAGER_LOGIN(E_ID,U_NAME,PASSWORD) VALUES((SELECT MAX(EMP_ID) FROM EMPLOYE_INFO),'" + unm + "','" + pass + "')", conn);
                             int i = cmd.ExecuteNonQuery();
                             if (i > 0)
                             {
                                 MessageBox.Show("Information Uploaded...");
                             }
                         }
                         else
                         {
                             cmd = new OracleCommand("INSERT INTO STUFF_LOGIN(E_ID,U_NAME,PASSWORD) VALUES((SELECT MAX(EMP_ID) FROM EMPLOYE_INFO),'" + unm + "','" + pass + "')", conn);
                             int i = cmd.ExecuteNonQuery();
                             if (i > 0)
                             {
                                 MessageBox.Show("Information Uploaded...");
                                 adminControls ad = new adminControls();
                                 this.Hide();
                                 ad.Show();
                             }
                         }
                    }

                }

            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
            conn.Close();
        }
 private void AddMgf_FormClosing(object sender, FormClosingEventArgs e)
 {
     adminControls adm = new adminControls();
     adm.Show();
     this.Hide();
 }
        private void button2_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(this.textBox1.Text) || string.IsNullOrWhiteSpace(this.textBox2.Text) || string.IsNullOrEmpty(comboBox1.Text))
            {
                if (string.IsNullOrWhiteSpace(this.textBox1.Text))
                {
                    MessageBox.Show("Enter User Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.textBox1.Focus();
                }
               else if (string.IsNullOrWhiteSpace(this.textBox2.Text))
                {
                    MessageBox.Show("Enter Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.textBox2.Focus();
                }
                else
                {
                    MessageBox.Show("Select your Status", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {

                ///////////start of admin log in//////////////////////

                if (comboBox1.SelectedIndex == 0)
                {
                    adminControls adct = new adminControls();
                    try
                    {
                        conn.Open();

                        String admin_username = textBox1.Text;
                        String pass_word = textBox2.Text;

                        OracleCommand cmd = new OracleCommand("SELECT * FROM ADMIN WHERE ADMIN_USERNAME='******'", conn);

                        OracleDataReader r = cmd.ExecuteReader();
                        if (r.HasRows)
                        {

                            cmd = new OracleCommand("SELECT PASSWORD FROM ADMIN WHERE ADMIN_USERNAME='******'", conn);
                            r = cmd.ExecuteReader();
                            r.Read();

                            if (r.GetValue(0).ToString() == pass_word)
                            {
                                LoginName.name = textBox1.Text;
                                adct.Show();
                                this.Hide();

                            }

                        }
                        else
                        {
                            MessageBox.Show("Invalid User Name Or Password", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            textBox2.Focus();

                        }
                        r.Close();
                        conn.Close();

                    }

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

                }

                ///////////End of admin log in//////////////////////

                ///////////start of manager log in//////////////////////

                if (comboBox1.SelectedIndex == 1)
                {
                    managerControls mnct = new managerControls();

                    try
                    {
                        conn.Open();
                       // String admin_username = textBox1.Text;
                       // String pass_word = textBox2.Text;

                        OracleCommand cmd = new OracleCommand("SELECT * FROM MANAGER_LOGIN WHERE U_NAME='" + textBox1.Text + "'", conn);
                        OracleDataReader r = cmd.ExecuteReader();
                        if (r.HasRows)
                        {

                            // MessageBox.Show();
                            cmd = new OracleCommand("SELECT PASSWORD FROM MANAGER_LOGIN WHERE U_NAME='" + textBox1.Text + "'", conn);
                            r = cmd.ExecuteReader();
                            r.Read();
                             // MessageBox.Show(r.GetString(0));
                            if (r.GetValue(0).ToString() == textBox2.Text)
                            {

                                //  MessageBox.Show("wELCOM");
                                LoginName.name = textBox1.Text;
                                mnct.Show();
                                this.Hide();

                            }

                        }
                        else
                        {
                            MessageBox.Show("Invalid User Name Or Password", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        r.Close();
                        conn.Close();

                    }

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

                }

                ///////////End of manager log in//////////////////////

                //////////start of stuff log in/////////////////////

                if (comboBox1.SelectedIndex == 2)
                {
                    stuffControls stct = new stuffControls();

                    try
                    {
                        conn.Open();
                        // String admin_username = textBox1.Text;
                        // String pass_word = textBox2.Text;

                        OracleCommand cmd = new OracleCommand("SELECT * FROM STUFF_LOGIN WHERE U_NAME='" + textBox1.Text + "'", conn);
                        OracleDataReader r = cmd.ExecuteReader();
                        if (r.HasRows)
                        {

                            // MessageBox.Show();
                            cmd = new OracleCommand("SELECT PASSWORD FROM STUFF_LOGIN WHERE U_NAME='" + textBox1.Text + "'", conn);
                            r = cmd.ExecuteReader();
                            r.Read();
                            // MessageBox.Show(r.GetString(0));
                            if (r.GetValue(0).ToString() == textBox2.Text)
                            {

                                //  MessageBox.Show("wELCOM");
                                LoginName.name = textBox1.Text;
                                stct.Show();
                                this.Hide();

                            }

                        }
                        else
                        {
                            MessageBox.Show("Invalid User Name Or Password", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        r.Close();
                        conn.Close();

                    }

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

                }

                ///////////End of stuff log in//////////////////////
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(this.textBox1.Text) || string.IsNullOrWhiteSpace(this.textBox2.Text) || string.IsNullOrEmpty(comboBox1.Text))
            {
                if (string.IsNullOrWhiteSpace(this.textBox1.Text))
                {
                    MessageBox.Show("Enter User Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.textBox1.Focus();
                }
                else if (string.IsNullOrWhiteSpace(this.textBox2.Text))
                {
                    MessageBox.Show("Enter Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.textBox2.Focus();
                }
                else
                {
                    MessageBox.Show("Select your Status", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                ///////////start of admin log in//////////////////////


                if (comboBox1.SelectedIndex == 0)
                {
                    adminControls adct = new adminControls();
                    try
                    {
                        conn.Open();


                        String admin_username = textBox1.Text;
                        String pass_word      = textBox2.Text;

                        OracleCommand cmd = new OracleCommand("SELECT * FROM ADMIN WHERE ADMIN_USERNAME='******'", conn);


                        OracleDataReader r = cmd.ExecuteReader();
                        if (r.HasRows)
                        {
                            cmd = new OracleCommand("SELECT PASSWORD FROM ADMIN WHERE ADMIN_USERNAME='******'", conn);
                            r   = cmd.ExecuteReader();
                            r.Read();

                            if (r.GetValue(0).ToString() == pass_word)
                            {
                                LoginName.name = textBox1.Text;
                                adct.Show();
                                this.Hide();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Invalid User Name Or Password", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            textBox2.Focus();
                        }
                        r.Close();
                        conn.Close();
                    }

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

                ///////////End of admin log in//////////////////////



                ///////////start of manager log in//////////////////////


                if (comboBox1.SelectedIndex == 1)
                {
                    managerControls mnct = new managerControls();

                    try
                    {
                        conn.Open();
                        // String admin_username = textBox1.Text;
                        // String pass_word = textBox2.Text;

                        OracleCommand    cmd = new OracleCommand("SELECT * FROM MANAGER_LOGIN WHERE U_NAME='" + textBox1.Text + "'", conn);
                        OracleDataReader r   = cmd.ExecuteReader();
                        if (r.HasRows)
                        {
                            // MessageBox.Show();
                            cmd = new OracleCommand("SELECT PASSWORD FROM MANAGER_LOGIN WHERE U_NAME='" + textBox1.Text + "'", conn);
                            r   = cmd.ExecuteReader();
                            r.Read();
                            // MessageBox.Show(r.GetString(0));
                            if (r.GetValue(0).ToString() == textBox2.Text)
                            {
                                //  MessageBox.Show("wELCOM");
                                LoginName.name = textBox1.Text;
                                mnct.Show();
                                this.Hide();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Invalid User Name Or Password", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        r.Close();
                        conn.Close();
                    }

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

                ///////////End of manager log in//////////////////////

                //////////start of stuff log in/////////////////////

                if (comboBox1.SelectedIndex == 2)
                {
                    stuffControls stct = new stuffControls();

                    try
                    {
                        conn.Open();
                        // String admin_username = textBox1.Text;
                        // String pass_word = textBox2.Text;

                        OracleCommand    cmd = new OracleCommand("SELECT * FROM STUFF_LOGIN WHERE U_NAME='" + textBox1.Text + "'", conn);
                        OracleDataReader r   = cmd.ExecuteReader();
                        if (r.HasRows)
                        {
                            // MessageBox.Show();
                            cmd = new OracleCommand("SELECT PASSWORD FROM STUFF_LOGIN WHERE U_NAME='" + textBox1.Text + "'", conn);
                            r   = cmd.ExecuteReader();
                            r.Read();
                            // MessageBox.Show(r.GetString(0));
                            if (r.GetValue(0).ToString() == textBox2.Text)
                            {
                                //  MessageBox.Show("wELCOM");
                                LoginName.name = textBox1.Text;
                                stct.Show();
                                this.Hide();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Invalid User Name Or Password", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        r.Close();
                        conn.Close();
                    }

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

                ///////////End of stuff log in//////////////////////
            }
        }