Ejemplo n.º 1
0
        private void btnlogin_Click(object sender, EventArgs e)
        {
            //validation
            if (cbousername.Text == "")
            {
                return;
            }
            else if (txtpassword.Text == "")
            {
                return;
            }
            else
            {
                bool r = validate_login(cbousername.Text, txtpassword.Text);
                if (r == true)
                {
                    frmdashboard cs = new frmdashboard();
                    //PharmSoft cs = new PharmSoft();
                    this.Hide();
                    cs.lbluser.Text  = fullname;
                    cs.lbluser2.Text = fullname;
                    cs.userid.Text   = userid;
                    cs.lblRole.Text  = role;

                    cs.Show();
                }

                else
                {
                    cbousername.SelectedIndex = -1;
                    txtpassword.Text          = "";
                }
            }
        }
        private void btnsave_Click(object sender, EventArgs e)
        {
            //insert feedback
            try
            {
                if (txtsubject.Text == "")
                {
                    MessageBox.Show("Message Subject Required!");
                    return;
                }
                else if (txtmessage.Text == "")
                {
                    MessageBox.Show("messange Required");
                    return;
                }
                MySqlConnection myconn1 = new MySqlConnection(cs.myconnection1);
                myconn1.Open();
                frmdashboard fr     = new frmdashboard();
                string       Query1 = "insert into user_feedaback(user_id,subject,message,satis_rate) values('" + userid.Text + "','" + txtsubject.Text + "','" + txtmessage.Text + "','" + rate() + "')";

                MySqlCommand    mycommand1 = new MySqlCommand(Query1, myconn1);
                MySqlDataReader myreader1;

                myreader1 = mycommand1.ExecuteReader();    //execution command


                MessageBox.Show("User FeedBack Acknowedged !");
                //reset control
                txtsubject.Text = "";
                txtmessage.Text = "";
                rdob.Checked    = false;
                rdoe.Checked    = false;
                rdog.Checked    = false;
                rdom.Checked    = false;
                rdovg.Checked   = false;
                txtsubject.Focus();
                myconn1.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex + "Error Contact admin");
            }
        }