Example #1
0
        protected void BtnSalvar_Click(object sender, EventArgs e)
        {
            Model.Orcamento orcamento = getData();
            var             db        = new OrcamentoDB();

            if ((IdH.Value == "0") || (IdH.Value == ""))
            {
                if (db.Insert(orcamento))
                {
                    LblMsg.Text = "Registro inserido!";
                    LoadGrid();
                }
                else
                {
                    LblMsg.Text = "Erro ao inserir registro";
                }
            }
            else
            {
                if (db.Update(orcamento, int.Parse(IdH.Value)))
                {
                    LblMsg.Text = "Registro atualizado!";
                }
                else
                {
                    LblMsg.Text = "Erro ao atualizar registro";
                }
            }

            LoadGrid();
        }