private bool SalvarDados() { try { var id = Session["idSvc"].ToString(); var vlr = Session["valorSvc"] == null ? txtPrecoCusto.Value : Session["valorSvc"].ToString(); var vlrTl = Session["valorTotal"] == null ? txtValorTotal.Value : Session["valorTotal"].ToString(); var qtde = Session["qtde"] == null ? txtQtd.Value : Session["qtde"].ToString(); var svc = new ServicoPedido() { Id = int.Parse(id), IdServico = int.Parse(ddlServico.SelectedValue), Data = DateTime.Parse(txtData.Value), Qtde = int.Parse(qtde), ValorUnitario = decimal.Parse(vlr), ValorTotal = decimal.Parse(vlrTl) }; if (id.Equals("0")) { return(ServicoPedido.Inserir(svc)); } else { return(ServicoPedido.Editar(svc)); } } catch (Exception ex) { ltlMsn.Text = "<div class=\"alert alert-block alert-danger fade in\"><button data-dismiss=\"alert\" class=\"close\" type=\"button\">X" + "</button><p><i class=\"fa fa-times-circle fa-lg\"></i>SalvarDados-ERRO:" + ex.Message + "</p></div>"; return(false); } }