Exemplo n.º 1
0
 public static int InsertToaTau(List<tblToaTau> listToaTau)
 {
     var _db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
     _db.Connection.Open();
     foreach (var toaTau in listToaTau)
     {
         toaTau.CreatedDate = CommonFactory.GetCurrentDate();
         _db.AddTotblToaTaus(toaTau);   
     }
     try
     {
         if (_db.Connection.State == ConnectionState.Closed) _db.Connection.Open();
         return _db.SaveChanges();
     }
     catch (Exception ex)
     {
         return -1;
     }
     finally
     {
         _db.Connection.Close();
     }
 }
Exemplo n.º 2
0
 public static int InsertToaTau(tblToaTau toaTau)
 {
     var _db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
     _db.Connection.Open();
     toaTau.CreatedDate = CommonFactory.GetCurrentDate();
     toaTau.BranchId = FDHelper.RgCodeOfUnit();
     _db.AddTotblToaTaus(toaTau);
     try
     {
         if (_db.Connection.State == ConnectionState.Closed) _db.Connection.Open();
         return _db.SaveChanges();
     }
     catch (Exception ex)
     {
         return -1;
     }
     finally
     {
         _db.Connection.Close();
     }
 }