コード例 #1
0
ファイル: ExpedienteBL.cs プロジェクト: paulonovich/DSDConFe
 public bool Agregar(ref Expediente pExpediente)
 {
     try
     {
         using (BDDOCUMENTUMEntities datos = new BaseDAO().conexion())
         {
             datos.Expedientes.AddObject(pExpediente);
             var vResult = datos.SaveChanges();
             if (vResult > 0)
                 return true;
             else
                 return false;
         }
     }
     catch (Exception)
     {
         throw new Exception("Ocurrio un error al registrar el expediente.");
     }
 }
コード例 #2
0
ファイル: ExpedienteBL.cs プロジェクト: paulonovich/DSDConFe
 public bool Actualizar(ref Expediente pExpediente)
 {
     try
     {
         using (BDDOCUMENTUMEntities datos = new BaseDAO().conexion())
         {
             datos.Expedientes.Attach(pExpediente);
             datos.ObjectStateManager.ChangeObjectState(pExpediente, System.Data.EntityState.Modified);
             var vResult = datos.SaveChanges();
             if (vResult > 0)
                 return true;
             else
                 throw new Exception("No existe el registro Expediente para modificar.");
         }
     }
     catch (Exception)
     {
         throw new Exception("Ocurrio un error al actualizar el expediente.");
     }
 }