Exemplo n.º 1
0
        // function to insert medicine
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            var medicine = new Framework.Database.Medicine
            {
                Name = txtName.Text,
                Price = Convert.ToDouble(txtPrice.Text),
                Stock = Convert.ToInt32(txtStock.Text),
                Description = txtDescription.Text,
                CategoryId = TextHelper.ToInteger(ddl_category.SelectedValue) ?? 1,
                Active = TextHelper.ToBool(ddl_active.SelectedValue) ?? false

            };

               var medicineObj = new Medicine();

            if (!medicineObj.Insert(medicine))
            {

            }
            else
            {
                Redirect("AddMedicine.aspx");
            }

            lblError.Text = "Medicine Saved";
            Reset();
            refreshGridView();
        }