private void viewCommentsForm_Load(object sender, EventArgs e)
        {
            contx = new zosoEntities();

            try
            {
                //Populate the roles Dropdown and get parishes
                var parish = contx.parish.ToList();

                //Populate The Grid View
                RefreshGridView();


                //manually set the text for the column headers.
                gvreports.Columns["parishName"].HeaderText = "Parish";
                gvreports.Columns["community"].HeaderText  = "Community";
                gvreports.Columns["userReport"].HeaderText = "Report";
                gvreports.Columns["reportDate"].HeaderText = "Date Reported";


                //Hide columns that you do not want to display to users
                gvreports.Columns[0].Visible = false;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void addCommentForm_Load(object sender, EventArgs e)
        {
            try
            {
                contx = new zosoEntities();

                //populate the parish dropdown list
                var parish = contx.parish.ToList();
                cboParish.DataSource    = parish;
                cboParish.DisplayMember = "parishName";
                cboParish.ValueMember   = "Id";
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        private void btnlogin_Click(object sender, EventArgs e)
        {
            var regnumber = txtregnumber.Text;
            var password  = txtpassword.Text;

            // declare object of DB model
            var contx = new zosoEntities();

            //check if true value was returned fron the user check and grant access
            //If false, then continue to restrict access
            var user = contx.users.SingleOrDefault(q => q.regNumber == regnumber && q.password == password);

            if (user != null)
            {
                var parent = (safejaMain)MdiParent;
                parent.isLoggedIn = true;
                this.Close();

                if (Application.OpenForms["viewCommentsForm"] == null)
                {
                    viewCommentsForm view = new viewCommentsForm();
                    view.Show();
                }
                else
                {
                    Application.OpenForms["viewCommentsForm"].Focus();
                }
            }
            else
            {
                MessageBox.Show("Invalid Credentials. Please try again.");
                txtregnumber.Text = "";
                txtpassword.Text  = "";
                txtregnumber.Focus();
            }
        }