public static CustoProjetoVM GetProjeto(Sistema.Model.Entities.Projeto model)
        {
            var _result = new CustoProjetoVM
            {
                descricao = model.descricao,
                idProjeto = model.idProjeto,
                status = model.status,
                dtInicio = model.dtInicio,
                Cliente = Models.Cliente.Consultar.GetModel(model.Cliente),
                Custos = CustoVM.GetCustos(model.ProjetoCustos)
            };

            return _result;
        }
        public ActionResult AddCusto(CustoProjetoVM model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    LogBLL.Insert(new LogDado("AddCusto", "Projeto", _idUsuario));
                    using (var db = new Context())
                    {
                        using (var trans = new RP.DataAccess.RPTransactionScope(db))
                        {
                            var _projeto = model.GetProjeto();

                            var _bll = new BLL.ProjetoBLL(db, _idUsuario);

                            _bll.AddCustos(_projeto);
                            _bll.SaveChanges();
                            trans.Complete();

                            this.AddFlashMessage(RP.Util.Resource.Message.INSERT_SUCCESS, FlashMessage.SUCCESS);
                            return RedirectToAction("Index");
                        }
                    }
                }
                catch (Exception ex)
                {
                    RP.Util.Entity.ErroLog.Add(ex, Session.SessionID, _idUsuario);
                    return RedirectToAction("Index", "Erro", new { area = string.Empty });
                }
            }
            return View(model);
        }