Ejemplo n.º 1
0
 public static int Insert(tblCustom customs)
 {
     dbEcustomEntities _db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true));
     _db.Connection.Open();
     customs.CreatedDate = CommonFactory.GetCurrentDate();
     customs.ModifiedDate = CommonFactory.GetCurrentDate();
     customs.BranchId= FDHelper.RgCodeOfUnit();
     _db.AddTotblCustoms(customs);
     try
     {
         if (_db.Connection.State == ConnectionState.Closed) _db.Connection.Open();
         return _db.SaveChanges();
     }
     catch (Exception ex)
     {
         return -1;
     }
     finally
     {
         _db.Connection.Close();
     }
 }