コード例 #1
0
        private void closebutton_Click(object sender, EventArgs e)
        {
            main_window mra = (main_window)this.Owner;

            mra.Enabled         = true;
            closebutton.Enabled = false;
            this.Close();
        }
コード例 #2
0
        private void bunifuFlatButton2_Click(object sender, EventArgs e)
        {
            main_window am = (main_window)this.Owner;

            this.WindowState = FormWindowState.Minimized;

            am.bunifuFlatButton2_Click(sender, e);
        }
コード例 #3
0
ファイル: newitem_window.cs プロジェクト: isuru21524/pharmacy
        public void closeform()
        {
            main_window mra = (main_window)this.Owner;

            mra.Enabled         = true;
            closebutton.Enabled = false;
            this.Close();
        }
コード例 #4
0
        private void bunifuImageButton1_Click(object sender, EventArgs e)
        {
            main_window cc = (main_window)this.Owner;

            cc.Enabled          = true;
            closebutton.Enabled = false;
            this.Close();
        }
コード例 #5
0
ファイル: stockform.cs プロジェクト: isuru21524/pharmacy
        private void closebutton_Click(object sender, EventArgs e)
        {
            try
            {
                main_window mw = (main_window)this.Owner;
                mw.Enabled = true;

                closebutton.Enabled = false;
                this.Close();
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #6
0
ファイル: newitem_window.cs プロジェクト: isuru21524/pharmacy
        public void closebutton_Click(object sender, EventArgs e)
        {
            yesnofrm de;

            if (dataGridView1.Rows.Count == 0)
            {
                main_window mra = (main_window)this.Owner;

                mra.Enabled         = true;
                closebutton.Enabled = false;
                this.Close();
            }
            else
            {
                de       = new yesnofrm(4);
                de.Owner = this;

                de.warningtext = "Do you want to save list before leaving?";
                de.Show();
                this.Enabled = false;
            }
        }
コード例 #7
0
        //yess butttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt
        public void yesbutton_Click(object sender, EventArgs e)
        {
            if (y == 1)
            {
                //main frame close
                try
                {
                    main_window frm = (main_window)this.Owner;


                    yesbutton.Enabled = false;
                    frm.Close();

                    this.Close();
                    login_window abc = new login_window();


                    abc.Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }

            else if (n == 2)
            {
                //setting page save
                try
                {
                    dbconnection xy = new dbconnection();

                    main_window arm = (main_window)this.Owner;

                    string query3 = "select * from useraccounts where usernames='" + susername + "';";
                    string query4 = "select * from useraccounts where password='******' and userid='" + uid + "';";

                    //get old user namesis
                    xy.openconnection();
                    xy.command(query3);
                    bool olduseris = false;
                    while (xy.readdata().Read())
                    {
                        olduseris = true;
                    }
                    xy.closeconnection();


                    //get old password
                    xy.openconnection();
                    xy.command(query4);
                    bool oldpasis = false;
                    while (xy.readdata().Read())
                    {
                        oldpasis = true;
                    }
                    xy.closeconnection();



                    //use old user name......................................
                    if (susername == olduname)
                    {
                        if ((oldpasis == true) && (snewpas != soldpas) && (snewpas == srenewpad) && (snewpas != ""))
                        {
                            //write correct cod

                            string query5 = "update useraccounts set usernames='" + susername + "',password='******' where userid='" + uid + "';";

                            xy.openconnection();
                            xy.command(query5).ExecuteNonQuery();
                            xy.closeconnection();

                            MessageBox.Show("The Changing setting is succesfull");
                            arm.Enabled       = true;
                            yesbutton.Enabled = false;
                            this.Close();
                        }
                        else if ((oldpasis == true) && (snewpas != soldpas) && (snewpas != srenewpad))
                        {
                            MessageBox.Show("The new passwords are not matching!!! Type them correctly");
                            arm.Enabled       = true;
                            yesbutton.Enabled = false;
                            this.Close();
                        }
                        else if ((oldpasis == true) && (soldpas != snewpas) && ((snewpas == "") || (srenewpad) == ""))
                        {
                            MessageBox.Show("You cannot keep Blank password fields");
                            arm.Enabled       = true;
                            yesbutton.Enabled = false;
                            this.Close();
                        }
                        else if (oldpasis == false)
                        {
                            MessageBox.Show("The old Password is wrong!!!");
                            arm.Enabled       = true;
                            yesbutton.Enabled = false;
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("Fill the Fields Correctly");
                            arm.Enabled       = true;
                            yesbutton.Enabled = false;
                            this.Close();
                        }
                    }

                    else if (susername != olduname)
                    {
                        if (olduseris == false)
                        {
                            if ((oldpasis == true) && (snewpas != soldpas) && (snewpas == srenewpad) && (snewpas != ""))
                            {
                                //write correct code
                                string query5 = "update useraccounts set usernames='" + susername + "',password='******' where userid='" + uid + "';";

                                xy.openconnection();
                                xy.command(query5).ExecuteNonQuery();
                                xy.closeconnection();

                                MessageBox.Show("The Changing setting is succesfull");
                                arm.Enabled       = true;
                                yesbutton.Enabled = false;
                                this.Close();
                            }
                            else if ((oldpasis == true) && (snewpas == "") && (srenewpad == ""))
                            {
                                string query7 = "update useraccounts set usernames='" + susername + "' where userid='" + uid + "';";
                                xy.openconnection();
                                xy.command(query7).ExecuteNonQuery();
                                xy.closeconnection();

                                MessageBox.Show("UserName Changing is successfull");
                                arm.Enabled       = true;
                                yesbutton.Enabled = false;
                                this.Close();
                            }
                            else if ((oldpasis == true) && (snewpas != soldpas) && (snewpas != srenewpad))
                            {
                                MessageBox.Show("The new passwords are not matching!!! Type them correctly");
                                arm.Enabled       = true;
                                yesbutton.Enabled = false;
                                this.Close();
                            }
                            else if ((oldpasis == true) && (soldpas != snewpas) && ((snewpas == "") || (srenewpad) == ""))
                            {
                                MessageBox.Show("You cannot keep Blank password fields");
                                arm.Enabled       = true;
                                yesbutton.Enabled = false;
                                this.Close();
                            }
                            else if (oldpasis == false)
                            {
                                MessageBox.Show("The old Password is wrong!!!");
                                arm.Enabled       = true;
                                yesbutton.Enabled = false;
                                this.Close();
                            }
                            else
                            {
                                MessageBox.Show("Fill the Fields Correctly");
                                arm.Enabled       = true;
                                yesbutton.Enabled = false;
                                this.Close();
                            }
                        }
                        else
                        {
                            MessageBox.Show("The UserName that  you enterd is available. Type another user name");
                            arm.Enabled       = true;
                            yesbutton.Enabled = false;
                            this.Close();
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            else if (y == 3)
            {
                try
                {
                    newitem_window ab = (newitem_window)this.Owner;
                    ab.Enabled = true;
                    ab.savedetails();
                    yesbutton.Enabled = false;
                    ab.cleardata();
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }

            else if (y == 4)
            {
                try
                {
                    newitem_window frm = (newitem_window)this.Owner;
                    yesbutton.Enabled = false;
                    frm.savedetails();

                    frm.Enabled = true;
                    frm.closeform();
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            else if (y == 5)
            {
                try
                {
                    main_window ff = (main_window)this.Owner;
                    yesbutton.Enabled = false;
                    ff.bunifuThinButton23_Click(sender, e);
                    ff.Enabled = true;
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }

            else if (y == 6)
            {
                try
                {
                    main_window gg = (main_window)this.Owner;
                    yesbutton.Enabled = false;

                    gg.Enabled = true;
                    gg.useraccountsave();
                    this.Close();
                }
                catch (Exception)
                {
                    throw;
                }
            }

            else if (y == 7)
            {
                newuserform gb = (newuserform)this.Owner;
                yesbutton.Enabled = false;

                gb.Enabled = true;
                gb.savedata();
                this.Close();
            }

            else if (y == 8)
            {
                supplier_payment_form gb = (supplier_payment_form)this.Owner;
                yesbutton.Enabled = false;

                gb.Enabled = true;
                gb.bunifuThinButton21_Click(sender, e);
                gb.combo_choose_supplier_SelectedIndexChanged(sender, e);
                this.Close();
            }

            else if (y == 9)
            {
                supplier_payment_form gb = (supplier_payment_form)this.Owner;
                yesbutton.Enabled = false;

                gb.Enabled = true;
                gb.recorrectionz();
                gb.combo_choose_supplier_SelectedIndexChanged(sender, e);
                this.Close();
            }

            else if (y == 10)
            {
                salarypayment_window gb = (salarypayment_window)this.Owner;
                yesbutton.Enabled = false;

                gb.Enabled = true;
                gb.recorrectz();
                gb.combo_add_name_SelectedIndexChanged(sender, e);
                this.Close();
            }
        }
コード例 #8
0
//nobuttonnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
        public void nobutton_Click(object sender, EventArgs e)
        {
            try
            {
                if (y == 1)
                {
                    main_window frm = (main_window)this.Owner;
                    frm.Enabled      = true;
                    nobutton.Enabled = false;
                    this.Close();
                }
                else if (n == 2)
                {
                    main_window arm = (main_window)this.Owner;
                    arm.Enabled      = true;
                    nobutton.Enabled = false;
                    this.Close();
                }
                else if (y == 3)
                {
                    newitem_window ab = (newitem_window)this.Owner;
                    ab.Enabled       = true;
                    nobutton.Enabled = false;
                    this.Close();
                }
                else if (y == 4)
                {
                    newitem_window ab = (newitem_window)this.Owner;
                    ab.Enabled = true;
                    ab.closeform();
                    nobutton.Enabled = false;
                    this.Close();
                }
                else if (y == 5)
                {
                    main_window ff = (main_window)this.Owner;
                    ff.Enabled       = true;
                    nobutton.Enabled = false;
                    this.Close();
                }
                else if (y == 6)
                {
                    main_window gg = (main_window)this.Owner;
                    gg.Enabled       = true;
                    nobutton.Enabled = false;
                    this.Close();
                }
                else if (y == 7)
                {
                    newuserform gb = (newuserform)this.Owner;
                    gb.Enabled       = true;
                    nobutton.Enabled = false;
                    this.Close();
                }
                else if (y == 8)
                {
                    supplier_payment_form gb = (supplier_payment_form)this.Owner;
                    gb.Enabled       = true;
                    nobutton.Enabled = false;
                    this.Close();
                }

                else if (y == 9)
                {
                    supplier_payment_form gb = (supplier_payment_form)this.Owner;
                    gb.Enabled       = true;
                    nobutton.Enabled = false;
                    this.Close();
                }

                else if (y == 10)
                {
                    salarypayment_window gb = (salarypayment_window)this.Owner;
                    gb.Enabled       = true;
                    nobutton.Enabled = false;
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
コード例 #9
0
ファイル: login_window.cs プロジェクト: isuru21524/pharmacy
        private void bunifuFlatButton6_Click(object sender, EventArgs e)


        {
            dbconnection ob = new dbconnection();

            try
            {
                string username = login_username_tbox.Text;
                string password = login_password_tbox.Text;

                string query = "select * from useraccounts where usernames='" + username + "' and password='******';";


                ob.openconnection();
                ob.command(query);


                bool correct = false;

                int    uid       = 0;
                string type      = "";
                string firstname = "";
                while (ob.readdata().Read())
                {
                    correct = true;

                    uid       = ob.readdata().GetInt32("userid");
                    type      = ob.readdata().GetString("type");
                    firstname = ob.readdata().GetString("firstname");
                }


                if (correct == true)
                {
                    if (type == "MainAdmin")
                    {
                        main_window ab = new main_window(uid, type, firstname);

                        ab.Show();
                        this.Hide();
                        bc.Hide();
                    }
                    else if (type == "Admin")
                    {
                        main_window ab = new main_window(uid, type, firstname);

                        ab.Show();
                        this.Hide();
                        bc.Hide();
                    }
                    else if (type == "User")
                    {
                        main_window ab = new main_window(uid, type, firstname);

                        ab.Show();
                        this.Hide();
                        bc.Hide();
                    }
                }
                else
                {
                    MessageBox.Show("invalid user name or password, type again correctly");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            ob.closeconnection();
        }