示例#1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Plant   pl        = new Plant();
            string  category  = txtCategory.Text;
            string  name      = txtName.Text;
            decimal optambtem = decimal.Parse(txtOptAmbTemp.Text);
            decimal optambhum = decimal.Parse(txtOptAmbHum.Text);
            string  optamblig = txtOptAmbLig.Text;
            decimal optinttem = decimal.Parse(txtOptIntTemp.Text);
            decimal optinthum = decimal.Parse(txtOptIntHum.Text);
            string  optintlig = txtOptIntLig.Text;
            decimal optintoxy = decimal.Parse(txtOptIntOxy.Text);
            decimal optnit    = decimal.Parse(txtOptNit.Text);
            decimal optpho    = decimal.Parse(txtOptPho.Text);
            decimal optpot    = decimal.Parse(txtOptPot.Text);

            pl.insertPlant(category, name, optambtem, optambhum, optamblig, optinttem, optinthum, optintlig, optintoxy, optnit, optpho, optpot);
            DialogResult ds = MessageBox.Show("Successful", "Return to Scientific Form?", MessageBoxButtons.OK);

            if (ds == DialogResult.OK)
            {
                ScientificForm sf = new ScientificForm(userid, farmid, plotid);
                sf.Show();
                this.Hide();
            }
        }
示例#2
0
        private void btnScientific_Click(object sender, EventArgs e)
        {
            ScientificForm sf = new ScientificForm(0, 0, 0);

            sf.Show();
            this.Hide();
        }
示例#3
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            ScientificForm sf = new ScientificForm(userid, farmid, plotid);

            sf.Show();
            this.Hide();
        }
示例#4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string    username = txtUsername.Text;
            string    password = txtPassword.Text;
            User      us       = new User();
            DataTable details  = new DataTable();
            bool      allowed  = false;

            details = us.returnDetails();
            foreach (DataRow item in details.Rows)
            {
                if (item["UserName"].ToString() == username)
                {
                    if (item["UserPassword"].ToString() == password)
                    {
                        allowed = true;
                        if (allowed)
                        {
                            if (int.Parse(item["RoleID"].ToString()) == 1)
                            {
                                ScientificForm sf = new ScientificForm(int.Parse(item["UserID"].ToString()), 0, 0);
                                sf.Show();
                                this.Hide();
                            }
                            else if (int.Parse(item["RoleID"].ToString()) == 2)
                            {
                                ClientForm cf = new ClientForm(int.Parse(item["UserID"].ToString()), 0, 0);
                                cf.Show();
                                this.Hide();
                            }
                            else
                            {
                                MessageBox.Show("Invalid role. Contact support");
                            }
                        }
                        else
                        {
                            MessageBox.Show("Login credentials are incorrect");
                        }
                    }
                    else
                    {
                        allowed = false;
                    }
                }
            }
        }