示例#1
0
        private void PopulateTenants()
        {
            TenantDA      tenantDA = new TenantDA();
            List <Tenant> tenants  = tenantDA.GetAllTenants();

            DataGridViewTenants.Rows.Clear();

            int i = 0;

            while (i < tenants.Count)
            {
                DataGridViewRow row = new DataGridViewRow();
                row.CreateCells(DataGridViewTenants);
                row.Cells[0].Value = Helper.GetNepaliNumber(i + 1);
                row.Cells[1].Value = tenants[i].Fullname;
                row.Cells[2].Value = tenants[i].Address;
                row.Cells[3].Value = tenants[i].MobileNumber;
                row.Cells[4].Value = tenants[i].Father;

                // Store land_id as Tag
                row.Tag = tenants[i].TenantID.ToString();

                DataGridViewTenants.Rows.Add(row);
                i++;
            }
        }
        private void LoadComboBoxNewTenant()
        {
            TenantDA tenantDA = new TenantDA();

            if (ComboBoxCurrentTenant.Items.Count > 0)
            {
                Tenant tenant = (Tenant)ComboBoxCurrentTenant.SelectedItem;
                ComboBoxNewTenant.DataSource = tenantDA.GetAllTenantsExcept(tenant.TenantID);
            }
            else
            {
                ComboBoxNewTenant.DataSource = tenantDA.GetAllTenants();
            }

            ComboBoxNewTenant.DisplayMember = "Fullname";
            ComboBoxNewTenant.ValueMember   = "TenantID";
        }