示例#1
0
        private void FrmTreeType_Load(object sender, EventArgs e)
        {
            if (selectedId != null)
            {
                var treeType = treeTypeService.Find(f => f.Id == selectedId);
                txtName.Text              = treeType.Name;
                txtDescription.Text       = treeType.Description;
                txtPicture.Text           = treeType.Photo;
                txtAvailabilityCount.Text = treeType.AvailabilityCount.ToString();
                txtTreePrice.Text         = treeType.TreePrice.ToString();
                txtPlantingPrice.Text     = treeType.PlantingPrice.ToString();
                txtCommission.Text        = treeType.Commision.ToString();


                int regionId = treeType.RegionId;
                var region   = regionService.Find(regionId);


                cbTreeRegion.DataSource    = regionService.GetAll();
                cbTreeRegion.ValueMember   = "Id";
                cbTreeRegion.DisplayMember = "Name";
                cbTreeRegion.SelectedIndex = cbTreeRegion.FindString(region.Name);

                if (treeType.IsActive)
                {
                    rbActive.Checked = true;
                }
                else
                {
                    rbPassive.Checked = true;
                }
            }
        }
示例#2
0
 private void FrmTreeType_Load(object sender, EventArgs e)
 {
     cbTreeRegion.DataSource    = regionService.GetAll();
     cbTreeRegion.ValueMember   = "Id";
     cbTreeRegion.DisplayMember = "Name";
     if (selectedId != null)
     {
         var treeType = treeTypeService.Find(f => f.Id == selectedId);
         txtName.Text          = treeType.Name;
         txtDescription.Text   = treeType.Description;
         txtPhoto.Text         = treeType.Photo;
         txtPlantingPrice.Text = treeType.PlantingPrice.ToString();
         txtStock.Text         = treeType.AvailabilityCount.ToString();
         txtTreePrice.Text     = treeType.TreePrice.ToString();
         var region = regionService.Find(int.Parse(cbTreeRegion.SelectedValue.ToString()));
         treeType.Regions.Add(region);
         //cbTreeRegion.SelectedItem = treeType.Region.Name;
         if (treeType.IsActive)
         {
             rbActive.Checked = true;
         }
         else
         {
             rbPassive.Checked = true;
         }
     }
 }