Ejemplo n.º 1
0
 public void Initialize()
 {
     dao = null;
     dao = new HabitatDAO();
     conn = null;
     conn = SQLiteConnectionFactory.GetPrimaryDBConnection();
 }
Ejemplo n.º 2
0
        public HuntEditor(int huntId)
            : this()
        {
            log.Debug("Loading Editor for huntId: " + huntId);

            SQLiteConnection conn = SQLiteConnectionFactory.GetPrimaryDBConnection();
            HuntDAO dao = new HuntDAO();
            HabitatDAO habitatDAO = new HabitatDAO();
            Hunt hunt = dao.ReadById(huntId, conn);
            AddGuidesToList(hunt);

            isUpdate = true;

            this.label_huntId.Text = Convert.ToString(hunt.HuntId);
            this.comboBox_habitat.SelectedValue = hunt.Habitat.HabitatId;
            this.comboBox_provider.SelectedValue = hunt.Habitat.ProviderId;
            this.comboBox_group.SelectedValue = hunt.Group.GroupId;
            this.datePicker_huntDate.Value = hunt.HuntDate;
            this.numericUpDown_pheasant.Value = hunt.Harvest.Pheasant;
            this.numericUpDown_grouse.Value = hunt.Harvest.Grouse;
            this.numericUpDown_partridge.Value = hunt.Harvest.Partridge;
            this.numericUpDown_birdsSeen.Value = hunt.Harvest.BirdsSeen;
            this.numericUpDown_birdsMissed.Value = hunt.Harvest.BirdsMissed;
            this.numericUpDown_numberOfGuns.Value = hunt.NumberOfGuns;
            this.textBox_crop.Text = hunt.Harvest.Crop;
            this.textBox_comments.Text = hunt.Comments;

            checkBox_allowDelete.Enabled = true;

            string cropHarvested = hunt.Harvest.CropHarvested;

            if (cropHarvested == "Y")
            {
                radioButton_harvestYes.Checked = true;
            }
            else if (cropHarvested == "N")
            {
                radioButton_harvestNo.Checked = true;
            }
        }
Ejemplo n.º 3
0
 private Habitat InsertTestHabitat(SQLiteConnection conn, Provider p, int i)
 {
     HabitatDAO habitatDAO = new HabitatDAO();
     string name = habitatName1[rand.Next(0, habitatName1.Length)] + " " + habitatName2[rand.Next(0, habitatName2.Length)] + i;
     Habitat h = new Habitat() { HabitatName = name, ProviderId = p.ProviderId };
     habitatDAO.Create(h, conn);
     h.HabitatId = habitatDAO.Read("SELECT * FROM habitats WHERE habitat_id = (SELECT max(habitat_id) FROM habitats)", conn)[0].HabitatId;
     return h;
 }
Ejemplo n.º 4
0
 private Habitat InsertTestHabitat(SQLiteConnection conn, Provider p)
 {
     HabitatDAO habitatDAO = new HabitatDAO();
     Habitat h = new Habitat() { HabitatName = "HuntTestHabitat", ProviderId = p.ProviderId };
     habitatDAO.Create(h, conn);
     h.HabitatId = habitatDAO.Read("SELECT * FROM habitats WHERE habitat_name = 'HuntTestHabitat'", conn)[0].HabitatId;
     return h;
 }