Example #1
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            var userEntity = new UserEntity();

            var queryConditions = new QueryConditionsBuilder();

            if (txtTextToSearch.Text != "")
            {
                queryConditions.AddQueryCondition("name", EConditionTypes.Like, new object[] { "%" + txtTextToSearch.Text + "%" });
            }

            if (!rbAll.Checked)
            {
                queryConditions.AddQueryCondition("active", EConditionTypes.Equals, new object[] { rbOnlyActives.Checked ? 1 : 0 });
            }

            if ((cmbTypeFilter.SelectedIndex != -1) && (txtFilterValue.Text != ""))
            {
                EConditionTypes conditionType;

                if ((string)cmbTypeFilter.SelectedItem == ">")
                {
                    conditionType = EConditionTypes.MoreThan;
                }
                else if ((string)cmbTypeFilter.SelectedItem == ">=")
                {
                    conditionType = EConditionTypes.MoreThanOrEquals;
                }
                else if ((string)cmbTypeFilter.SelectedItem == "=")
                {
                    conditionType = EConditionTypes.Equals;
                }
                else if ((string)cmbTypeFilter.SelectedItem == "!=")
                {
                    conditionType = EConditionTypes.Not;
                }
                else if ((string)cmbTypeFilter.SelectedItem == "<")
                {
                    conditionType = EConditionTypes.LessThan;
                }
                else if ((string)cmbTypeFilter.SelectedItem == ">=")
                {
                    conditionType = EConditionTypes.LessThanOrEquals;
                }
                else
                {
                    conditionType = EConditionTypes.Equals;
                }

                queryConditions.AddQueryCondition("userId", conditionType, new object[] { txtFilterValue.Text });
            }

            dgvRegisters.DataSource = ConvORMHelper.ConvertListToDataTable(userEntity.Find(queryConditions));
            dgvRegisters.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
        }
Example #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (dgvRegisters.SelectedRows.Count != 0)
            {
                var userEntity = new UserEntity();

                var userRegister = new VUserRegister();
                userRegister.User = userEntity.Find((int)dgvRegisters.SelectedRows[0].Cells[0].Value);
                userRegister.ShowDialog();
                btnSearch.PerformClick();
            }
        }