コード例 #1
0
        public void populateDataGridview(MySqlCommand command)
        {
            // change the datagridview row height
            dataGridView1.RowTemplate.Height = 40;

            // populate the datagridview
            CrudOperation func = new CrudOperation();

            dataGridView1.DataSource = func.getData(command);

            // display properties count
            labelCount.Text = "[ " + func.getData(command).Rows.Count + " ] Properties";

            // clear the selection form the datagridview
            dataGridView1.ClearSelection();
        }
コード例 #2
0
        private void btnlogin_Click(object sender, EventArgs e)
        {
            string username = txtUsername.Text;
            string password = txtPassword.Text;

            //  CrudOperation myObj = new CrudOperation();
            Classes.CrudOperation myobj = new CrudOperation();


            if (checkFields())
            {
                MySqlCommand command = new MySqlCommand("SELECT * FROM `users` WHERE `username`=@un AND password=@pass");
                command.Parameters.Add("@un", MySqlDbType.VarChar).Value   = username;
                command.Parameters.Add("@pass", MySqlDbType.VarChar).Value = password;
                DataTable table = myobj.getData(command);

                if (table.Rows.Count > 0)
                {
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    lblinvaliddetails.Visible = true;
                    Authenticated             = false;
                }
            }
        }
コード例 #3
0
        // get all properties


        // get property by id
        public DataTable getPropertyById(int id)
        {
            MySqlCommand command = new MySqlCommand("SELECT * FROM `the_property` WHERE `id`=@id");

            command.Parameters.Add("@id", MySqlDbType.Int32).Value = id;
            return(func.getData(command));
        }
コード例 #4
0
        // create a function to populate the datagridview
        public void populateDatagridview(DataGridView dgv, string query)
        {
            MySqlCommand command = new MySqlCommand(query);

            dgv.DataSource = func.getData(command);
        }
コード例 #5
0
        // get all types
        public DataTable getAllTypes()
        {
            MySqlCommand command = new MySqlCommand("SELECT * FROM `property_type`");

            return(func.getData(command));
        }
コード例 #6
0
        // get all sales
        public DataTable getSales()
        {
            MySqlCommand command = new MySqlCommand("SELECT `id`, `property_id` as 'Property', `selling_price` as 'Price', `sale_date` as 'Date' FROM `sale`");

            return(func.getData(command));
        }