public static int Insert(tblVehicleFeeSetting vehicleFee) { dbEcustomEntities _db = new dbEcustomEntities(Common.Decrypt(ConfigurationManager.ConnectionStrings["dbEcustomEntities"].ConnectionString, true)); _db.Connection.Open(); vehicleFee.CreatedDate = CommonFactory.GetCurrentDate(); vehicleFee.UpdatedDate = CommonFactory.GetCurrentDate(); _db.AddTotblVehicleFeeSettings(vehicleFee); try { if (_db.Connection.State == ConnectionState.Closed) _db.Connection.Open(); return _db.SaveChanges(); } catch (Exception ex) { return 0; } finally { _db.Connection.Close(); } }