public bool AdicionaAta(ata atap)
        {
            try
            {
                conservadoraEntities model = Conexao.getInstance();
                IQueryable<ata> i = from p in model.atas select p;
                IEnumerable<ata> max = i.OrderBy(p => p.idata);

                if (max.Count() > 0)
                    atap.idata = max.Last().idata == null ? 1 : max.Last().idata + 1;
                else
                    atap.idata = 1;

                atap.condominio = (from p in model.condominios where p.idcondominios == atap.idcondominios select p).FirstOrDefault();

                model.AddToatas(atap);

                model.SaveChanges();
                return true;
            }
            catch (Exception e)
            {
                var x = e.InnerException;
                return false;
            }
        }
 public bool SalvaAta(ata atap, string acesso)
 {
     if (acesso != Conexao.SenhaAcesso) throw new Exception();
     return controle.SalvaAta(atap);
 }
 /// <summary>
 /// Create a new ata object.
 /// </summary>
 /// <param name="idata">Initial value of the idata property.</param>
 /// <param name="idcondominios">Initial value of the idcondominios property.</param>
 public static ata Createata(global::System.Int32 idata, global::System.Int32 idcondominios)
 {
     ata ata = new ata();
     ata.idata = idata;
     ata.idcondominios = idcondominios;
     return ata;
 }
        public bool SalvaAta(ata atap)
        {
            try
            {
                conservadoraEntities model = Conexao.getInstance();
                IQueryable<ata> query = from p in model.atas where p.idata == atap.idata select p;
                ata ata2 = query.First();
                ata2.idata = atap.idata;

                ata2.data = atap.data;
                ata2.caminhoArquivo = atap.caminhoArquivo;
                ata2.idcondominios = atap.idcondominios;
                model.SaveChanges();
                return true;
            }
            catch (Exception e)
            {
                var x = e.InnerException;
                return false;
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the atas EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToatas(ata ata)
 {
     base.AddObject("atas", ata);
 }