Exemplo n.º 1
0
        private void AddTreeType()
        {
            var treeType = new TreeType();

            treeType.Name              = txtName.Text;
            treeType.Description       = txtDescription.Text;
            treeType.Photo             = txtPicture.Text;
            treeType.AvailabilityCount = int.Parse(txtAvailabilityCount.Text);
            treeType.TreePrice         = decimal.Parse(txtTreePrice.Text);
            treeType.PlantingPrice     = decimal.Parse(txtPlantingPrice.Text);
            treeType.Commision         = decimal.Parse(txtCommission.Text);


            treeType.RegionId = int.Parse(cbTreeRegion.SelectedValue.ToString());

            if (rbActive.Checked)
            {
                treeType.IsActive = true;
            }
            else if (rbPassive.Checked)
            {
                treeType.IsActive = false;
            }

            treeTypeService.Insert(treeType);
            this.Close();
            frmTreeTypes.RefreshGrid();
        }
Exemplo n.º 2
0
        public void UpdateTreeType()
        {
            var treeType = treeTypeService.Find(f => f.Id == selectedId);

            treeType.Name              = txtName.Text;
            treeType.Description       = txtDescription.Text;
            treeType.Photo             = txtPhoto.Text;
            treeType.PlantingPrice     = int.Parse(txtPlantingPrice.Text);
            treeType.TreePrice         = int.Parse(txtTreePrice.Text);
            treeType.AvailabilityCount = int.Parse(txtStock.Text);
            //treeType.RegionId = int.Parse(cbTreeRegion.SelectedValue.ToString());
            treeType.Commision = decimal.Parse(10.ToString());

            if (rbActive.Checked)
            {
                treeType.IsActive = true;
            }
            else
            {
                treeType.IsActive = false;
            }

            treeTypeService.Update(treeType);
            this.Close();
            frmTreeTypes.RefreshGrid();
        }